@@ -319,3 +319,5 @@ AIIndustry.IsCargoAccepted <- function(i
AIAbstractList <- AIList;
AIList.ChangeItem <- AIList.SetValue;
AIRail.ERR_NONUNIFORM_STATIONS_DISABLED <- 0xFFFF;
@@ -70,3 +70,5 @@ AIIndustry.IsCargoAccepted <- function(i
@@ -33,6 +33,7 @@
* \li HasNext for all lists.
* \li AIAbstractList, use AIList instead.
* \li AIList::ChangeItem, use AIList::SetValue instead.
* \li AIRail::ERR_NONUNIFORM_STATIONS_DISABLED, that error is never returned anymore.
*
* Other changes:
* \li AIEngine::GetMaxTractiveEffort can be used for road vehicles.
@@ -35,9 +35,6 @@ public:
/** Track not suitable for signals */
ERR_UNSUITABLE_TRACK, // [STR_ERROR_NO_SUITABLE_RAILROAD_TRACK]
/** Non-uniform stations is diabled */
ERR_NONUNIFORM_STATIONS_DISABLED, // [STR_ERROR_NONUNIFORM_STATIONS_DISALLOWED]
/** This railtype cannot have crossings */
ERR_RAILTYPE_DISALLOWS_CROSSING, // [STR_ERROR_CROSSING_DISALLOWED]
};
@@ -41,7 +41,6 @@ void SQAIRail_Register(Squirrel *engine)
SQAIRail.DefSQConst(engine, AIRail::ERR_RAIL_BASE, "ERR_RAIL_BASE");
SQAIRail.DefSQConst(engine, AIRail::ERR_CROSSING_ON_ONEWAY_ROAD, "ERR_CROSSING_ON_ONEWAY_ROAD");
SQAIRail.DefSQConst(engine, AIRail::ERR_UNSUITABLE_TRACK, "ERR_UNSUITABLE_TRACK");
SQAIRail.DefSQConst(engine, AIRail::ERR_NONUNIFORM_STATIONS_DISABLED, "ERR_NONUNIFORM_STATIONS_DISABLED");
SQAIRail.DefSQConst(engine, AIRail::ERR_RAILTYPE_DISALLOWS_CROSSING, "ERR_RAILTYPE_DISALLOWS_CROSSING");
SQAIRail.DefSQConst(engine, AIRail::RAILTYPE_INVALID, "RAILTYPE_INVALID");
SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NE_SW, "RAILTRACK_NE_SW");
@@ -71,12 +70,10 @@ void SQAIRail_Register(Squirrel *engine)
AIError::RegisterErrorMap(STR_ERROR_CROSSING_ON_ONEWAY_ROAD, AIRail::ERR_CROSSING_ON_ONEWAY_ROAD);
AIError::RegisterErrorMap(STR_ERROR_NO_SUITABLE_RAILROAD_TRACK, AIRail::ERR_UNSUITABLE_TRACK);
AIError::RegisterErrorMap(STR_ERROR_NONUNIFORM_STATIONS_DISALLOWED, AIRail::ERR_NONUNIFORM_STATIONS_DISABLED);
AIError::RegisterErrorMap(STR_ERROR_CROSSING_DISALLOWED, AIRail::ERR_RAILTYPE_DISALLOWS_CROSSING);
AIError::RegisterErrorMapString(AIRail::ERR_CROSSING_ON_ONEWAY_ROAD, "ERR_CROSSING_ON_ONEWAY_ROAD");
AIError::RegisterErrorMapString(AIRail::ERR_UNSUITABLE_TRACK, "ERR_UNSUITABLE_TRACK");
AIError::RegisterErrorMapString(AIRail::ERR_NONUNIFORM_STATIONS_DISABLED, "ERR_NONUNIFORM_STATIONS_DISABLED");
AIError::RegisterErrorMapString(AIRail::ERR_RAILTYPE_DISALLOWS_CROSSING, "ERR_RAILTYPE_DISALLOWS_CROSSING");
SQAIRail.DefSQStaticMethod(engine, &AIRail::GetName, "GetName", 2, ".i");
@@ -1136,7 +1136,6 @@ STR_CONFIG_SETTING_AUTOSCROLL
STR_CONFIG_SETTING_BRIBE :{LTBLUE}Allow bribing of the local authority: {ORANGE}{STRING1}
STR_CONFIG_SETTING_ALLOW_EXCLUSIVE :{LTBLUE}Allow buying exclusive transport rights: {ORANGE}{STRING1}
STR_CONFIG_SETTING_ALLOW_GIVE_MONEY :{LTBLUE}Allow sending money to other companies: {ORANGE}{STRING1}
STR_CONFIG_SETTING_NONUNIFORM_STATIONS :{LTBLUE}Nonuniform stations: {ORANGE}{STRING1}
STR_CONFIG_SETTING_FREIGHT_TRAINS :{LTBLUE}Weight multiplier for freight to simulate heavy trains: {ORANGE}{STRING}
STR_CONFIG_SETTING_PLANE_SPEED :{LTBLUE}Plane speed factor: {ORANGE}1 / {STRING1}
STR_CONFIG_SETTING_PLANE_CRASHES :{LTBLUE}Number of plane crashes: {ORANGE}{STRING1}
@@ -3548,7 +3547,6 @@ STR_ERROR_CAN_T_BUILD_AIRPORT_HERE
STR_ERROR_ADJOINS_MORE_THAN_ONE_EXISTING :{WHITE}Adjoins more than one existing station/loading area
STR_ERROR_STATION_TOO_SPREAD_OUT :{WHITE}... station too spread out
STR_ERROR_NONUNIFORM_STATIONS_DISALLOWED :{WHITE}... nonuniform stations disabled
STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Too many stations/loading areas
STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Too many railway station parts
STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Too many bus stops
@@ -6965,7 +6965,7 @@ static void InitializeGRFSpecial()
| (1 << 0x0B) // newcargo
| (1 << 0x0C) // enhancemultiplayer
| (1 << 0x0D) // onewayroads
| ((_settings_game.station.nonuniform_stations ? 1 : 0) << 0x0E) // irregularstations
| (1 << 0x0E) // irregularstations
| (1 << 0x0F) // statistics
| (1 << 0x10) // newsounds
| (1 << 0x11) // autoreplace
@@ -1356,7 +1356,6 @@ static SettingsPage _settings_stations_c
static SettingEntry _settings_stations[] = {
SettingEntry(&_settings_stations_cargo_page, STR_CONFIG_SETTING_STATIONS_CARGOHANDLING),
SettingEntry("station.join_stations"),
SettingEntry("station.nonuniform_stations"),
SettingEntry("station.adjacent_stations"),
SettingEntry("station.distant_join_stations"),
SettingEntry("station.station_spread"),
@@ -388,7 +388,6 @@ struct EconomySettings {
struct StationSettings {
bool modified_catchment; ///< different-size catchment areas
bool join_stations; ///< allow joining of train stations
bool nonuniform_stations; ///< allow nonuniform train stations
bool adjacent_stations; ///< allow stations to be built directly adjacent to other stations
bool distant_join_stations; ///< allow to join non-adjacent stations
bool never_expire_airports; ///< never expire airports
@@ -933,46 +933,13 @@ CommandCost CanExpandRailStation(const B
{
TileArea cur_ta = st->train_station;
if (_settings_game.station.nonuniform_stations) {
/* determine new size of train station region.. */
int x = min(TileX(cur_ta.tile), TileX(new_ta.tile));
int y = min(TileY(cur_ta.tile), TileY(new_ta.tile));
new_ta.w = max(TileX(cur_ta.tile) + cur_ta.w, TileX(new_ta.tile) + new_ta.w) - x;
new_ta.h = max(TileY(cur_ta.tile) + cur_ta.h, TileY(new_ta.tile) + new_ta.h) - y;
new_ta.tile = TileXY(x, y);
} else {
/* do not allow modifying non-uniform stations,
* the uniform-stations code wouldn't handle it well */
TILE_AREA_LOOP(t, cur_ta) {
if (!st->TileBelongsToRailStation(t)) { // there may be adjoined station
return_cmd_error(STR_ERROR_NONUNIFORM_STATIONS_DISALLOWED);
}
/* check so the orientation is the same */
if (GetRailStationAxis(cur_ta.tile) != axis) {
/* check if the new station adjoins the old station in either direction */
if (cur_ta.w == new_ta.w && cur_ta.tile == new_ta.tile + TileDiffXY(0, new_ta.h)) {
/* above */
new_ta.h += cur_ta.h;
} else if (cur_ta.w == new_ta.w && cur_ta.tile == new_ta.tile - TileDiffXY(0, cur_ta.h)) {
/* below */
new_ta.tile = cur_ta.tile;
new_ta.h += new_ta.h;
} else if (cur_ta.h == new_ta.h && cur_ta.tile == new_ta.tile + TileDiffXY(new_ta.w, 0)) {
/* to the left */
new_ta.w += cur_ta.w;
} else if (cur_ta.h == new_ta.h && cur_ta.tile == new_ta.tile - TileDiffXY(cur_ta.w, 0)) {
/* to the right */
/* make sure the final size is not too big. */
if (new_ta.w > _settings_game.station.station_spread || new_ta.h > _settings_game.station.station_spread) {
return_cmd_error(STR_ERROR_STATION_TOO_SPREAD_OUT);
@@ -1165,7 +1132,7 @@ CommandCost CmdBuildRailStation(TileInde
StationID est = INVALID_STATION;
SmallVector<Train *, 4> affected_vehicles;
/* Clear the land below the station. */
CommandCost cost = CheckFlatLandRailStation(TileArea(tile_org, w_org, h_org), flags, 5 << axis, _settings_game.station.nonuniform_stations ? &est : NULL, rt, affected_vehicles);
CommandCost cost = CheckFlatLandRailStation(TileArea(tile_org, w_org, h_org), flags, 5 << axis, &est, rt, affected_vehicles);
if (cost.Failed()) return cost;
/* Add construction expenses. */
cost.AddCost((numtracks * _price[PR_BUILD_STATION_RAIL] + _price[PR_BUILD_STATION_RAIL_LENGTH]) * plat_len);
@@ -1408,11 +1375,6 @@ CommandCost RemoveFromRailBaseStation(Ti
if (ret.Failed()) continue;
/* Do not allow removing from stations if non-uniform stations are not enabled
* The check must be here to give correct error message
*/
if (!_settings_game.station.nonuniform_stations) return_cmd_error(STR_ERROR_NONUNIFORM_STATIONS_DISALLOWED);
/* If we reached here, the tile is valid so increase the quantity of tiles we will remove */
quantity++;
@@ -1572,7 +1534,7 @@ CommandCost RemoveRailStation(T *st, DoC
CommandCost cost(EXPENSES_CONSTRUCTION);
/* clear all areas of the station */
TILE_AREA_LOOP(tile, ta) {
/* for nonuniform stations, only remove tiles that are actually train station tiles */
/* only remove tiles that are actually train station tiles */
if (!st->TileBelongsToRailStation(tile)) continue;
CommandCost ret = EnsureNoVehicleOnGround(tile);
@@ -1624,8 +1586,8 @@ CommandCost RemoveRailStation(T *st, DoC
static CommandCost RemoveRailStation(TileIndex tile, DoCommandFlag flags)
/* if there is flooding and non-uniform stations are enabled, remove platforms tile by tile */
if (_current_company == OWNER_WATER && _settings_game.station.nonuniform_stations) {
/* if there is flooding, remove platforms tile by tile */
if (_current_company == OWNER_WATER) {
return DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_FROM_RAIL_STATION);
@@ -1645,8 +1607,8 @@ static CommandCost RemoveRailStation(Til
static CommandCost RemoveRailWaypoint(TileIndex tile, DoCommandFlag flags)
/* if there is flooding and non-uniform stations are enabled, remove waypoints tile by tile */
/* if there is flooding, remove waypoints tile by tile */
return DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_FROM_RAIL_WAYPOINT);
@@ -429,7 +429,7 @@ const SettingDesc _settings[] = {
SDT_BOOL(GameSettings, order.improved_load, 0,NN, true, STR_CONFIG_SETTING_IMPROVEDLOAD, NULL),
SDT_BOOL(GameSettings, order.selectgoods, 0, 0, true, STR_CONFIG_SETTING_SELECTGOODS, NULL),
SDTC_CONDBOOL( gui.sg_new_nonstop, 22, 92, 0, 0, false, STR_NULL, NULL),
SDT_BOOL(GameSettings, station.nonuniform_stations, 0,NN, true, STR_CONFIG_SETTING_NONUNIFORM_STATIONS, NULL),
SDT_CONDNULL( 1, 0, 158), // station.nonuniform_stations
SDT_VAR(GameSettings, station.station_spread, SLE_UINT8, 0, 0, 12, 4, 64, 0, STR_CONFIG_SETTING_STATION_SPREAD, InvalidateStationBuildWindow),
SDT_BOOL(GameSettings, order.serviceathelipad, 0, 0, true, STR_CONFIG_SETTING_SERVICEATHELIPAD, NULL),
SDT_BOOL(GameSettings, station.modified_catchment, 0, 0, true, STR_CONFIG_SETTING_CATCHMENT, StationCatchmentChanged),
@@ -902,19 +902,6 @@ static void FloodVehicles(TileIndex tile
return;
/* if non-uniform stations are disabled, flood some train in this train station (if there is any) */
if (!_settings_game.station.nonuniform_stations && IsTileType(tile, MP_STATION) && GetStationType(tile) == STATION_RAIL) {
const Station *st = Station::GetByTile(tile);
TILE_AREA_LOOP(t, st->train_station) {
if (st->TileBelongsToRailStation(t)) {
FindVehicleOnPos(tile, &z, &FloodVehicleProc);
if (!IsBridgeTile(tile)) {
@@ -190,7 +190,7 @@ CommandCost CmdBuildRailWaypoint(TileInd
TileIndexDiff offset = TileOffsByDiagDir(AxisToDiagDir(OtherAxis(axis)));
for (int i = 0; i < count; i++) {
TileIndex tile = start_tile + i * offset;
CommandCost ret = IsValidTileForWaypoint(tile, axis, _settings_game.station.nonuniform_stations ? &est : NULL);
CommandCost ret = IsValidTileForWaypoint(tile, axis, &est);
if (ret.Failed()) return ret;
Status change: