fixed problem with AI attacking units not always advancing levels
This commit is contained in:
parent
256680aba6
commit
21b16fc305
2 changed files with 14 additions and 1 deletions
11
src/ai.cpp
11
src/ai.cpp
|
@ -570,6 +570,17 @@ void do_move(display& disp, const gamemap& map, const game_data& gameinfo,
|
|||
if(units.count(attacker) && units.count(target)) {
|
||||
attack(disp,map,attacker,target,weapon,units,state,
|
||||
gameinfo,false);
|
||||
|
||||
const std::map<gamemap::location,unit>::const_iterator tgt =
|
||||
units.find(target);
|
||||
|
||||
const bool defender_human = (tgt != units.end()) ?
|
||||
teams[tgt->second.side()-1].is_human() : false;
|
||||
|
||||
|
||||
dialogs::advance_unit(gameinfo,units,attacker,disp,true);
|
||||
dialogs::advance_unit(gameinfo,units,target,disp,!defender_human);
|
||||
|
||||
check_victory(units,teams);
|
||||
}
|
||||
|
||||
|
|
|
@ -267,9 +267,11 @@ void turn_info::mouse_motion(const SDL_MouseMotionEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
const unit_map::const_iterator un = units_.find(new_hex);
|
||||
const unit_map::iterator un = units_.find(new_hex);
|
||||
|
||||
if(un != units_.end() && un->second.side() != team_num_) {
|
||||
unit_movement_resetter move_reset(un->second);
|
||||
|
||||
const bool ignore_zocs = un->second.type().is_skirmisher();
|
||||
const bool teleport = un->second.type().teleports();
|
||||
current_paths_ = paths(map_,gameinfo_,units_,new_hex,teams_,
|
||||
|
|
Loading…
Add table
Reference in a new issue