From 8ca10353163dfb34174b4c2a1fad94c3286bb868 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 4 May 2008 09:39:16 +0000 Subject: (svn r12939) -Codechange: do not use the window proc to determine whether a toolbar is a rail toolbar, but use the window number. --- src/rail_gui.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/rail_gui.cpp') diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 748c74249..840bf8062 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -748,10 +748,10 @@ void ShowBuildRailToolbar(RailType railtype, int button) if (!ValParamRailtype(railtype)) return; // don't recreate the window if we're clicking on a button and the window exists. - if (button < 0 || !(w = FindWindowById(WC_BUILD_TOOLBAR, 0)) || w->wndproc != BuildRailToolbWndProc) { - DeleteWindowById(WC_BUILD_TOOLBAR, 0); + if (button < 0 || !(w = FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL))) { + DeleteWindowByClass(WC_BUILD_TOOLBAR); _cur_railtype = railtype; - w = AllocateWindowDesc(&_build_rail_desc); + w = AllocateWindowDescFront(&_build_rail_desc, TRANSPORT_RAIL); SetupRailToolbar(railtype, w); } @@ -1597,8 +1597,8 @@ void ReinitGuiAfterToggleElrail(bool disable) if (disable && _last_built_railtype == RAILTYPE_ELECTRIC) { Window *w; _last_built_railtype = _cur_railtype = RAILTYPE_RAIL; - w = FindWindowById(WC_BUILD_TOOLBAR, 0); - if (w != NULL && w->wndproc == BuildRailToolbWndProc) { + w = FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL); + if (w != NULL) { SetupRailToolbar(_cur_railtype, w); SetWindowDirty(w); } @@ -1648,8 +1648,8 @@ static void SetDefaultRailGui() } _last_built_railtype = _cur_railtype = rt; - Window *w = FindWindowById(WC_BUILD_TOOLBAR, 0); - if (w != NULL && w->wndproc == BuildRailToolbWndProc) { + Window *w = FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL); + if (w != NULL) { SetupRailToolbar(_cur_railtype, w); SetWindowDirty(w); } -- cgit v1.2.3-54-g00ecf