mirror of https://github.com/OpenTTD/OpenTTD
Add: Apply rail/road type conversion when NewGRFs are updated mid-game.
This will update the rail/road type of tiles on the map, taking account of tram state, if types are moved around.pull/12879/head
parent
8bb6572943
commit
3b6d3080f2
|
@ -3362,6 +3362,7 @@ void ReloadNewGRFData()
|
||||||
RecomputePrices();
|
RecomputePrices();
|
||||||
/* reload vehicles */
|
/* reload vehicles */
|
||||||
ResetVehicleHash();
|
ResetVehicleHash();
|
||||||
|
AfterLoadLabelMaps();
|
||||||
AfterLoadVehiclesPhase1(false);
|
AfterLoadVehiclesPhase1(false);
|
||||||
AfterLoadVehiclesPhase2(false);
|
AfterLoadVehiclesPhase2(false);
|
||||||
StartupEngines();
|
StartupEngines();
|
||||||
|
|
|
@ -130,11 +130,27 @@ static void ConvertRoadTypes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Populate label lists with current values. */
|
||||||
|
static void SetCurrentLabelLists()
|
||||||
|
{
|
||||||
|
_railtype_list.clear();
|
||||||
|
for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
|
||||||
|
_railtype_list.push_back({GetRailTypeInfo(rt)->label, 0});
|
||||||
|
}
|
||||||
|
|
||||||
|
_roadtype_list.clear();
|
||||||
|
for (RoadType rt = ROADTYPE_BEGIN; rt != ROADTYPE_END; rt++) {
|
||||||
|
_roadtype_list.push_back({GetRoadTypeInfo(rt)->label, GetRoadTramType(rt)});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Perform rail type and road type conversion if necessary. */
|
/** Perform rail type and road type conversion if necessary. */
|
||||||
void AfterLoadLabelMaps()
|
void AfterLoadLabelMaps()
|
||||||
{
|
{
|
||||||
ConvertRailTypes();
|
ConvertRailTypes();
|
||||||
ConvertRoadTypes();
|
ConvertRoadTypes();
|
||||||
|
|
||||||
|
SetCurrentLabelLists();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetLabelMaps()
|
void ResetLabelMaps()
|
||||||
|
|
Loading…
Reference in New Issue