summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-01-13 22:12:39 +0000
committersmatz <smatz@openttd.org>2008-01-13 22:12:39 +0000
commitb3bf60000e86792c0a9633074c9356cd684f2ec0 (patch)
treefbd4c867a6394e56bc28ba5ae4ef784a3a7befb6 /src
parentf57ab9f99f7620dedc8a03b96e1b5e4b4af799ef (diff)
downloadopenttd-b3bf60000e86792c0a9633074c9356cd684f2ec0.tar.xz
(svn r11843) -Fix: mark dirty canal tile even in diagonal direction from flooded tile
Diffstat (limited to 'src')
-rw-r--r--src/direction_type.h4
-rw-r--r--src/water_cmd.cpp7
2 files changed, 7 insertions, 4 deletions
diff --git a/src/direction_type.h b/src/direction_type.h
index d1f8d8920..89b527cb6 100644
--- a/src/direction_type.h
+++ b/src/direction_type.h
@@ -30,6 +30,9 @@ enum Direction {
INVALID_DIR = 0xFF, ///< Flag for an invalid direction
};
+/** Allow incrementing of Direction variables */
+DECLARE_POSTFIX_INCREMENT(Direction);
+
/** Define basic enum properties */
template <> struct EnumPropsT<Direction> : MakeEnumPropsT<Direction, byte, DIR_BEGIN, DIR_END, INVALID_DIR> {};
typedef TinyEnumT<Direction> DirectionByte; //typedefing-enumification of Direction
@@ -77,6 +80,7 @@ enum DiagDirection {
INVALID_DIAGDIR = 0xFF, ///< Flag for an invalid DiagDirection
};
+/** Allow incrementing of DiagDirection variables */
DECLARE_POSTFIX_INCREMENT(DiagDirection);
/** Define basic enum properties */
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 119432abe..b9f2f348a 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -644,10 +644,9 @@ static void TileLoopWaterHelper(TileIndex tile, const TileIndexDiffC *offs)
MakeWater(target);
MarkTileDirtyByTile(target);
/* Mark surrounding canal tiles dirty too to avoid glitches */
- MarkTileDirtyIfCanal(target + TileDiffXY(0, 1));
- MarkTileDirtyIfCanal(target + TileDiffXY(1, 0));
- MarkTileDirtyIfCanal(target + TileDiffXY(0, -1));
- MarkTileDirtyIfCanal(target + TileDiffXY(-1, 0));
+ for (Direction dir = DIR_BEGIN; dir < DIR_END; dir++) {
+ MarkTileDirtyIfCanal(target + TileOffsByDir(dir));
+ }
}
}
}