1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-28 08:59:09 +00:00

(svn r19433) -Codechange: Limit rail clearance earnings to 3/4s of rail build cost, to avoid money making loophole when rail build cost is less than rail removal earnings.

This commit is contained in:
2010-03-16 06:30:31 +00:00
parent 43be04eb27
commit 0dd8110484
2 changed files with 22 additions and 2 deletions

View File

@@ -503,7 +503,7 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u
CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Track track = (Track)p2;
CommandCost cost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_RAIL] );
CommandCost cost(EXPENSES_CONSTRUCTION);
bool crossing = false;
if (!ValParamTrackOrientation((Track)p2)) return CMD_ERROR;
@@ -533,6 +533,8 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1,
if (ret.Failed()) return ret;
}
cost.AddCost(RailClearCost(GetRailType(tile)));
if (flags & DC_EXEC) {
if (HasReservedTracks(tile, trackbit)) {
v = GetTrainForReservation(tile, track);
@@ -563,6 +565,8 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1,
if ((present & trackbit) == 0) return CMD_ERROR;
if (present == (TRACK_BIT_X | TRACK_BIT_Y)) crossing = true;
cost.AddCost(RailClearCost(GetRailType(tile)));
/* Charge extra to remove signals on the track, if they are there */
if (HasSignalOnTrack(tile, track))
cost.AddCost(DoCommand(tile, track, 0, flags, CMD_REMOVE_SIGNALS));