Add NewGRF feature: Extra station name strings

These are used when all the default names have been used up,
instead of "Town Station #NNN".
This commit is contained in:
Jonathan G Rennison
2021-07-17 20:54:10 +01:00
parent d23720cc60
commit 4174fe727c
13 changed files with 123 additions and 3 deletions

View File

@@ -2886,6 +2886,19 @@ static ChangeInfoResult GlobalVarChangeInfo(uint gvid, int numinfo, int prop, co
break;
}
case A0RPI_GLOBALVAR_EXTRA_STATION_NAMES: {
if (MappedPropertyLengthMismatch(buf, 4, mapping_entry)) break;
uint16 str = buf->ReadWord();
uint16 flags = buf->ReadWord();
if (_extra_station_names_used < MAX_EXTRA_STATION_NAMES) {
ExtraStationNameInfo &info = _extra_station_names[_extra_station_names_used];
AddStringForMapping(str, &info.str);
info.flags = flags;
_extra_station_names_used++;
}
break;
}
default:
ret = HandleAction0PropertyDefault(buf, prop);
break;
@@ -2954,6 +2967,10 @@ static ChangeInfoResult GlobalVarReserveInfo(uint gvid, int numinfo, int prop, c
}
break;
case A0RPI_GLOBALVAR_EXTRA_STATION_NAMES:
buf->Skip(buf->ReadExtendedByte());
break;
default:
ret = HandleAction0PropertyDefault(buf, prop);
break;
@@ -8380,6 +8397,7 @@ static const GRFFeatureInfo _grf_feature_list[] = {
GRFFeatureInfo("action0_railtype_restricted_signals", 1),
GRFFeatureInfo("action0_railtype_disable_realistic_braking", 1),
GRFFeatureInfo("action0_roadtype_extra_flags", 1),
GRFFeatureInfo("action0_global_extra_station_names", 1),
GRFFeatureInfo(),
};
@@ -8501,6 +8519,7 @@ static const GRFPropertyMapDefinition _grf_action0_remappable_properties[] = {
GRFPropertyMapDefinition(GSF_RAILTYPES, A0RPI_RAILTYPE_DISABLE_REALISTIC_BRAKING, "railtype_disable_realistic_braking"),
GRFPropertyMapDefinition(GSF_ROADTYPES, A0RPI_ROADTYPE_EXTRA_FLAGS, "roadtype_extra_flags"),
GRFPropertyMapDefinition(GSF_TRAMTYPES, A0RPI_ROADTYPE_EXTRA_FLAGS, "roadtype_extra_flags"),
GRFPropertyMapDefinition(GSF_GLOBALVAR, A0RPI_GLOBALVAR_EXTRA_STATION_NAMES, "global_extra_station_names"),
GRFPropertyMapDefinition(),
};