Fix bug #25356: game lags horribly, and quickly ends up completely frozen

This commit is contained in:
Jyrki Vesterinen 2016-12-31 11:25:45 +02:00
parent 32ae3d3501
commit 7d403bcd69
3 changed files with 13 additions and 0 deletions

View file

@ -15,6 +15,8 @@ Version 1.13.6+dev:
* WML Engine:
* Removed LOW_MEM option when building.
* Add color= attribute to [floating_text]
* Miscellaneous and bug fixes:
* Fixed severe lag/freeze on slow PCs (bug #25356)
Version 1.13.6:
* AI:

View file

@ -9,6 +9,9 @@ Version 1.13.6+dev:
* Language and i18n:
* Updated translations: British English, German, Portuguese (Brazil).
* Miscellaneous and bug fixes:
* Fixed severe lag/freeze on slow PCs (bug #25356)
Version 1.13.6:
* AI:

View file

@ -472,6 +472,14 @@ void pump()
last_resize_event_used = true;
}
// move all draw events to the end of the queue
auto first_draw_event = std::remove_if(events.begin(), events.end(),
[](const SDL_Event& e) {return e.type == DRAW_EVENT;});
if(first_draw_event != events.end()) {
// remove all draw events except one
events.erase(first_draw_event + 1, events.end());
}
ev_end = events.end();
for(ev_it = events.begin(); ev_it != ev_end; ++ev_it){