mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-17 11:28:16 +00:00
Stop hidden weapons (attack_weight=0) from skewing the best weapon selection
This commit is contained in:
parent
a9cbaeedc7
commit
2bfebcaf61
@ -149,6 +149,7 @@ Version 1.9.0-svn:
|
||||
* Cleaned up the gui2 code at various places
|
||||
* Don't crash if a [story] [part] [if] misses [then] or [else] (bug #16028)
|
||||
* Fix a crash on OS X caused by passing invalid utf8 to pango (bug #16020)
|
||||
* Hidden weapons (attack_weight = 0) no longer skew the best weapon selection
|
||||
|
||||
Version 1.8.0:
|
||||
* AI:
|
||||
|
@ -641,7 +641,8 @@ int mouse_handler::fill_weapon_choices(std::vector<battle_context>& bc_vector, u
|
||||
battle_context bc(units_, attacker->get_location(), defender->get_location(), i);
|
||||
bc_vector.push_back(bc);
|
||||
if (bc.better_attack(bc_vector[best], 0.5)) {
|
||||
best = i;
|
||||
// as some weapons can be hidden, i is not a valid index into the resulting vector
|
||||
best = bc_vector.size() - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user