summaryrefslogtreecommitdiff
path: root/src/misc_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-12-11 20:38:37 +0000
committerrubidium <rubidium@openttd.org>2010-12-11 20:38:37 +0000
commit9bc1e35625fe9e203fc3808283c2af74f0c621db (patch)
tree73f396bbd29b70801f523b997688f3545f1d4287 /src/misc_gui.cpp
parent293ede7bdf2e3e4f2aeadd382fe3965a3fb0230c (diff)
downloadopenttd-9bc1e35625fe9e203fc3808283c2af74f0c621db.tar.xz
(svn r21472) -Fix [FS#4298] (r21459-ish): make sure the query window is only opened once per parent window / callback.
Diffstat (limited to 'src/misc_gui.cpp')
-rw-r--r--src/misc_gui.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 887362571..ef485c7be 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -1483,7 +1483,6 @@ struct QueryWindow : public Window {
this->InitNested(desc);
- if (parent == NULL) parent = FindWindowById(WC_MAIN_WINDOW, 0);
this->parent = parent;
this->left = parent->left + (parent->width / 2) - (this->width / 2);
this->top = parent->top + (parent->height / 2) - (this->height / 2);
@@ -1599,5 +1598,18 @@ static const WindowDesc _query_desc(
*/
void ShowQuery(StringID caption, StringID message, Window *parent, QueryCallbackProc *callback)
{
+ if (parent == NULL) parent = FindWindowById(WC_MAIN_WINDOW, 0);
+
+ const Window *w;
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->window_class != WC_CONFIRM_POPUP_QUERY) continue;
+
+ const QueryWindow *qw = (const QueryWindow *)w;
+ if (qw->parent != parent || qw->proc != callback) continue;
+
+ delete qw;
+ break;
+ }
+
new QueryWindow(&_query_desc, caption, message, parent, callback);
}