summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-04-29 16:36:44 +0000
committersmatz <smatz@openttd.org>2008-04-29 16:36:44 +0000
commit0ddb481a3361caaf5bcfbeb9c42d93ad3cc57f03 (patch)
tree390fab670ebe2cf3066235d572e6dd59e84c77a4 /src
parent49ded3f2c3d1a60e44f7c576a171f4354c8080bc (diff)
downloadopenttd-0ddb481a3361caaf5bcfbeb9c42d93ad3cc57f03.tar.xz
(svn r12919) -Fix [FS#1965]: flood road tiles even when there are road works in progress
Diffstat (limited to 'src')
-rw-r--r--src/road_cmd.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 7c610bcd6..0ff958e86 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -233,7 +233,7 @@ static CommandCost RemoveRoad(TileIndex tile, uint32 flags, RoadBits pieces, Roa
const RoadBits other = GetOtherRoadBits(tile, rt);
const Foundation f = GetRoadFoundation(tileh, present);
- if (HasRoadWorks(tile)) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS);
+ if (HasRoadWorks(tile) && _current_player != OWNER_WATER) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS);
/* Autocomplete to a straight road
* @li on steep slopes
@@ -260,6 +260,16 @@ static CommandCost RemoveRoad(TileIndex tile, uint32 flags, RoadBits pieces, Roa
if (town_check) ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM);
if (flags & DC_EXEC) {
+ if (HasRoadWorks(tile)) {
+ /* flooding tile with road works, don't forget to remove the effect vehicle too */
+ assert(_current_player == OWNER_WATER);
+ Vehicle *v;
+ FOR_ALL_VEHICLES(v) {
+ if (v->type == VEH_EFFECT && TileVirtXY(v->x_pos, v->y_pos) == tile) {
+ delete v;
+ }
+ }
+ }
if (present == ROAD_NONE) {
RoadTypes rts = GetRoadTypes(tile) & ComplementRoadTypes(RoadTypeToRoadTypes(rt));
if (rts == ROADTYPES_NONE) {