diff options
author | glx <glx@openttd.org> | 2008-01-09 17:47:05 +0000 |
---|---|---|
committer | glx <glx@openttd.org> | 2008-01-09 17:47:05 +0000 |
commit | 8ee8d1b964f523df5e8264828bf17fb4f8c17dee (patch) | |
tree | 1d841ecd272ea4bb508f03002e59308992257cbf /src/road_cmd.cpp | |
parent | 55d8f7ed724b8916ec3c953aded671076ceaa3e2 (diff) | |
download | openttd-8ee8d1b964f523df5e8264828bf17fb4f8c17dee.tar.xz |
(svn r11795) -Fix [FS#1616]: take town rating into account when testing if a command can be executed.
Diffstat (limited to 'src/road_cmd.cpp')
-rw-r--r-- | src/road_cmd.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index b011345fe..9094884a3 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -199,9 +199,8 @@ CommandCost CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) c &= present; if (c == ROAD_NONE) return CMD_ERROR; + ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM); if (flags & DC_EXEC) { - ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM); - present ^= c; if (present == ROAD_NONE) { RoadTypes rts = GetRoadTypes(tile) & ComplementRoadTypes(RoadTypeToRoadTypes(rt)); @@ -234,11 +233,11 @@ CommandCost CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) * we can't draw the crossing without trambits ;) */ if (rt == ROADTYPE_ROAD && HasBit(GetRoadTypes(tile), ROADTYPE_TRAM) && ((flags & DC_EXEC) || !HasBit(p1, 6))) return CMD_ERROR; - if (flags & DC_EXEC) { - if (rt == ROADTYPE_ROAD) { - ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM); - } + if (rt == ROADTYPE_ROAD) { + ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM); + } + if (flags & DC_EXEC) { RoadTypes rts = GetRoadTypes(tile) & ComplementRoadTypes(RoadTypeToRoadTypes(rt)); if (rts == ROADTYPES_NONE) { MakeRailNormal(tile, GetTileOwner(tile), GetCrossingRailBits(tile), GetRailType(tile)); |