diff options
author | peter1138 <peter1138@openttd.org> | 2010-03-16 06:30:31 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2010-03-16 06:30:31 +0000 |
commit | 0dd811048454b374291d8ba13449cdcafff40ed0 (patch) | |
tree | 48d5fd943b808ab4f736f7f61cda9ef880339c8f /src/rail_cmd.cpp | |
parent | 43be04eb27854a3195a16a7e5918eccf2f1d15a4 (diff) | |
download | openttd-0dd811048454b374291d8ba13449cdcafff40ed0.tar.xz |
(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.
Diffstat (limited to 'src/rail_cmd.cpp')
-rw-r--r-- | src/rail_cmd.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index f0b79a070..7440f86ac 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -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)); |