From 6371b75bcc0789d4895e5c157237cbeaf332a99a Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 18 Jan 2011 21:28:07 +0000 Subject: (svn r21841) -Feature: [NewGRF] Allow to define other railtypes that should be introduced if a particular rail type is introduced, e.g. to make sure slow rail is introduced when fast rail gets introduced --- src/toolbar_gui.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/toolbar_gui.cpp') diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index f5537a19c..a93568969 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -693,22 +693,21 @@ static CallBackFunction ToolbarZoomOutClick(Window *w) static CallBackFunction ToolbarBuildRailClick(Window *w) { - /* Use C++ spec to zero whole array. */ - bool used_railtype[RAILTYPE_END] = { false }; + RailTypes used_railtypes = RAILTYPES_NONE; /* Find the used railtypes. */ Engine *e; FOR_ALL_ENGINES_OF_TYPE(e, VEH_TRAIN) { if (!HasBit(e->info.climates, _settings_game.game_creation.landscape)) continue; - used_railtype[e->u.rail.railtype] = true; + used_railtypes |= GetRailTypeInfo(e->u.rail.railtype)->introduces_railtypes; } const Company *c = Company::Get(_local_company); DropDownList *list = new DropDownList(); for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) { /* If it's not used ever, don't show it to the user. */ - if (!used_railtype[rt]) continue; + if (!HasBit(used_railtypes, rt)) continue; const RailtypeInfo *rti = GetRailTypeInfo(rt); /* Skip rail type if it has no label */ -- cgit v1.2.3-54-g00ecf