This commit is contained in:
Benoît Timbert 2006-02-21 08:34:08 +00:00
parent a19e658413
commit bf62b2eec8

View file

@ -739,7 +739,7 @@ void attack(display& gui, const gamemap& map,
//defender, so we have to make sure they still exist
a = units.find(attacker);
d = units.find(defender);
if(a == units.end() || d == units.end() || size_t(attack_with) >= a->second.attacks().size() || size_t(stats.defend_with) >= d->second.attacks().size()) {
if(a == units.end() || d == units.end() || (attack_with != -1 && size_t(attack_with) >= a->second.attacks().size()) || (stats.defend_with != -1 && size_t(stats.defend_with) >= d->second.attacks().size())) {
return;
}
@ -825,7 +825,7 @@ void attack(display& gui, const gamemap& map,
game_events::fire("attacker_hits",attacker,defender,dat);
a = units.find(attacker);
d = units.find(defender);
if(a == units.end() || d == units.end() || size_t(attack_with) >= a->second.attacks().size() || size_t(stats.defend_with) >= d->second.attacks().size()) {
if(a == units.end() || d == units.end() || (attack_with != -1 && size_t(attack_with) >= a->second.attacks().size()) || (stats.defend_with != -1 && size_t(stats.defend_with)) >= d->second.attacks().size()) {
recalculate_fog(map,state,info,units,teams,attacker_side-1);
recalculate_fog(map,state,info,units,teams,defender_side-1);
gui.recalculate_minimap();
@ -856,7 +856,7 @@ void attack(display& gui, const gamemap& map,
game_events::fire("attacker_misses",attacker,defender,dat);
a = units.find(attacker);
d = units.find(defender);
if(a == units.end() || d == units.end() || size_t(attack_with) >= a->second.attacks().size() || size_t(stats.defend_with) >= d->second.attacks().size()) {
if(a == units.end() || d == units.end() || (attack_with != -1 && size_t(attack_with) >= a->second.attacks().size()) || (stats.defend_with != -1 && size_t(stats.defend_with) >= d->second.attacks().size())) {
recalculate_fog(map,state,info,units,teams,attacker_side-1);
recalculate_fog(map,state,info,units,teams,defender_side-1);
gui.recalculate_minimap();
@ -1071,7 +1071,7 @@ void attack(display& gui, const gamemap& map,
game_events::fire("defender_hits",attacker,defender,dat);
a = units.find(attacker);
d = units.find(defender);
if(a == units.end() || d == units.end() || size_t(attack_with) >= a->second.attacks().size() || size_t(stats.defend_with) >= d->second.attacks().size()) {
if(a == units.end() || d == units.end() || (attack_with != -1 && size_t(attack_with) >= a->second.attacks().size()) || (stats.defend_with != -1 && size_t(stats.defend_with) >= d->second.attacks().size())) {
recalculate_fog(map,state,info,units,teams,attacker_side-1);
recalculate_fog(map,state,info,units,teams,defender_side-1);
gui.recalculate_minimap();
@ -1100,7 +1100,7 @@ void attack(display& gui, const gamemap& map,
game_events::fire("defender_misses",attacker,defender,dat);
a = units.find(attacker);
d = units.find(defender);
if(a == units.end() || d == units.end() || size_t(attack_with) >= a->second.attacks().size() || size_t(stats.defend_with) >= d->second.attacks().size()) {
if(a == units.end() || d == units.end() || (attack_with != -1 && size_t(attack_with) >= a->second.attacks().size()) || (stats.defend_with != -1 && size_t(stats.defend_with) >= d->second.attacks().size())) {
recalculate_fog(map,state,info,units,teams,attacker_side-1);
recalculate_fog(map,state,info,units,teams,defender_side-1);
gui.recalculate_minimap();