summaryrefslogtreecommitdiff
path: root/engine_gui.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-11-18 17:04:44 +0000
committerDarkvater <darkvater@openttd.org>2006-11-18 17:04:44 +0000
commit53f954edd3ecf5f9199ee684ac39685a481f8e97 (patch)
tree8c4132a7ae7df56d2180aa2fa9fa2d88c5cbcf76 /engine_gui.c
parentb3c48c0a84323838b5104e422d11b8a1250325c8 (diff)
downloadopenttd-53f954edd3ecf5f9199ee684ac39685a481f8e97.tar.xz
(svn r7206) -Codechange: Remove (some of) the magic needed for windows that could be invalid after
a call to DeleteWindow() somewhere else. Also do some cleanup with AllowWindowDescFront()
Diffstat (limited to 'engine_gui.c')
-rw-r--r--engine_gui.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/engine_gui.c b/engine_gui.c
index 30a5e2cce..30c294b1e 100644
--- a/engine_gui.c
+++ b/engine_gui.c
@@ -93,12 +93,10 @@ static void EnginePreviewWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
switch (e->we.click.widget) {
- case 3:
- DeleteWindow(w);
- break;
-
case 4:
DoCommandP(0, w->window_number, 0, NULL, CMD_WANT_ENGINE_PREVIEW);
+ /* Fallthrough */
+ case 3:
DeleteWindow(w);
break;
}
@@ -117,10 +115,7 @@ static const WindowDesc _engine_preview_desc = {
void ShowEnginePreviewWindow(EngineID engine)
{
- Window *w;
-
- w = AllocateWindowDesc(&_engine_preview_desc);
- w->window_number = engine;
+ Window *w = AllocateWindowDescFront(&_engine_preview_desc, engine);
}
static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw)