summaryrefslogtreecommitdiff
path: root/src/progress.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-08-24 12:18:53 +0000
committerrubidium <rubidium@openttd.org>2011-08-24 12:18:53 +0000
commit70179db81e5a7fff78b558de9f39521c44a16886 (patch)
treea5c98947d09effd5e5005211b82c18769e4845b3 /src/progress.cpp
parent38ad276acc6f108162c4255b837d4c450b91f23d (diff)
downloadopenttd-70179db81e5a7fff78b558de9f39521c44a16886.tar.xz
(svn r22820) -Codechange: perform a full (re)draw cycle in the first draw during progress instead of waiting 200ms
Diffstat (limited to 'src/progress.cpp')
-rw-r--r--src/progress.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/progress.cpp b/src/progress.cpp
index ac34afd07..208f681a6 100644
--- a/src/progress.cpp
+++ b/src/progress.cpp
@@ -15,6 +15,7 @@
/** Are we in a modal progress or not? */
bool _in_modal_progress = false;
+bool _first_in_modal_loop = false;
/** Rights for the performing work. */
ThreadMutex *_modal_progress_work_mutex = ThreadMutex::New();
/** Rights for the painting. */
@@ -22,9 +23,23 @@ ThreadMutex *_modal_progress_paint_mutex = ThreadMutex::New();
/**
* Set the modal progress state.
+ * @note Makes IsFirstModalProgressLoop return true for the next call.
* @param state The new state; are we modal or not?
*/
void SetModalProgress(bool state)
{
_in_modal_progress = state;
+ _first_in_modal_loop = true;
+}
+
+/**
+ * Check whether this is the first modal progress loop.
+ * @note Set by SetModalProgress, unset by calling this method.
+ * @return True if this is the first loop.
+ */
+bool IsFirstModalProgressLoop()
+{
+ bool ret = _first_in_modal_loop;
+ _first_in_modal_loop = false;
+ return ret;
}