From a54416afbc444a0db8483ed6b552d250c8d2e2de Mon Sep 17 00:00:00 2001
From: Jonathan G Rennison Syntax example:
extra_station_names_probability 0 .. 255
+
+ Sets the probability that an extra station name is used even when the available default names have not been exhausted.
+
+ Some station names are always used first even when this is non-zero.
+
diff --git a/docs/newgrf-additions.html b/docs/newgrf-additions.html
index 346b2e0676..40a8ea78dd 100644
--- a/docs/newgrf-additions.html
+++ b/docs/newgrf-additions.html
@@ -315,6 +315,14 @@
This is indicated by the feature name: action0_global_extra_station_names, version 1
+This sets the probability of using an extra station name even when the available default names have not been exhausted.
+ The range is 0 - 255, where 0 is never (the default) and 255 is always.
+ Some station names are always used first even when this is non-zero.
+ The Action 0 ID field is ignored.
+ The property length is 1 bytes.
+
This is indicated by the feature name: action0_global_extra_station_names, version 2
This sets the map generation amount value for the lighthouse default object (0 is no generation, 255 is maximum).
The Action 0 ID field is ignored. The property length is 1 byte.
diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp
index cae3092da7..11b3d47288 100644
--- a/src/gfxinit.cpp
+++ b/src/gfxinit.cpp
@@ -231,6 +231,9 @@ static void LoadSpriteTables()
extern uint _extra_station_names_used;
_extra_station_names_used = 0;
+ extern uint8 _extra_station_names_probability;
+ _extra_station_names_probability = 0;
+
/*
* Load the base and extra NewGRF with OTTD required graphics as first NewGRF.
* However, we do not want it to show up in the list of used NewGRFs,
diff --git a/src/misc.cpp b/src/misc.cpp
index 69559daa45..a76cb2c469 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -97,6 +97,7 @@ void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settin
_game_load_tick_skip_counter = 0;
_game_load_time = 0;
_extra_station_names_used = 0;
+ _extra_station_names_probability = 0;
_extra_aspects = 0;
_loadgame_DBGL_data.clear();
if (reset_settings) MakeNewgameSettingsLive();
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index e91421c20f..891bbbbbd1 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -2919,6 +2919,12 @@ static ChangeInfoResult GlobalVarChangeInfo(uint gvid, int numinfo, int prop, co
break;
}
+ case A0RPI_GLOBALVAR_EXTRA_STATION_NAMES_PROBABILITY: {
+ if (MappedPropertyLengthMismatch(buf, 1, mapping_entry)) break;
+ _extra_station_names_probability = buf->ReadByte();
+ break;
+ }
+
case A0RPI_GLOBALVAR_LIGHTHOUSE_GENERATE_AMOUNT:
case A0RPI_GLOBALVAR_TRANSMITTER_GENERATE_AMOUNT: {
if (MappedPropertyLengthMismatch(buf, 1, mapping_entry)) break;
@@ -2997,6 +3003,7 @@ static ChangeInfoResult GlobalVarReserveInfo(uint gvid, int numinfo, int prop, c
break;
case A0RPI_GLOBALVAR_EXTRA_STATION_NAMES:
+ case A0RPI_GLOBALVAR_EXTRA_STATION_NAMES_PROBABILITY:
case A0RPI_GLOBALVAR_LIGHTHOUSE_GENERATE_AMOUNT:
case A0RPI_GLOBALVAR_TRANSMITTER_GENERATE_AMOUNT:
buf->Skip(buf->ReadExtendedByte());
diff --git a/src/newgrf_extension.cpp b/src/newgrf_extension.cpp
index 43ba27d9ee..c301506def 100644
--- a/src/newgrf_extension.cpp
+++ b/src/newgrf_extension.cpp
@@ -39,7 +39,7 @@ extern const GRFFeatureInfo _grf_feature_list[] = {
GRFFeatureInfo("action0_railtype_recolour", 1),
GRFFeatureInfo("action0_railtype_extra_aspects", 1),
GRFFeatureInfo("action0_roadtype_extra_flags", 1),
- GRFFeatureInfo("action0_global_extra_station_names", 1),
+ GRFFeatureInfo("action0_global_extra_station_names", 2),
GRFFeatureInfo("action0_global_default_object_generate_amount", 1),
GRFFeatureInfo("action0_signals_programmable_signals", 1),
GRFFeatureInfo("action0_signals_no_entry_signals", 1),
@@ -78,6 +78,7 @@ extern const GRFPropertyMapDefinition _grf_action0_remappable_properties[] = {
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(GSF_GLOBALVAR, A0RPI_GLOBALVAR_EXTRA_STATION_NAMES_PROBABILITY, "global_extra_station_names_probability"),
GRFPropertyMapDefinition(GSF_GLOBALVAR, A0RPI_GLOBALVAR_LIGHTHOUSE_GENERATE_AMOUNT, "global_lighthouse_generate_amount"),
GRFPropertyMapDefinition(GSF_GLOBALVAR, A0RPI_GLOBALVAR_TRANSMITTER_GENERATE_AMOUNT, "global_transmitter_generate_amount"),
GRFPropertyMapDefinition(GSF_SIGNALS, A0RPI_SIGNALS_ENABLE_PROGRAMMABLE_SIGNALS, "signals_enable_programmable_signals"),
diff --git a/src/newgrf_extension.h b/src/newgrf_extension.h
index 630da1aed8..d8c82d1c5a 100644
--- a/src/newgrf_extension.h
+++ b/src/newgrf_extension.h
@@ -27,6 +27,7 @@ enum Action0RemapPropertyIds {
A0RPI_RAILTYPE_EXTRA_ASPECTS,
A0RPI_ROADTYPE_EXTRA_FLAGS,
A0RPI_GLOBALVAR_EXTRA_STATION_NAMES,
+ A0RPI_GLOBALVAR_EXTRA_STATION_NAMES_PROBABILITY,
A0RPI_GLOBALVAR_LIGHTHOUSE_GENERATE_AMOUNT,
A0RPI_GLOBALVAR_TRANSMITTER_GENERATE_AMOUNT,
A0RPI_SIGNALS_ENABLE_PROGRAMMABLE_SIGNALS,
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 5d47752131..04730ccd9e 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -471,6 +471,7 @@ static void ShutdownGame()
_game_load_tick_skip_counter = 0;
_game_load_time = 0;
_extra_station_names_used = 0;
+ _extra_station_names_probability = 0;
_extra_aspects = 0;
_loadgame_DBGL_data.clear();
_loadgame_DBGC_data.clear();
diff --git a/src/station.cpp b/src/station.cpp
index 01d6c3ad4b..8c9d5c3054 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -40,6 +40,7 @@ INSTANTIATE_POOL_METHODS(Station)
std::array