fix UtBS freeze on lvl3
This commit is contained in:
parent
9500c55b10
commit
100619c6c6
4 changed files with 14 additions and 11 deletions
|
@ -148,13 +148,15 @@ std::string recruit_unit(const gamemap& map, int side,
|
|||
}
|
||||
|
||||
units.insert(std::pair<gamemap::location,unit>( recruit_location,new_unit));
|
||||
unit_map::iterator un = units.find(recruit_location);
|
||||
unit_map::iterator un = disp->get_units().find(recruit_location);
|
||||
|
||||
|
||||
if(show) {
|
||||
if(show && un !=disp->get_units().end()) {
|
||||
|
||||
un->second.set_recruited(*disp);
|
||||
un->second.set_hidden(true);
|
||||
disp->scroll_to_tile(recruit_location.x,recruit_location.y,display::ONSCREEN);
|
||||
un->second.set_hidden(false);
|
||||
un->second.set_recruited(*disp);
|
||||
while(!un->second.get_animation()->animation_finished()) {
|
||||
disp->draw_tile(recruit_location.x,recruit_location.y);
|
||||
disp->update_display();
|
||||
|
|
|
@ -1327,19 +1327,19 @@ void display::draw_tile(int x, int y)
|
|||
{
|
||||
reach_map::iterator reach = reach_map_.end();
|
||||
|
||||
const gamemap::location loc(x,y);
|
||||
unit_map::iterator it = units_.find(loc);
|
||||
if(it != units_.end()) {
|
||||
it->second.refresh();
|
||||
}
|
||||
if(screen_.update_locked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const gamemap::location loc(x,y);
|
||||
int xpos = int(get_location_x(loc));
|
||||
int ypos = int(get_location_y(loc));
|
||||
|
||||
unit_map::iterator it = units_.find(loc);
|
||||
if(it != units_.end()) {
|
||||
it->second.refresh();
|
||||
}
|
||||
SDL_Rect clip_rect = map_area();
|
||||
|
||||
if(xpos >= clip_rect.x + clip_rect.w || ypos >= clip_rect.y + clip_rect.h ||
|
||||
|
|
|
@ -288,7 +288,7 @@ public:
|
|||
void set_playing_team(size_t team);
|
||||
const std::vector<team>& get_teams() {return teams_;};
|
||||
|
||||
const unit_map& get_units() {return units_;};
|
||||
unit_map& get_units() {return units_;};
|
||||
|
||||
//compat methods to be dropped after full migration
|
||||
void lock_updates(bool value) {screen_.lock_updates(value); };
|
||||
|
|
|
@ -1109,9 +1109,10 @@ bool event_handler::handle_event_command(const queued_event& event_info,
|
|||
unit_map::iterator un = units->find(loc);
|
||||
|
||||
if(show) {
|
||||
|
||||
un->second.set_recruited(*screen);
|
||||
un->second.set_hidden(true);
|
||||
screen->scroll_to_tile(loc.x,loc.y,display::ONSCREEN);
|
||||
un->second.set_hidden(false);
|
||||
un->second.set_recruited(*screen);
|
||||
while(!un->second.get_animation()->animation_finished()) {
|
||||
screen->draw_tile(loc.x,loc.y);
|
||||
screen->update_display();
|
||||
|
|
Loading…
Add table
Reference in a new issue