Notabilis has proposed merging
lp:~widelands-dev/widelands/bug-impregnable-castles into lp:widelands.
Commit message:
Checking for visibility of military building before permitting attack.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-impregnable-castles/+merge/345468
With big military buildings, i.e., castles, it can happen that only the left
side of the building is in the visibility range of another player.
If an own military building is near, that player can open the attack window and
select and order some soldiers to attack the castle. Only after ordering the
attack the game checks whether the door of the building is visible. Since it
isn't, no attack happens.
For the player this has the effect that an attack is ordered but is never
executed. This branch does an additional visibility check when calculating the
number of available soldiers for displaying the UI, returning 0 when the door
is invisible and the attack command would fail later on.
--
Your team Widelands Developers is requested to review the proposed merge of
lp:~widelands-dev/widelands/bug-impregnable-castles into lp:widelands.
=== modified file 'src/wui/attack_box.cc'
--- src/wui/attack_box.cc 2018-05-13 07:15:39 +0000
+++ src/wui/attack_box.cc 2018-05-13 07:57:07 +0000
@@ -48,8 +48,16 @@
uint32_t AttackBox::get_max_attackers() {
assert(player_);
- if (upcast(Building, building, map_.get_immovable(*node_coordinates_)))
+ if (upcast(Building, building, map_.get_immovable(*node_coordinates_))) {
+ if (player_->vision(
+ map_.get_index(building->get_position(), map_.get_width())) <= 1) {
+ // Player can't see the buildings door, so it can't be attacked
+ // This is the same check as done later on in send_player_enemyflagaction()
+ return 0;
+ }
+
return player_->find_attack_soldiers(building->base_flag());
+ }
return 0;
}
_______________________________________________
Mailing list: https://launchpad.net/~widelands-dev
Post to : [email protected]
Unsubscribe : https://launchpad.net/~widelands-dev
More help : https://help.launchpad.net/ListHelp