Mercurial > hg > openttd
changeset 12087:6a834ab923fc draft
(svn r16496) -Codechange: remove one useless dynamic_cast<>
author | smatz <smatz@openttd.org> |
---|---|
date | Mon, 01 Jun 2009 13:34:13 +0000 |
parents | c271d53c9872 |
children | 7f4295a66bff |
files | src/rail_gui.cpp |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -851,13 +851,13 @@ */ 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);