prevent all AI from attacking twice with the same unit

This commit is contained in:
Jérémy Rosen 2006-03-18 13:17:59 +00:00
parent 6c166bce87
commit 6d1dc0f2b5
2 changed files with 5 additions and 0 deletions

View File

@ -160,6 +160,7 @@ SVN trunk (1.1.1+svn):
* force a refresh after calls to ONSCREEN scrolls, to avoid refresh
problems.
* add sort_topics command to the WML of help
* check in ai code that ai doesn't use the same unit to attack twice
Version 1.1.1:
* campaigns

View File

@ -1006,6 +1006,10 @@ void ai_interface::attack_enemy(const location& u, const location& target, int w
LOG_STREAM(err, ai) << "attempt to attack unit that is turned to stone\n";
return;
}
if(!info_.units.find(u)->second.can_attack()) {
LOG_STREAM(err, ai) << "attempt to attack twice with the same unit\n";
return;
}
recorder.add_attack(u,target,weapon);