1
0
Fork 0

Add: Settings for controlling depot spread.

pull/8480/head
J0anJosep 2023-08-25 16:41:55 +02:00
parent cec541ac2c
commit c6e69c03c9
7 changed files with 56 additions and 0 deletions

View File

@ -68,6 +68,9 @@ CommandCost Depot::BeforeAddTiles(TileArea ta)
ta.Add(TileAddXY(this->ta.tile, this->ta.w - 1, this->ta.h - 1)); ta.Add(TileAddXY(this->ta.tile, this->ta.w - 1, this->ta.h - 1));
} }
if ((ta.w > _settings_game.depot.depot_spread) || (ta.h > _settings_game.depot.depot_spread)) {
return_cmd_error(STR_ERROR_DEPOT_TOO_SPREAD_OUT);
}
return CommandCost(); return CommandCost();
} }

View File

@ -1615,6 +1615,11 @@ STR_CONFIG_SETTING_SE_FLAT_WORLD_HEIGHT :The height leve
STR_CONFIG_SETTING_EDGES_NOT_EMPTY :{WHITE}One or more tiles at the northern edge are not empty STR_CONFIG_SETTING_EDGES_NOT_EMPTY :{WHITE}One or more tiles at the northern edge are not empty
STR_CONFIG_SETTING_EDGES_NOT_WATER :{WHITE}One or more tiles at one of the edges is not water STR_CONFIG_SETTING_EDGES_NOT_WATER :{WHITE}One or more tiles at one of the edges is not water
STR_CONFIG_SETTING_DISTANT_JOIN_DEPOTS :Allow to join depot parts not directly adjacent: {STRING2}
STR_CONFIG_SETTING_DISTANT_JOIN_DEPOTS_HELPTEXT :Allow adding parts to a depot without directly touching the existing parts. Needs Ctrl+Click while placing the new parts
STR_CONFIG_SETTING_DEPOT_SPREAD :Maximum depot spread: {STRING2}
STR_CONFIG_SETTING_DEPOT_SPREAD_HELPTEXT :Maximum area the parts of a single depot may be spread out on.
STR_CONFIG_SETTING_STATION_SPREAD :Maximum station spread: {STRING2} STR_CONFIG_SETTING_STATION_SPREAD :Maximum station spread: {STRING2}
STR_CONFIG_SETTING_STATION_SPREAD_HELPTEXT :Maximum area the parts of a single station may be spread out on. Note that high values will slow the game STR_CONFIG_SETTING_STATION_SPREAD_HELPTEXT :Maximum area the parts of a single station may be spread out on. Note that high values will slow the game
@ -2137,6 +2142,7 @@ STR_CONFIG_SETTING_ENVIRONMENT_TREES :Trees
STR_CONFIG_SETTING_AI :Competitors STR_CONFIG_SETTING_AI :Competitors
STR_CONFIG_SETTING_AI_NPC :Computer players STR_CONFIG_SETTING_AI_NPC :Computer players
STR_CONFIG_SETTING_NETWORK :Network STR_CONFIG_SETTING_NETWORK :Network
STR_CONFIG_SETTING_DEPOTS :Depots
STR_CONFIG_SETTING_REVERSE_AT_SIGNALS :Automatic reversing at signals: {STRING2} STR_CONFIG_SETTING_REVERSE_AT_SIGNALS :Automatic reversing at signals: {STRING2}
STR_CONFIG_SETTING_REVERSE_AT_SIGNALS_HELPTEXT :Allow trains to reverse on a signal, if they waited there a long time STR_CONFIG_SETTING_REVERSE_AT_SIGNALS_HELPTEXT :Allow trains to reverse on a signal, if they waited there a long time
@ -5132,6 +5138,7 @@ STR_ERROR_REAR_ENGINE_FOLLOW_FRONT :{WHITE}The rear
STR_ERROR_UNABLE_TO_FIND_ROUTE_TO :{WHITE}Unable to find route to local depot STR_ERROR_UNABLE_TO_FIND_ROUTE_TO :{WHITE}Unable to find route to local depot
STR_ERROR_UNABLE_TO_FIND_LOCAL_DEPOT :{WHITE}Unable to find local depot STR_ERROR_UNABLE_TO_FIND_LOCAL_DEPOT :{WHITE}Unable to find local depot
STR_ERROR_DEPOT_TOO_SPREAD_OUT :{WHITE}... depot too spread out
STR_ERROR_DEPOT_WRONG_DEPOT_TYPE :Wrong depot type STR_ERROR_DEPOT_WRONG_DEPOT_TYPE :Wrong depot type
# Depot unbunching related errors # Depot unbunching related errors

View File

@ -808,6 +808,12 @@ bool AfterLoadGame()
_settings_game.linkgraph.recalc_time *= CalendarTime::SECONDS_PER_DAY; _settings_game.linkgraph.recalc_time *= CalendarTime::SECONDS_PER_DAY;
} }
if (IsSavegameVersionBefore(SLV_DEPOT_SPREAD)) {
_settings_game.depot.depot_spread = 1;
_settings_game.depot.adjacent_depots = true;
_settings_game.depot.distant_join_depots = true;
}
/* Load the sprites */ /* Load the sprites */
GfxLoadSprites(); GfxLoadSprites();
LoadStringWidthTable(); LoadStringWidthTable();

View File

@ -392,6 +392,7 @@ enum SaveLoadVersion : uint16_t {
SLV_ALIGN_WATER_BITS, ///< 315 PR#XXXXX Align some water bits in the map array. SLV_ALIGN_WATER_BITS, ///< 315 PR#XXXXX Align some water bits in the map array.
SLV_DEPOTS_ALIGN_RAIL_DEPOT_BITS, ///< 316 PR#XXXXX Align one bit for rail depots. SLV_DEPOTS_ALIGN_RAIL_DEPOT_BITS, ///< 316 PR#XXXXX Align one bit for rail depots.
SLV_ADD_MEMBERS_TO_DEPOT_STRUCT, ///< 317 PR#XXXXX Add some members to depot struct. SLV_ADD_MEMBERS_TO_DEPOT_STRUCT, ///< 317 PR#XXXXX Add some members to depot struct.
SLV_DEPOT_SPREAD, ///< 318 PR#XXXXX Add a setting for max depot spread.
SL_MAX_VERSION, ///< Highest possible saveload version SL_MAX_VERSION, ///< Highest possible saveload version
}; };

View File

@ -2145,6 +2145,12 @@ static SettingsContainer &GetSettingsTree()
SettingsPage *limitations = main->Add(new SettingsPage(STR_CONFIG_SETTING_LIMITATIONS)); SettingsPage *limitations = main->Add(new SettingsPage(STR_CONFIG_SETTING_LIMITATIONS));
{ {
SettingsPage *depots = limitations->Add(new SettingsPage(STR_CONFIG_SETTING_DEPOTS));
{
depots->Add(new SettingEntry("depot.depot_spread"));
depots->Add(new SettingEntry("depot.distant_join_depots"));
}
limitations->Add(new SettingEntry("construction.command_pause_level")); limitations->Add(new SettingEntry("construction.command_pause_level"));
limitations->Add(new SettingEntry("construction.autoslope")); limitations->Add(new SettingEntry("construction.autoslope"));
limitations->Add(new SettingEntry("construction.extra_dynamite")); limitations->Add(new SettingEntry("construction.extra_dynamite"));

View File

@ -570,6 +570,13 @@ struct StationSettings {
uint8_t station_spread; ///< amount a station may spread uint8_t station_spread; ///< amount a station may spread
}; };
/** Settings related to depots. */
struct DepotSettings {
uint8_t depot_spread; ///< amount a depot may spread
bool adjacent_depots; ///< allow depots to be built directly adjacent to other depots
bool distant_join_depots; ///< allow to join non-adjacent depots
};
/** Default settings for vehicles. */ /** Default settings for vehicles. */
struct VehicleDefaultSettings { struct VehicleDefaultSettings {
bool servint_ispercent; ///< service intervals are in percents bool servint_ispercent; ///< service intervals are in percents
@ -603,6 +610,7 @@ struct GameSettings {
EconomySettings economy; ///< settings to change the economy EconomySettings economy; ///< settings to change the economy
LinkGraphSettings linkgraph; ///< settings for link graph calculations LinkGraphSettings linkgraph; ///< settings for link graph calculations
StationSettings station; ///< settings related to station management StationSettings station; ///< settings related to station management
DepotSettings depot; ///< settings related to depot management
LocaleSettings locale; ///< settings related to used currency/unit system in the current game LocaleSettings locale; ///< settings related to used currency/unit system in the current game
}; };

View File

@ -145,6 +145,31 @@ str = STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS
strhelp = STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS_HELPTEXT strhelp = STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS_HELPTEXT
post_cb = [](auto) { CloseWindowById(WC_SELECT_STATION, 0); } post_cb = [](auto) { CloseWindowById(WC_SELECT_STATION, 0); }
[SDT_BOOL]
var = depot.adjacent_depots
from = SLV_DEPOT_SPREAD
def = true
cat = SC_EXPERT
[SDT_BOOL]
var = depot.distant_join_depots
from = SLV_DEPOT_SPREAD
def = true
str = STR_CONFIG_SETTING_DISTANT_JOIN_DEPOTS
strhelp = STR_CONFIG_SETTING_DISTANT_JOIN_DEPOTS_HELPTEXT
[SDT_VAR]
var = depot.depot_spread
type = SLE_UINT8
from = SLV_DEPOT_SPREAD
def = 1
min = 1
max = 64
str = STR_CONFIG_SETTING_DEPOT_SPREAD
strhelp = STR_CONFIG_SETTING_DEPOT_SPREAD_HELPTEXT
strval = STR_CONFIG_SETTING_TILE_LENGTH
cat = SC_BASIC
[SDT_OMANY] [SDT_OMANY]
var = vehicle.road_side var = vehicle.road_side
type = SLE_UINT8 type = SLE_UINT8