fixes to Out-of-Sync bug

This commit is contained in:
Dave White 2004-03-18 20:04:47 +00:00
parent 3d503a5632
commit 4abc25fc2e

View file

@ -139,8 +139,6 @@ gamemap::location ai_interface::move_unit(location from, location to, std::map<l
return location();
}
recorder.add_movement(from,to);
if(from == to) {
u_it->second.set_movement(0);
return to;
@ -204,6 +202,8 @@ gamemap::location ai_interface::move_unit(location from, location to, std::map<l
}
}
recorder.add_movement(from,to);
current_unit.set_movement(0);
info_.units.insert(std::pair<location,unit>(to,current_unit));
if(info_.map.underlying_terrain(info_.map[to.x][to.y]) == gamemap::TOWER)
@ -437,10 +437,10 @@ bool ai::do_combat(std::map<gamemap::location,paths>& possible_moves, const move
void ai_interface::attack_enemy(const location& u, const location& target, int weapon)
{
recorder.add_attack(u,target,weapon);
game_events::fire("attack",u,target);
if(info_.units.count(u) && info_.units.count(target)) {
recorder.add_attack(u,target,weapon);
game_events::fire("attack",u,target);
attack(info_.disp,info_.map,info_.teams,u,target,weapon,info_.units,info_.state,info_.gameinfo,false);
check_victory(info_.units,info_.teams);
dialogs::advance_unit(info_.gameinfo,info_.units,u,info_.disp,true);