1
0
Fork 0

Add: Settings for controlling depot spread.

# Conflicts:
#	src/saveload/saveload.h
pull/9577/head
J0anJosep 2024-07-17 00:23:40 +02:00
parent 11fc7f2710
commit 4a71111ceb
8 changed files with 50 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));
}
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();
}

View File

@ -17,4 +17,6 @@ static const DepotID INVALID_DEPOT = UINT16_MAX;
static const uint MAX_LENGTH_DEPOT_NAME_CHARS = 32; ///< The maximum length of a depot name in characters including '\0'
static const uint DEF_MAX_DEPOT_SPREAD = 12;
#endif /* DEPOT_TYPE_H */

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_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_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_NPC :Computer players
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_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_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
# Depot unbunching related errors

View File

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

View File

@ -388,6 +388,7 @@ enum SaveLoadVersion : uint16_t {
SLV_DEPOTID_IN_HANGAR_ORDERS, ///< 340 PR#10691 Go to hangar orders store the DepotID instead of StationID.
SLV_DEPOTID_BACKUP_ORDERS, ///< 341 PR#XXXXX Backup orders are indexed through DepotIDs.
SLV_ADD_MEMBERS_TO_DEPOT_STRUCT, ///< 342 PR#XXXXX Add some members to depot struct.
SLV_DEPOT_SPREAD, ///< 343 PR#XXXXX Add a setting for max depot spread.
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 *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.autoslope"));
limitations->Add(new SettingEntry("construction.extra_dynamite"));

View File

@ -570,6 +570,12 @@ struct StationSettings {
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 distant_join_depots; ///< allow to join non-adjacent depots
};
/** Default settings for vehicles. */
struct VehicleDefaultSettings {
bool servint_ispercent; ///< service intervals are in percents
@ -603,6 +609,7 @@ struct GameSettings {
EconomySettings economy; ///< settings to change the economy
LinkGraphSettings linkgraph; ///< settings for link graph calculations
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
};

View File

@ -145,6 +145,25 @@ str = STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS
strhelp = STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS_HELPTEXT
post_cb = [](auto) { CloseWindowById(WC_SELECT_STATION, 0); }
[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 = DEF_MAX_DEPOT_SPREAD
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]
var = vehicle.road_side
type = SLE_UINT8