summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-06-01 13:34:13 +0000
committersmatz <smatz@openttd.org>2009-06-01 13:34:13 +0000
commit1a506f5912b174f50e206b6489f5687d86ea23c6 (patch)
treeef928572e5ee528cb3b40f077008af22ff53f999 /src
parent333795bc70e6c6071acfda462970773011391008 (diff)
downloadopenttd-1a506f5912b174f50e206b6489f5687d86ea23c6.tar.xz
(svn r16496) -Codechange: remove one useless dynamic_cast<>
Diffstat (limited to 'src')
-rw-r--r--src/rail_gui.cpp6
1 files 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<BuildRailToolbarWindow*>(FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL)))) {
+ if (button < 0 || w == NULL) {
DeleteWindowByClass(WC_BUILD_TOOLBAR);
_cur_railtype = railtype;
w = AllocateWindowDescFront<BuildRailToolbarWindow>(&_build_rail_desc, TRANSPORT_RAIL);