diff options
author | Darkvater <Darkvater@openttd.org> | 2006-12-29 17:54:47 +0000 |
---|---|---|
committer | Darkvater <Darkvater@openttd.org> | 2006-12-29 17:54:47 +0000 |
commit | a7f2b8095f09bc0d032f0c6f0d35c41c26e95bda (patch) | |
tree | 74ccb73656b5133e8ffcd6d610d5fd1ff7615e4a /genworld_gui.c | |
parent | 324e805d5153efcb1c44c1998cfd92b20fb7c2cc (diff) | |
download | openttd-a7f2b8095f09bc0d032f0c6f0d35c41c26e95bda.tar.xz |
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
a parent pointer which will be blocked as long as the popup is open. This
applies to newgrf-apply, heightmap warning, genworld progress.
Diffstat (limited to 'genworld_gui.c')
-rw-r--r-- | genworld_gui.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/genworld_gui.c b/genworld_gui.c index 260e133a3..1dfd758e0 100644 --- a/genworld_gui.c +++ b/genworld_gui.c @@ -176,16 +176,9 @@ static void StartGeneratingLandscape(glwp_modes mode) } } -static void HeightmapScaledTooMuchCallback(bool ok_clicked) +static void HeightmapScaledTooMuchCallback(Window *w, bool confirmed) { - if (ok_clicked) { - Window *w; - glwp_modes mode = 0; - for (mode = 0; mode < GLWP_END; mode++) { - w = FindWindowById(WC_GENERATE_LANDSCAPE, mode); - if (w != NULL) StartGeneratingLandscape(mode); - } - } + if (confirmed) StartGeneratingLandscape((glwp_modes)w->window_number); } void GenerateLandscapeWndProc(Window *w, WindowEvent *e) @@ -330,7 +323,11 @@ void GenerateLandscapeWndProc(Window *w, WindowEvent *e) if (mode == GLWP_HEIGHTMAP && ( _heightmap_x * 2 < (1U << _patches_newgame.map_x) || _heightmap_x / 2 > (1U << _patches_newgame.map_x) || _heightmap_y * 2 < (1U << _patches_newgame.map_y) || _heightmap_y / 2 > (1U << _patches_newgame.map_y))) { - ShowQuery(STR_HEIGHTMAP_SCALE_WARNING_CAPTION, STR_HEIGHTMAP_SCALE_WARNING_MESSAGE, HeightmapScaledTooMuchCallback, WC_GENERATE_LANDSCAPE, mode); + ShowQuery( + STR_HEIGHTMAP_SCALE_WARNING_CAPTION, + STR_HEIGHTMAP_SCALE_WARNING_MESSAGE, + w, + HeightmapScaledTooMuchCallback); } else { StartGeneratingLandscape(mode); } @@ -722,10 +719,13 @@ typedef struct tp_info { static tp_info _tp; -static void AbortGeneratingWorldCallback(bool ok_clicked) +static void AbortGeneratingWorldCallback(Window *w, bool confirmed) { - if (ok_clicked) AbortGeneratingWorld(); - else if (IsGeneratingWorld() && !IsGeneratingWorldAborted()) SetMouseCursor(SPR_CURSOR_ZZZ); + if (confirmed) { + AbortGeneratingWorld(); + } else if (IsGeneratingWorld() && !IsGeneratingWorldAborted()) { + SetMouseCursor(SPR_CURSOR_ZZZ); + } } static void ShowTerrainProgressProc(Window* w, WindowEvent* e) @@ -735,7 +735,12 @@ static void ShowTerrainProgressProc(Window* w, WindowEvent* e) switch (e->we.click.widget) { case 2: if (_cursor.sprite == SPR_CURSOR_ZZZ) SetMouseCursor(SPR_CURSOR_MOUSE); - ShowQuery(STR_GENERATION_ABORT_CAPTION, STR_GENERATION_ABORT_MESSAGE, AbortGeneratingWorldCallback, WC_GENERATE_PROGRESS_WINDOW, 0); + ShowQuery( + STR_GENERATION_ABORT_CAPTION, + STR_GENERATION_ABORT_MESSAGE, + w, + AbortGeneratingWorldCallback + ); break; } break; |