summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2006-04-03 15:11:17 +0000
committercelestar <celestar@openttd.org>2006-04-03 15:11:17 +0000
commit1b51ad3dde5e3a75597e299ddb8c873a9dea113e (patch)
treefdad274855f6b452434f861271ac00d52a55699e
parentf4bbce2c396fa31b60ac0924b465a063277ddb74 (diff)
downloadopenttd-1b51ad3dde5e3a75597e299ddb8c873a9dea113e.tar.xz
(svn r4262) -Codechange: use IsClearWaterTile instead of some "home-brewn" marco. town_cmd is now map access free
-rw-r--r--town_cmd.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/town_cmd.c b/town_cmd.c
index c6ea1795c..76a326ecf 100644
--- a/town_cmd.c
+++ b/town_cmd.c
@@ -23,6 +23,7 @@
#include "economy.h"
#include "gui.h"
#include "unmovable_map.h"
+#include "water_map.h"
#include "variables.h"
#include "bridge.h"
@@ -545,8 +546,6 @@ static void LevelTownLand(TileIndex tile)
}
}
-#define IS_WATER_TILE(t) (IsTileType((t), MP_WATER) && _m[(t)].m5 == 0)
-
static void GrowTownInTile(TileIndex* tile_ptr, RoadBits mask, int block, Town* t1)
{
RoadBits rcmd;
@@ -621,7 +620,7 @@ static void GrowTownInTile(TileIndex* tile_ptr, RoadBits mask, int block, Town*
tmptile = TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[i]));
// Don't do it if it reaches to water.
- if (IS_WATER_TILE(tmptile)) return;
+ if (IsClearWaterTile(tmptile)) return;
// Build a house at the edge. 60% chance or
// always ok if no road allowed.
@@ -643,7 +642,7 @@ static void GrowTownInTile(TileIndex* tile_ptr, RoadBits mask, int block, Town*
}
// Return if a water tile
- if (IsTileType(tile, MP_WATER) && _m[tile].m5 == 0) return;
+ if (IsClearWaterTile(tile)) return;
// Determine direction of slope,
// and build a road if not a special slope.
@@ -669,7 +668,7 @@ build_road_and_exit:
if (++j == 0)
goto build_road_and_exit;
tmptile = TILE_MASK(tmptile + TileOffsByDir(i));
- } while (IS_WATER_TILE(tmptile));
+ } while (IsClearWaterTile(tmptile));
// no water tiles in between?
if (j == -10)
@@ -691,8 +690,6 @@ build_road_and_exit:
} while (--j != 0);
}
}
-#undef IS_WATER_TILE
-
// Returns true if a house was built, or no if the build failed.
static int GrowTownAtRoad(Town *t, TileIndex tile)