Add setting to increase station catchment radius.

Update acceptance and refresh screen when catchment settings change.
This commit is contained in:
Jonathan G Rennison
2016-11-20 01:49:10 +00:00
parent 10ae23d3b9
commit 37a58fd11d
18 changed files with 46 additions and 15 deletions

View File

@@ -67,7 +67,7 @@
{
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)

View File

@@ -159,14 +159,16 @@ template<bool Tfrom, bool Tvia>
if (station_type == STATION_AIRPORT) 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) {
case STATION_TRAIN: return CA_TRAIN;
case STATION_TRUCK_STOP: return CA_TRUCK;
case STATION_BUS_STOP: return CA_BUS;
case STATION_DOCK: return CA_DOCK;
default: return CA_NONE;
case STATION_TRAIN: return CA_TRAIN + inc;
case STATION_TRUCK_STOP: return CA_TRUCK + inc;
case STATION_BUS_STOP: return CA_BUS + inc;
case STATION_DOCK: return CA_DOCK + inc;
default: return CA_NONE + inc;
}
}

View File

@@ -208,7 +208,7 @@
{
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];
}
@@ -216,7 +216,7 @@
{
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];
}

View File

@@ -64,7 +64,7 @@ ScriptTileList_IndustryAccepting::ScriptTileList_IndustryAccepting(IndustryID in
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);
TILE_AREA_LOOP(cur_tile, ta) {
@@ -100,7 +100,7 @@ ScriptTileList_IndustryProducing::ScriptTileList_IndustryProducing(IndustryID in
}
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);
TILE_AREA_LOOP(cur_tile, ta) {