From 1a506f5912b174f50e206b6489f5687d86ea23c6 Mon Sep 17 00:00:00 2001 From: smatz Date: Mon, 1 Jun 2009 13:34:13 +0000 Subject: (svn r16496) -Codechange: remove one useless dynamic_cast<> --- src/rail_gui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 3977bfc63..783723863 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -851,13 +851,13 @@ static void SetupRailToolbar(RailType railtype, Window *w) */ void ShowBuildRailToolbar(RailType railtype, int button) { - BuildRailToolbarWindow *w; - if (!Company::IsValidID(_local_company)) return; if (!ValParamRailtype(railtype)) return; + BuildRailToolbarWindow *w = (BuildRailToolbarWindow *)FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL); + /* don't recreate the window if we're clicking on a button and the window exists. */ - if (button < 0 || !(w = dynamic_cast(FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL)))) { + if (button < 0 || w == NULL) { DeleteWindowByClass(WC_BUILD_TOOLBAR); _cur_railtype = railtype; w = AllocateWindowDescFront(&_build_rail_desc, TRANSPORT_RAIL); -- cgit v1.2.3-70-g09d2