mirror of https://github.com/OpenTTD/OpenTTD
Add: Add settings for building new types of depots.
parent
408732d25b
commit
2ddb3bf2d7
|
@ -1622,6 +1622,19 @@ STR_CONFIG_SETTING_DISTANT_JOIN_DEPOTS :Allow to join d
|
|||
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_RAIL_DEPOT_TYPES :Rail depot types: {STRING2}
|
||||
STR_CONFIG_SETTING_RAIL_DEPOT_TYPES_HELPTEXT :Available rail depot types for construction for human players.
|
||||
STR_CONFIG_SETTING_ROAD_DEPOT_TYPES :Road depot types: {STRING2}
|
||||
STR_CONFIG_SETTING_ROAD_DEPOT_TYPES_HELPTEXT :Available road depot types for construction for human players.
|
||||
STR_CONFIG_SETTING_WATER_DEPOT_TYPES :Water depot types: {STRING2}
|
||||
STR_CONFIG_SETTING_WATER_DEPOT_TYPES_HELPTEXT :Available water depot types for construction for human players.
|
||||
###length 3
|
||||
STR_CONFIG_SETTING_ONLY_STANDARD_DEPOT :Standard depots
|
||||
STR_CONFIG_SETTING_ONLY_EXTENDED_DEPOT :Extended depots
|
||||
STR_CONFIG_SETTING_BOTH_DEPOT_TYPES :Both depot types
|
||||
###next-name-looks-similar
|
||||
|
||||
STR_CONFIG_SETTING_REPLACE_INCOMPATIBLE_RAIL :Allow replacing rail vehicles with incompatible rail types: {STRING2}
|
||||
STR_CONFIG_SETTING_REPLACE_INCOMPATIBLE_RAIL_HELPTEXT :Allow replacing rail vehicles even if they are not compatible by rail type.
|
||||
STR_CONFIG_SETTING_REPLACE_INCOMPATIBLE_ROAD :Allow replacing road vehicles with incompatible road types: {STRING2}
|
||||
|
@ -5134,6 +5147,8 @@ STR_ERROR_CAN_T_BUILD_TRAM_DEPOT :{WHITE}Can't bu
|
|||
STR_ERROR_CAN_T_BUILD_SHIP_DEPOT :{WHITE}Can't build ship depot here...
|
||||
|
||||
STR_ERROR_ADJOINS_MORE_THAN_ONE_EXISTING_DEPOT :{WHITE}... adjoins more than one existing depot
|
||||
STR_ERROR_DEPOT_TYPE_NOT_AVAILABLE :{WHITE}... depot type not available
|
||||
|
||||
STR_ERROR_CAN_T_RENAME_DEPOT :{WHITE}Can't rename depot...
|
||||
|
||||
STR_ERROR_TRAIN_MUST_BE_STOPPED_INSIDE_DEPOT :{WHITE}... must be stopped inside a depot
|
||||
|
|
|
@ -821,6 +821,13 @@ bool AfterLoadGame()
|
|||
_settings_game.depot.allow_no_comp_roadtype_replacements = false;
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(SLV_EXTENDED_DEPOTS)) {
|
||||
/* Set standard depots as the only available depots. */
|
||||
_settings_game.depot.rail_depot_types = 1;
|
||||
_settings_game.depot.road_depot_types = 1;
|
||||
_settings_game.depot.water_depot_types = 1;
|
||||
}
|
||||
|
||||
/* Load the sprites */
|
||||
GfxLoadSprites();
|
||||
LoadStringWidthTable();
|
||||
|
|
|
@ -397,6 +397,8 @@ enum SaveLoadVersion : uint16_t {
|
|||
|
||||
SLV_KEEP_REMOVED_DEPOTS, ///< 320 PR#XXXXX Keep remove depots for a while.
|
||||
|
||||
SLV_EXTENDED_DEPOTS, ///< 321 PR#8480 Extended depots for rail, road and water transport.
|
||||
|
||||
SL_MAX_VERSION, ///< Highest possible saveload version
|
||||
};
|
||||
|
||||
|
|
|
@ -2150,6 +2150,10 @@ static SettingsContainer &GetSettingsTree()
|
|||
depots->Add(new SettingEntry("depot.depot_spread"));
|
||||
depots->Add(new SettingEntry("depot.distant_join_depots"));
|
||||
|
||||
depots->Add(new SettingEntry("depot.rail_depot_types"));
|
||||
depots->Add(new SettingEntry("depot.road_depot_types"));
|
||||
depots->Add(new SettingEntry("depot.water_depot_types"));
|
||||
|
||||
depots->Add(new SettingEntry("depot.allow_no_comp_railtype_replacements"));
|
||||
depots->Add(new SettingEntry("depot.allow_no_comp_roadtype_replacements"));
|
||||
}
|
||||
|
|
|
@ -396,6 +396,11 @@ static void InvalidateReplacementWindows(int32_t)
|
|||
InvalidateWindowClassesData(WC_REPLACE_VEHICLE);
|
||||
}
|
||||
|
||||
static void DepotSettingsChanged(int32_t)
|
||||
{
|
||||
CloseWindowByClass(WC_BUILD_TOOLBAR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update any possible saveload window and delete any newgrf dialogue as
|
||||
* its widget parts might change. Reinit all windows as it allows access to the
|
||||
|
|
|
@ -570,12 +570,22 @@ struct StationSettings {
|
|||
uint8_t station_spread; ///< amount a station may spread
|
||||
};
|
||||
|
||||
enum DepotTypes : uint8_t {
|
||||
ONLY_STANDARD_DEPOT_TYPE = 1,
|
||||
ONLY_EXTENDED_DEPOT_TYPE = 2,
|
||||
BOTH_DEPOT_TYPES = 3,
|
||||
};
|
||||
|
||||
/** 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
|
||||
|
||||
uint8_t rail_depot_types; ///< allowed rail depot types for contruction
|
||||
uint8_t road_depot_types; ///< allowed road depot types for contruction
|
||||
uint8_t water_depot_types; ///< allowed water depot types for contruction
|
||||
|
||||
bool allow_no_comp_railtype_replacements; ///< allow replacing rail vehicles even if rail type is not compatible
|
||||
bool allow_no_comp_roadtype_replacements; ///< allow replacing road vehicles even if road type is not compatible
|
||||
};
|
||||
|
|
|
@ -23,6 +23,7 @@ static void StationCatchmentChanged(int32_t new_value);
|
|||
static void MaxVehiclesChanged(int32_t new_value);
|
||||
static bool CheckDifferentRailRoadTypesReplacements(int32_t &new_value);
|
||||
static void InvalidateReplacementWindows(int32_t new_value);
|
||||
static void DepotSettingsChanged(int32_t new_value);
|
||||
|
||||
static const SettingVariant _game_settings_table[] = {
|
||||
[post-amble]
|
||||
|
@ -147,6 +148,51 @@ str = STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS
|
|||
strhelp = STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS_HELPTEXT
|
||||
post_cb = [](auto) { CloseWindowById(WC_SELECT_STATION, 0); }
|
||||
|
||||
[SDT_VAR]
|
||||
var = depot.rail_depot_types
|
||||
type = SLE_UINT8
|
||||
from = SLV_EXTENDED_DEPOTS
|
||||
flags = SF_GUI_DROPDOWN
|
||||
def = 1
|
||||
min = 1
|
||||
max = 3
|
||||
interval = 1
|
||||
str = STR_CONFIG_SETTING_RAIL_DEPOT_TYPES
|
||||
strhelp = STR_CONFIG_SETTING_RAIL_DEPOT_TYPES_HELPTEXT
|
||||
strval = STR_CONFIG_SETTING_ONLY_STANDARD_DEPOT
|
||||
post_cb = DepotSettingsChanged
|
||||
cat = SC_EXPERT
|
||||
|
||||
[SDT_VAR]
|
||||
var = depot.road_depot_types
|
||||
type = SLE_UINT8
|
||||
from = SLV_EXTENDED_DEPOTS
|
||||
flags = SF_GUI_DROPDOWN
|
||||
def = 1
|
||||
min = 1
|
||||
max = 3
|
||||
interval = 1
|
||||
str = STR_CONFIG_SETTING_ROAD_DEPOT_TYPES
|
||||
strhelp = STR_CONFIG_SETTING_ROAD_DEPOT_TYPES_HELPTEXT
|
||||
strval = STR_CONFIG_SETTING_ONLY_STANDARD_DEPOT
|
||||
post_cb = DepotSettingsChanged
|
||||
cat = SC_EXPERT
|
||||
|
||||
[SDT_VAR]
|
||||
var = depot.water_depot_types
|
||||
type = SLE_UINT8
|
||||
from = SLV_EXTENDED_DEPOTS
|
||||
flags = SF_GUI_DROPDOWN
|
||||
def = 1
|
||||
min = 1
|
||||
max = 3
|
||||
interval = 1
|
||||
str = STR_CONFIG_SETTING_WATER_DEPOT_TYPES
|
||||
strhelp = STR_CONFIG_SETTING_WATER_DEPOT_TYPES_HELPTEXT
|
||||
strval = STR_CONFIG_SETTING_ONLY_STANDARD_DEPOT
|
||||
post_cb = DepotSettingsChanged
|
||||
cat = SC_EXPERT
|
||||
|
||||
[SDT_BOOL]
|
||||
var = depot.adjacent_depots
|
||||
from = SLV_DEPOT_SPREAD
|
||||
|
|
Loading…
Reference in New Issue