|
@@ -415,7 +415,7 @@ static CommandCost CheckRailSlope(Slope
|
|
|
}
|
|
|
|
|
|
Foundation f_old = GetRailFoundation(tileh, existing);
|
|
|
return CommandCost(EXPENSES_CONSTRUCTION, f_new != f_old ? _price[PR_BUILD_FOUNDATION] : (Money)0);
|
|
|
return CommandCost(EXPENSES_T_TRAIN_CON, f_new != f_old ? _price[PR_BUILD_FOUNDATION] : (Money)0);
|
|
|
}
|
|
|
|
|
|
/* Validate functions for rail building */
|
|
@@ -435,7 +435,7 @@ static inline bool ValParamTrackOrientat
|
|
|
*/
|
|
|
CommandCost CmdBuildSingleRail(DoCommandFlag flags, TileIndex tile, RailType railtype, Track track, bool auto_remove_signals)
|
|
|
{
|
|
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
|
|
CommandCost cost(EXPENSES_T_TRAIN_CON);
|
|
|
|
|
|
if (!ValParamRailtype(railtype) || !ValParamTrackOrientation(track)) return CMD_ERROR;
|
|
|
|
|
@@ -618,7 +618,7 @@ CommandCost CmdBuildSingleRail(DoCommand
|
|
|
*/
|
|
|
CommandCost CmdRemoveSingleRail(DoCommandFlag flags, TileIndex tile, Track track)
|
|
|
{
|
|
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
|
|
CommandCost cost(EXPENSES_T_TRAIN_CON);
|
|
|
bool crossing = false;
|
|
|
|
|
|
if (!ValParamTrackOrientation(track)) return CMD_ERROR;
|
|
@@ -877,7 +877,7 @@ static CommandCost ValidateAutoDrag(Trac
|
|
|
*/
|
|
|
static CommandCost CmdRailTrackHelper(DoCommandFlag flags, TileIndex tile, TileIndex end_tile, RailType railtype, Track track, bool remove, bool auto_remove_signals, bool fail_on_obstacle)
|
|
|
{
|
|
|
CommandCost total_cost(EXPENSES_CONSTRUCTION);
|
|
|
CommandCost total_cost(EXPENSES_T_TRAIN_CON);
|
|
|
|
|
|
if ((!remove && !ValParamRailtype(railtype)) || !ValParamTrackOrientation(track)) return CMD_ERROR;
|
|
|
if (end_tile >= MapSize()) return CMD_ERROR;
|
|
@@ -1061,17 +1061,17 @@ CommandCost CmdBuildSingleSignal(DoComma
|
|
|
CommandCost cost;
|
|
|
if (!HasSignalOnTrack(tile, track)) {
|
|
|
/* build new signals */
|
|
|
cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_SIGNALS]);
|
|
|
cost = CommandCost(EXPENSES_T_TRAIN_CON, _price[PR_BUILD_SIGNALS]);
|
|
|
} else {
|
|
|
if (signals_copy != 0 && sigvar != GetSignalVariant(tile, track)) {
|
|
|
/* convert signals <-> semaphores */
|
|
|
cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_SIGNALS] + _price[PR_CLEAR_SIGNALS]);
|
|
|
cost = CommandCost(EXPENSES_T_TRAIN_CON, _price[PR_BUILD_SIGNALS] + _price[PR_CLEAR_SIGNALS]);
|
|
|
|
|
|
} else if (convert_signal) {
|
|
|
/* convert button pressed */
|
|
|
if (ctrl_pressed || GetSignalVariant(tile, track) != sigvar) {
|
|
|
/* convert electric <-> semaphore */
|
|
|
cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_SIGNALS] + _price[PR_CLEAR_SIGNALS]);
|
|
|
cost = CommandCost(EXPENSES_T_TRAIN_CON, _price[PR_BUILD_SIGNALS] + _price[PR_CLEAR_SIGNALS]);
|
|
|
} else {
|
|
|
/* it is free to change signal type: normal-pre-exit-combo */
|
|
|
cost = CommandCost();
|
|
@@ -1239,7 +1239,7 @@ static bool AdvanceSignalAutoFill(TileIn
|
|
|
*/
|
|
|
static CommandCost CmdSignalTrackHelper(DoCommandFlag flags, TileIndex tile, TileIndex end_tile, Track track, SignalType sigtype, SignalVariant sigvar, bool mode, bool remove, bool autofill, bool minimise_gaps, int signal_density)
|
|
|
{
|
|
|
CommandCost total_cost(EXPENSES_CONSTRUCTION);
|
|
|
CommandCost total_cost(EXPENSES_T_TRAIN_CON);
|
|
|
|
|
|
if (end_tile >= MapSize() || !ValParamTrackOrientation(track)) return CMD_ERROR;
|
|
|
if (signal_density == 0 || signal_density > 20) return CMD_ERROR;
|
|
@@ -1492,7 +1492,7 @@ CommandCost CmdRemoveSingleSignal(DoComm
|
|
|
MarkTileDirtyByTile(tile);
|
|
|
}
|
|
|
|
|
|
return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_SIGNALS]);
|
|
|
return CommandCost(EXPENSES_T_TRAIN_CON, _price[PR_CLEAR_SIGNALS]);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1541,7 +1541,7 @@ CommandCost CmdConvertRail(DoCommandFlag
|
|
|
|
|
|
TrainList affected_trains;
|
|
|
|
|
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
|
|
CommandCost cost(EXPENSES_T_TRAIN_CON);
|
|
|
CommandCost error = CommandCost(STR_ERROR_NO_SUITABLE_RAILROAD_TRACK); // by default, there is no track to convert.
|
|
|
bool found_convertible_track = false; // whether we actually did convert some track (see bug #7633)
|
|
|
|
|
@@ -1777,12 +1777,12 @@ static CommandCost RemoveTrainDepot(Tile
|
|
|
if (v != nullptr) TryPathReserve(v, true);
|
|
|
}
|
|
|
|
|
|
return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_DEPOT_TRAIN]);
|
|
|
return CommandCost(EXPENSES_T_TRAIN_CON, _price[PR_CLEAR_DEPOT_TRAIN]);
|
|
|
}
|
|
|
|
|
|
static CommandCost ClearTile_Track(TileIndex tile, DoCommandFlag flags)
|
|
|
{
|
|
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
|
|
CommandCost cost(EXPENSES_T_DEMOLITION);
|
|
|
|
|
|
if (flags & DC_AUTO) {
|
|
|
if (!IsTileOwner(tile, _current_company)) {
|
|
@@ -2997,7 +2997,7 @@ static CommandCost TestAutoslopeOnRailTi
|
|
|
/* Surface slope must not be changed */
|
|
|
default:
|
|
|
if (z_old != z_new || tileh_old != tileh_new) return_cmd_error(STR_ERROR_MUST_REMOVE_RAILROAD_TRACK);
|
|
|
return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
|
|
|
return CommandCost(EXPENSES_T_TRAIN_CON, _price[PR_BUILD_FOUNDATION]);
|
|
|
}
|
|
|
|
|
|
/* The height of the track_corner must not be changed. The rest ensures GetRailFoundation() already. */
|
|
@@ -3005,7 +3005,7 @@ static CommandCost TestAutoslopeOnRailTi
|
|
|
z_new += GetSlopeZInCorner(RemoveHalftileSlope(tileh_new), track_corner);
|
|
|
if (z_old != z_new) return_cmd_error(STR_ERROR_MUST_REMOVE_RAILROAD_TRACK);
|
|
|
|
|
|
CommandCost cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
|
|
|
CommandCost cost = CommandCost(EXPENSES_T_TRAIN_CON, _price[PR_BUILD_FOUNDATION]);
|
|
|
/* Make the ground dirty, if surface slope has changed */
|
|
|
if (tileh_old != tileh_new) {
|
|
|
/* If there is flat water on the lower halftile add the cost for clearing it */
|
|
@@ -3063,10 +3063,10 @@ static CommandCost TerraformTile_Track(T
|
|
|
if ((flags & DC_EXEC) != 0) SetRailGroundType(tile, RAIL_GROUND_BARREN);
|
|
|
|
|
|
/* allow terraforming */
|
|
|
return CommandCost(EXPENSES_CONSTRUCTION, was_water ? _price[PR_CLEAR_WATER] : (Money)0);
|
|
|
return CommandCost(EXPENSES_T_TRAIN_CON, was_water ? _price[PR_CLEAR_WATER] : (Money)0);
|
|
|
} else if (_settings_game.construction.build_on_slopes && AutoslopeEnabled() &&
|
|
|
AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, GetRailDepotDirection(tile))) {
|
|
|
return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
|
|
|
return CommandCost(EXPENSES_T_TRAIN_CON, _price[PR_BUILD_FOUNDATION]);
|
|
|
}
|
|
|
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
|
|
}
|