summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-06-10 07:19:48 +0000
committersmatz <smatz@openttd.org>2009-06-10 07:19:48 +0000
commit4e2c1ef08f6544e59614b8cdacd6d67fb8092306 (patch)
treee88be60b6d6e13347854e3b617805143ff4fadb3
parent498d2b0caaeebf67d267d2e00ff4b8b1c1ad7d7a (diff)
downloadopenttd-4e2c1ef08f6544e59614b8cdacd6d67fb8092306.tar.xz
(svn r16549) -Codechange: use bool in TileLoopClearHelper
-rw-r--r--src/clear_cmd.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp
index 8df8c7742..af7440162 100644
--- a/src/clear_cmd.cpp
+++ b/src/clear_cmd.cpp
@@ -130,22 +130,19 @@ static void AnimateTile_Clear(TileIndex tile)
void TileLoopClearHelper(TileIndex tile)
{
- byte self;
- byte neighbour;
- TileIndex dirty = INVALID_TILE;
+ bool self = (IsTileType(tile, MP_CLEAR) && IsClearGround(tile, CLEAR_FIELDS));
+ bool dirty = false;
- self = (IsTileType(tile, MP_CLEAR) && IsClearGround(tile, CLEAR_FIELDS));
-
- neighbour = (IsTileType(TILE_ADDXY(tile, 1, 0), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 1, 0), CLEAR_FIELDS));
+ bool neighbour = (IsTileType(TILE_ADDXY(tile, 1, 0), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 1, 0), CLEAR_FIELDS));
if (GetFenceSW(tile) == 0) {
if (self != neighbour) {
SetFenceSW(tile, 3);
- dirty = tile;
+ dirty = true;
}
} else {
if (self == 0 && neighbour == 0) {
SetFenceSW(tile, 0);
- dirty = tile;
+ dirty = true;
}
}
@@ -153,16 +150,16 @@ void TileLoopClearHelper(TileIndex tile)
if (GetFenceSE(tile) == 0) {
if (self != neighbour) {
SetFenceSE(tile, 3);
- dirty = tile;
+ dirty = true;
}
} else {
if (self == 0 && neighbour == 0) {
SetFenceSE(tile, 0);
- dirty = tile;
+ dirty = true;
}
}
- if (dirty != INVALID_TILE) MarkTileDirtyByTile(dirty);
+ if (dirty) MarkTileDirtyByTile(tile);
}