diff options
author | frosch <frosch@openttd.org> | 2011-03-13 21:32:13 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2011-03-13 21:32:13 +0000 |
commit | 51ddbbb13d3c6277dcd04289623efe6e00e4f1b3 (patch) | |
tree | c540d777fce11f28bb4aa4fbb4411800d730a755 /src/window_gui.h | |
parent | ec9540a12a9170f8b88e1d715c9321edaeeebfd4 (diff) | |
download | openttd-51ddbbb13d3c6277dcd04289623efe6e00e4f1b3.tar.xz |
(svn r22242) -Codechange: Let OnInvalidateData() decide itself what to do immediately in command scope, and what to do asynchronously in GUI-scope.
Diffstat (limited to 'src/window_gui.h')
-rw-r--r-- | src/window_gui.h | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/window_gui.h b/src/window_gui.h index fc5ebeeda..0ec585e34 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -434,22 +434,16 @@ public: /** * Mark this window's data as invalid (in need of re-computing) * @param data The data to invalidate with + * @param gui_scope Whether the funtion is called from GUI scope. */ - void InvalidateData(int data = 0) + void InvalidateData(int data = 0, bool gui_scope = true) { this->SetDirty(); - this->OnInvalidateData(data); - } - - /** - * Schedule a invalidation call for next redraw. - * Important for asynchronous invalidation from commands. - * @param data The data to invalidate with - */ - void ScheduleInvalidateData(int data = 0) - { - this->SetDirty(); - *this->scheduled_invalidation_data.Append() = data; + if (!gui_scope) { + /* Schedule GUI-scope invalidation for next redraw. */ + *this->scheduled_invalidation_data.Append() = data; + } + this->OnInvalidateData(data, gui_scope); } /** @@ -458,7 +452,7 @@ public: void ProcessScheduledInvalidations() { for (int *data = this->scheduled_invalidation_data.Begin(); this->window_class != WC_INVALID && data != this->scheduled_invalidation_data.End(); data++) { - this->OnInvalidateData(*data); + this->OnInvalidateData(*data, true); } this->scheduled_invalidation_data.Clear(); } |