fixed graphical glitch where AI units would disappear for a frame before moving
This commit is contained in:
parent
8d2cb4a477
commit
4a48f5e585
1 changed files with 9 additions and 4 deletions
13
src/ai.cpp
13
src/ai.cpp
|
@ -379,11 +379,10 @@ gamemap::location ai_interface::move_unit(location from, location to, std::map<l
|
|||
paths current_paths(info_.map,info_.state,info_.gameinfo,info_.units,from,info_.teams,ignore_zocs,teleport);
|
||||
paths_wiper wiper(info_.disp);
|
||||
|
||||
unit current_unit = u_it->second;
|
||||
info_.units.erase(u_it);
|
||||
|
||||
const std::map<location,paths>::iterator p_it = possible_moves.find(from);
|
||||
|
||||
unit current_unit = u_it->second;
|
||||
|
||||
if(p_it != possible_moves.end()) {
|
||||
paths& p = p_it->second;
|
||||
std::map<location,paths::route>::iterator rt = p.routes.begin();
|
||||
|
@ -424,18 +423,24 @@ gamemap::location ai_interface::move_unit(location from, location to, std::map<l
|
|||
|
||||
steps.push_back(to); //add the destination to the steps
|
||||
|
||||
if(show_move && unit_display::unit_visible_on_path(info_.disp,info_.map,steps,current_unit,info_.state.get_time_of_day(),info_.units,info_.teams)) {
|
||||
if(show_move && unit_display::unit_visible_on_path(info_.disp,info_.map,steps,u_it->second,info_.state.get_time_of_day(),info_.units,info_.teams)) {
|
||||
|
||||
if(!info_.disp.fogged(from.x,from.y)) {
|
||||
info_.disp.set_paths(¤t_paths);
|
||||
}
|
||||
|
||||
info_.disp.scroll_to_tiles(from.x,from.y,to.x,to.y);
|
||||
info_.units.erase(u_it);
|
||||
u_it = info_.units.end();
|
||||
unit_display::move_unit(info_.disp,info_.map,steps,current_unit,info_.state.get_time_of_day(),info_.units,info_.teams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(u_it != info_.units.end()) {
|
||||
info_.units.erase(u_it);
|
||||
}
|
||||
|
||||
current_unit.set_movement(0);
|
||||
info_.units.insert(std::pair<location,unit>(to,current_unit));
|
||||
if(info_.map.is_village(to)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue