Add setting to increase station catchment radius.
Update acceptance and refresh screen when catchment settings change.
This commit is contained in:
@@ -406,7 +406,7 @@ public:
|
|||||||
|
|
||||||
if (_selected_airport_index != -1) {
|
if (_selected_airport_index != -1) {
|
||||||
const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index);
|
const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index);
|
||||||
int rad = _settings_game.station.modified_catchment ? as->catchment : (uint)CA_UNMODIFIED;
|
int rad = (_settings_game.station.modified_catchment ? as->catchment : (uint)CA_UNMODIFIED) + _settings_game.station.catchment_increase;
|
||||||
|
|
||||||
/* only show the station (airport) noise, if the noise option is activated */
|
/* only show the station (airport) noise, if the noise option is activated */
|
||||||
if (_settings_game.economy.station_noise_level) {
|
if (_settings_game.economy.station_noise_level) {
|
||||||
@@ -457,7 +457,7 @@ public:
|
|||||||
this->SetWidgetDisabledState(WID_AP_LAYOUT_DECREASE, _selected_airport_layout == 0);
|
this->SetWidgetDisabledState(WID_AP_LAYOUT_DECREASE, _selected_airport_layout == 0);
|
||||||
this->SetWidgetDisabledState(WID_AP_LAYOUT_INCREASE, _selected_airport_layout + 1 >= as->num_table);
|
this->SetWidgetDisabledState(WID_AP_LAYOUT_INCREASE, _selected_airport_layout + 1 >= as->num_table);
|
||||||
|
|
||||||
int rad = _settings_game.station.modified_catchment ? as->catchment : (uint)CA_UNMODIFIED;
|
int rad = (_settings_game.station.modified_catchment ? as->catchment : (uint)CA_UNMODIFIED) + _settings_game.station.catchment_increase;
|
||||||
if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -415,6 +415,7 @@ public:
|
|||||||
virtual void OnPaint()
|
virtual void OnPaint()
|
||||||
{
|
{
|
||||||
int rad = (_settings_game.station.modified_catchment) ? CA_DOCK : CA_UNMODIFIED;
|
int rad = (_settings_game.station.modified_catchment) ? CA_DOCK : CA_UNMODIFIED;
|
||||||
|
rad += _settings_game.station.catchment_increase;
|
||||||
|
|
||||||
this->DrawWidgets();
|
this->DrawWidgets();
|
||||||
|
|
||||||
|
@@ -1177,6 +1177,8 @@ STR_CONFIG_SETTING_AUTOSLOPE :Allow landscapi
|
|||||||
STR_CONFIG_SETTING_AUTOSLOPE_HELPTEXT :Allow landscaping under buildings and tracks without removing them
|
STR_CONFIG_SETTING_AUTOSLOPE_HELPTEXT :Allow landscaping under buildings and tracks without removing them
|
||||||
STR_CONFIG_SETTING_CATCHMENT :Allow more realistically sized catchment areas: {STRING2}
|
STR_CONFIG_SETTING_CATCHMENT :Allow more realistically sized catchment areas: {STRING2}
|
||||||
STR_CONFIG_SETTING_CATCHMENT_HELPTEXT :Have differently sized catchment areas for different types of stations and airports
|
STR_CONFIG_SETTING_CATCHMENT_HELPTEXT :Have differently sized catchment areas for different types of stations and airports
|
||||||
|
STR_CONFIG_SETTING_CATCHMENT_INCREASE :Increase station catchment radius: {STRING2}
|
||||||
|
STR_CONFIG_SETTING_CATCHMENT_INCREASE_HELPTEXT :Increase radius of station catchment areas by this many tiles
|
||||||
STR_CONFIG_SETTING_EXTRADYNAMITE :Allow removal of more town-owned roads, bridges and tunnels: {STRING2}
|
STR_CONFIG_SETTING_EXTRADYNAMITE :Allow removal of more town-owned roads, bridges and tunnels: {STRING2}
|
||||||
STR_CONFIG_SETTING_EXTRADYNAMITE_HELPTEXT :Make it easier to remove town-owned infrastructure and buildings
|
STR_CONFIG_SETTING_EXTRADYNAMITE_HELPTEXT :Make it easier to remove town-owned infrastructure and buildings
|
||||||
STR_CONFIG_SETTING_TRAIN_LENGTH :Maximum length of trains: {STRING2}
|
STR_CONFIG_SETTING_TRAIN_LENGTH :Maximum length of trains: {STRING2}
|
||||||
|
@@ -1129,6 +1129,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int rad = (_settings_game.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
|
int rad = (_settings_game.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
|
||||||
|
rad += _settings_game.station.catchment_increase;
|
||||||
|
|
||||||
if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
||||||
|
|
||||||
|
@@ -984,6 +984,7 @@ struct BuildRoadStationWindow : public PickerWindowBase {
|
|||||||
this->DrawWidgets();
|
this->DrawWidgets();
|
||||||
|
|
||||||
int rad = _settings_game.station.modified_catchment ? ((this->window_class == WC_BUS_STATION) ? CA_BUS : CA_TRUCK) : CA_UNMODIFIED;
|
int rad = _settings_game.station.modified_catchment ? ((this->window_class == WC_BUS_STATION) ? CA_BUS : CA_TRUCK) : CA_UNMODIFIED;
|
||||||
|
rad += _settings_game.station.catchment_increase;
|
||||||
if (_settings_client.gui.station_show_coverage) {
|
if (_settings_client.gui.station_show_coverage) {
|
||||||
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -72,6 +72,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
|||||||
{ XSLFI_MORE_RAIL_TYPES, XSCF_NULL, 1, 1, "more_rail_types", NULL, NULL, NULL },
|
{ XSLFI_MORE_RAIL_TYPES, XSCF_NULL, 1, 1, "more_rail_types", NULL, NULL, NULL },
|
||||||
{ XSLFI_CARGO_TYPE_ORDERS, XSCF_NULL, 2, 2, "cargo_type_orders", NULL, NULL, "ORDX,VEOX" },
|
{ XSLFI_CARGO_TYPE_ORDERS, XSCF_NULL, 2, 2, "cargo_type_orders", NULL, NULL, "ORDX,VEOX" },
|
||||||
{ XSLFI_EXTENDED_GAMELOG, XSCF_NULL, 1, 1, "extended_gamelog", NULL, NULL, NULL },
|
{ XSLFI_EXTENDED_GAMELOG, XSCF_NULL, 1, 1, "extended_gamelog", NULL, NULL, NULL },
|
||||||
|
{ XSLFI_STATION_CATCHMENT_INC, XSCF_NULL, 1, 1, "station_catchment_inc", NULL, NULL, NULL },
|
||||||
{ XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker
|
{ XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -46,6 +46,7 @@ enum SlXvFeatureIndex {
|
|||||||
XSLFI_MORE_RAIL_TYPES, ///< Increased number of rail types
|
XSLFI_MORE_RAIL_TYPES, ///< Increased number of rail types
|
||||||
XSLFI_CARGO_TYPE_ORDERS, ///< Cargo-specific load/unload order flags
|
XSLFI_CARGO_TYPE_ORDERS, ///< Cargo-specific load/unload order flags
|
||||||
XSLFI_EXTENDED_GAMELOG, ///< Extended gamelog
|
XSLFI_EXTENDED_GAMELOG, ///< Extended gamelog
|
||||||
|
XSLFI_STATION_CATCHMENT_INC, ///< Station catchment radius increase
|
||||||
|
|
||||||
XSLFI_RIFF_HEADER_60_BIT, ///< Size field in RIFF chunk header is 60 bit
|
XSLFI_RIFF_HEADER_60_BIT, ///< Size field in RIFF chunk header is 60 bit
|
||||||
XSLFI_HEIGHT_8_BIT, ///< Map tile height is 8 bit instead of 4 bit, but savegame version may be before this became true in trunk
|
XSLFI_HEIGHT_8_BIT, ///< Map tile height is 8 bit instead of 4 bit, but savegame version may be before this became true in trunk
|
||||||
|
@@ -67,7 +67,7 @@
|
|||||||
{
|
{
|
||||||
if (!IsAirportInformationAvailable(type)) return -1;
|
if (!IsAirportInformationAvailable(type)) return -1;
|
||||||
|
|
||||||
return _settings_game.station.modified_catchment ? ::AirportSpec::Get(type)->catchment : (uint)CA_UNMODIFIED;
|
return (_settings_game.station.modified_catchment ? ::AirportSpec::Get(type)->catchment : (uint)CA_UNMODIFIED) + _settings_game.station.catchment_increase;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool ScriptAirport::BuildAirport(TileIndex tile, AirportType type, StationID station_id)
|
/* static */ bool ScriptAirport::BuildAirport(TileIndex tile, AirportType type, StationID station_id)
|
||||||
|
@@ -159,14 +159,16 @@ template<bool Tfrom, bool Tvia>
|
|||||||
if (station_type == STATION_AIRPORT) return -1;
|
if (station_type == STATION_AIRPORT) return -1;
|
||||||
if (!HasExactlyOneBit(station_type)) return -1;
|
if (!HasExactlyOneBit(station_type)) return -1;
|
||||||
|
|
||||||
if (!_settings_game.station.modified_catchment) return CA_UNMODIFIED;
|
const int32 inc = _settings_game.station.catchment_increase;
|
||||||
|
|
||||||
|
if (!_settings_game.station.modified_catchment) return CA_UNMODIFIED + inc;
|
||||||
|
|
||||||
switch (station_type) {
|
switch (station_type) {
|
||||||
case STATION_TRAIN: return CA_TRAIN;
|
case STATION_TRAIN: return CA_TRAIN + inc;
|
||||||
case STATION_TRUCK_STOP: return CA_TRUCK;
|
case STATION_TRUCK_STOP: return CA_TRUCK + inc;
|
||||||
case STATION_BUS_STOP: return CA_BUS;
|
case STATION_BUS_STOP: return CA_BUS + inc;
|
||||||
case STATION_DOCK: return CA_DOCK;
|
case STATION_DOCK: return CA_DOCK + inc;
|
||||||
default: return CA_NONE;
|
default: return CA_NONE + inc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -208,7 +208,7 @@
|
|||||||
{
|
{
|
||||||
if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius < 0 || !ScriptCargo::IsValidCargo(cargo_type)) return -1;
|
if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius < 0 || !ScriptCargo::IsValidCargo(cargo_type)) return -1;
|
||||||
|
|
||||||
CargoArray acceptance = ::GetAcceptanceAroundTiles(tile, width, height, _settings_game.station.modified_catchment ? radius : (int)CA_UNMODIFIED);
|
CargoArray acceptance = ::GetAcceptanceAroundTiles(tile, width, height, _settings_game.station.modified_catchment ? radius : (int)CA_UNMODIFIED + _settings_game.station.catchment_increase);
|
||||||
return acceptance[cargo_type];
|
return acceptance[cargo_type];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,7 +216,7 @@
|
|||||||
{
|
{
|
||||||
if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius < 0 || !ScriptCargo::IsValidCargo(cargo_type)) return -1;
|
if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius < 0 || !ScriptCargo::IsValidCargo(cargo_type)) return -1;
|
||||||
|
|
||||||
CargoArray produced = ::GetProductionAroundTiles(tile, width, height, _settings_game.station.modified_catchment ? radius : (int)CA_UNMODIFIED);
|
CargoArray produced = ::GetProductionAroundTiles(tile, width, height, _settings_game.station.modified_catchment ? radius : (int)CA_UNMODIFIED + _settings_game.station.catchment_increase);
|
||||||
return produced[cargo_type];
|
return produced[cargo_type];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -64,7 +64,7 @@ ScriptTileList_IndustryAccepting::ScriptTileList_IndustryAccepting(IndustryID in
|
|||||||
if (!cargo_accepts) return;
|
if (!cargo_accepts) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_settings_game.station.modified_catchment) radius = CA_UNMODIFIED;
|
if (!_settings_game.station.modified_catchment) radius = CA_UNMODIFIED + _settings_game.station.catchment_increase;
|
||||||
|
|
||||||
TileArea ta(i->location.tile - ::TileDiffXY(radius, radius), i->location.w + radius * 2, i->location.h + radius * 2);
|
TileArea ta(i->location.tile - ::TileDiffXY(radius, radius), i->location.w + radius * 2, i->location.h + radius * 2);
|
||||||
TILE_AREA_LOOP(cur_tile, ta) {
|
TILE_AREA_LOOP(cur_tile, ta) {
|
||||||
@@ -100,7 +100,7 @@ ScriptTileList_IndustryProducing::ScriptTileList_IndustryProducing(IndustryID in
|
|||||||
}
|
}
|
||||||
if (!cargo_produces) return;
|
if (!cargo_produces) return;
|
||||||
|
|
||||||
if (!_settings_game.station.modified_catchment) radius = CA_UNMODIFIED;
|
if (!_settings_game.station.modified_catchment) radius = CA_UNMODIFIED + _settings_game.station.catchment_increase;
|
||||||
|
|
||||||
TileArea ta(i->location.tile - ::TileDiffXY(radius, radius), i->location.w + radius * 2, i->location.h + radius * 2);
|
TileArea ta(i->location.tile - ::TileDiffXY(radius, radius), i->location.w + radius * 2, i->location.h + radius * 2);
|
||||||
TILE_AREA_LOOP(cur_tile, ta) {
|
TILE_AREA_LOOP(cur_tile, ta) {
|
||||||
|
@@ -1317,6 +1317,9 @@ static bool ChangeMaxHeightLevel(int32 p1)
|
|||||||
static bool StationCatchmentChanged(int32 p1)
|
static bool StationCatchmentChanged(int32 p1)
|
||||||
{
|
{
|
||||||
Station::RecomputeIndustriesNearForAll();
|
Station::RecomputeIndustriesNearForAll();
|
||||||
|
Station *st;
|
||||||
|
FOR_ALL_STATIONS(st) UpdateStationAcceptance(st, true);
|
||||||
|
MarkWholeScreenDirty();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1801,6 +1801,7 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
}
|
}
|
||||||
|
|
||||||
environment->Add(new SettingEntry("station.modified_catchment"));
|
environment->Add(new SettingEntry("station.modified_catchment"));
|
||||||
|
environment->Add(new SettingEntry("station.catchment_increase"));
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage *ai = main->Add(new SettingsPage(STR_CONFIG_SETTING_AI));
|
SettingsPage *ai = main->Add(new SettingsPage(STR_CONFIG_SETTING_AI));
|
||||||
|
@@ -578,6 +578,7 @@ struct StationSettings {
|
|||||||
bool distant_join_stations; ///< allow to join non-adjacent stations
|
bool distant_join_stations; ///< allow to join non-adjacent stations
|
||||||
bool never_expire_airports; ///< never expire airports
|
bool never_expire_airports; ///< never expire airports
|
||||||
byte station_spread; ///< amount a station may spread
|
byte station_spread; ///< amount a station may spread
|
||||||
|
byte catchment_increase; ///< amount by which station catchment is increased
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Default settings for vehicles. */
|
/** Default settings for vehicles. */
|
||||||
|
@@ -288,6 +288,8 @@ uint Station::GetCatchmentRadius() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ret != CA_NONE) ret += _settings_game.station.catchment_increase;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3866,6 +3866,7 @@ void FindStationsAroundTiles(const TileArea &location, StationList *stations)
|
|||||||
{
|
{
|
||||||
/* area to search = producer plus station catchment radius */
|
/* area to search = producer plus station catchment radius */
|
||||||
uint max_rad = (_settings_game.station.modified_catchment ? MAX_CATCHMENT : CA_UNMODIFIED);
|
uint max_rad = (_settings_game.station.modified_catchment ? MAX_CATCHMENT : CA_UNMODIFIED);
|
||||||
|
max_rad += _settings_game.station.catchment_increase;
|
||||||
|
|
||||||
uint x = TileX(location.tile);
|
uint x = TileX(location.tile);
|
||||||
uint y = TileY(location.tile);
|
uint y = TileY(location.tile);
|
||||||
|
@@ -1358,6 +1358,20 @@ strhelp = STR_CONFIG_SETTING_CATCHMENT_HELPTEXT
|
|||||||
proc = StationCatchmentChanged
|
proc = StationCatchmentChanged
|
||||||
cat = SC_EXPERT
|
cat = SC_EXPERT
|
||||||
|
|
||||||
|
[SDT_VAR]
|
||||||
|
base = GameSettings
|
||||||
|
var = station.catchment_increase
|
||||||
|
type = SLE_UINT8
|
||||||
|
def = 0
|
||||||
|
min = 0
|
||||||
|
max = 5
|
||||||
|
str = STR_CONFIG_SETTING_CATCHMENT_INCREASE
|
||||||
|
strhelp = STR_CONFIG_SETTING_CATCHMENT_INCREASE_HELPTEXT
|
||||||
|
strval = STR_JUST_COMMA
|
||||||
|
proc = StationCatchmentChanged
|
||||||
|
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_STATION_CATCHMENT_INC)
|
||||||
|
patxname = ""station_catchment_inc.station.catchment_increase""
|
||||||
|
|
||||||
[SDT_BOOL]
|
[SDT_BOOL]
|
||||||
base = GameSettings
|
base = GameSettings
|
||||||
var = order.gradual_loading
|
var = order.gradual_loading
|
||||||
|
@@ -60,7 +60,7 @@ void DrawZoningSprites(SpriteID image, SpriteID colour, const TileInfo *ti)
|
|||||||
*/
|
*/
|
||||||
bool IsAreaWithinAcceptanceZoneOfStation(TileArea area, Owner owner, StationFacility facility_mask)
|
bool IsAreaWithinAcceptanceZoneOfStation(TileArea area, Owner owner, StationFacility facility_mask)
|
||||||
{
|
{
|
||||||
int catchment = _settings_game.station.station_spread + (_settings_game.station.modified_catchment ? MAX_CATCHMENT : CA_UNMODIFIED);
|
int catchment = _settings_game.station.station_spread + (_settings_game.station.modified_catchment ? MAX_CATCHMENT : CA_UNMODIFIED) + _settings_game.station.catchment_increase;
|
||||||
|
|
||||||
StationFinder morestations(TileArea(TileXY(TileX(area.tile) - (catchment / 2), TileY(area.tile) - (catchment / 2)),
|
StationFinder morestations(TileArea(TileXY(TileX(area.tile) - (catchment / 2), TileY(area.tile) - (catchment / 2)),
|
||||||
TileX(area.tile) + area.w + catchment, TileY(area.tile) + area.h + catchment));
|
TileX(area.tile) + area.w + catchment, TileY(area.tile) + area.h + catchment));
|
||||||
@@ -90,7 +90,7 @@ bool IsAreaWithinAcceptanceZoneOfStation(TileArea area, Owner owner, StationFaci
|
|||||||
*/
|
*/
|
||||||
bool IsTileWithinAcceptanceZoneOfStation(TileIndex tile, Owner owner, StationFacility facility_mask, bool open_window_only)
|
bool IsTileWithinAcceptanceZoneOfStation(TileIndex tile, Owner owner, StationFacility facility_mask, bool open_window_only)
|
||||||
{
|
{
|
||||||
int catchment = _settings_game.station.station_spread + (_settings_game.station.modified_catchment ? MAX_CATCHMENT : CA_UNMODIFIED);
|
int catchment = _settings_game.station.station_spread + (_settings_game.station.modified_catchment ? MAX_CATCHMENT : CA_UNMODIFIED) + _settings_game.station.catchment_increase;
|
||||||
|
|
||||||
StationFinder morestations(TileArea(TileXY(TileX(tile) - (catchment / 2), TileY(tile) - (catchment / 2)),
|
StationFinder morestations(TileArea(TileXY(TileX(tile) - (catchment / 2), TileY(tile) - (catchment / 2)),
|
||||||
catchment, catchment));
|
catchment, catchment));
|
||||||
|
Reference in New Issue
Block a user