(svn r27086) -Codechange: Simplify opening of windows by always returning a valid window pointer.

This commit is contained in:
alberth
2014-12-18 18:22:23 +00:00
parent 78896895cf
commit 107bf32953
2 changed files with 9 additions and 7 deletions

View File

@@ -702,8 +702,8 @@ void ShowNewGRFInspectWindow(GrfSpecFeature feature, uint index, const uint32 gr
if (!IsNewGRFInspectable(feature, index)) return;
WindowNumber wno = GetInspectWindowNumber(feature, index);
NewGRFInspectWindow *w = AllocateWindowDescFront<NewGRFInspectWindow>(feature == GSF_TRAINS || feature == GSF_ROADVEHICLES ? &_newgrf_inspect_chain_desc : &_newgrf_inspect_desc, wno);
if (w == NULL) w = (NewGRFInspectWindow *)FindWindowById(WC_NEWGRF_INSPECT, wno);
WindowDesc *desc = (feature == GSF_TRAINS || feature == GSF_ROADVEHICLES) ? &_newgrf_inspect_chain_desc : &_newgrf_inspect_desc;
NewGRFInspectWindow *w = AllocateWindowDescFront<NewGRFInspectWindow>(desc, wno, true);
w->SetCallerGRFID(grfid);
}