[Commits] [wesnoth/wesnoth] 454720: refactor is_observer out of check_victory

GitHub noreply at github.com
Fri May 23 03:26:02 UTC 2014


  Branch: refs/heads/1.12
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 454720492239aa5301dd00db657e5473dc6cb748
      https://github.com/wesnoth/wesnoth/commit/454720492239aa5301dd00db657e5473dc6cb748
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-05-22 (Thu, 22 May 2014)

  Changed paths:
    M src/play_controller.cpp

  Log Message:
  -----------
  refactor is_observer out of check_victory

This is a minor change to victory_when_enemies_defeated condition.

Old logic: If there are no not defeated sides which are enemies
of eachother (i.e. there is still a battle going on),
BUT victory_when_enemies_defeated = false, and either we found
a not defeated local human player, or we are a multiplayer observer
(there are no locally controlled sides), then don't end the level.

New logic: If there are no not defeated sides which are enemies,
BUT victory when enemies defeated = false, and EITHER we found a
not defeated local human player, OR there is a not defeated remote
human player AND no local human side assigned at all,
then don't end the level.

I think this more precisely the behavior we want. is_observer
doesn't belong in this function, and with the introduction of
defeat_condition, UMC will pretty much always be able to get the
behavior they want, so I'm much more comfortable to introduce this
change now than I would be otherwise.





More information about the Commits mailing list