diff options
author | yexo <yexo@openttd.org> | 2009-02-25 21:50:54 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2009-02-25 21:50:54 +0000 |
commit | a0c4f1156aa5fcd503d976c102db89b5a683b81a (patch) | |
tree | bfb79ccd128fd6dc82c35c17f2dc26c87fd8939e | |
parent | fb7b0536e74d0cfdc682593657dfb66700f724e9 (diff) | |
download | openttd-a0c4f1156aa5fcd503d976c102db89b5a683b81a.tar.xz |
(svn r15585) -Codechange: Remove TILE_ASSERT and replace all instances with assert(tile < MapSize()).
-rw-r--r-- | src/industry_cmd.cpp | 4 | ||||
-rw-r--r-- | src/map_func.h | 5 | ||||
-rw-r--r-- | src/town_cmd.cpp | 8 | ||||
-rw-r--r-- | src/unmovable_cmd.cpp | 2 |
4 files changed, 7 insertions, 12 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index f4d559bb2..e166d2b09 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -928,7 +928,7 @@ static void PlantFarmField(TileIndex tile, IndustryID industry) /* check the amount of bad tiles */ count = 0; BEGIN_TILE_LOOP(cur_tile, size_x, size_y, tile) - TILE_ASSERT(cur_tile); + assert(cur_tile < MapSize()); count += IsBadFarmFieldTile(cur_tile); END_TILE_LOOP(cur_tile, size_x, size_y, tile) if (count * 2 >= size_x * size_y) return; @@ -940,7 +940,7 @@ static void PlantFarmField(TileIndex tile, IndustryID industry) /* make field */ BEGIN_TILE_LOOP(cur_tile, size_x, size_y, tile) - TILE_ASSERT(cur_tile); + assert(cur_tile < MapSize()); if (!IsBadFarmFieldTile2(cur_tile)) { MakeField(cur_tile, field_type, industry); SetClearCounter(cur_tile, counter); diff --git a/src/map_func.h b/src/map_func.h index 2a971d1d6..a3781204b 100644 --- a/src/map_func.h +++ b/src/map_func.h @@ -18,11 +18,6 @@ extern uint _map_tile_mask; */ #define TILE_MASK(x) ((x) & _map_tile_mask) -/** - * Asserts when the tile is outside of the map. - * @param x the tile to check - */ -#define TILE_ASSERT(x) assert(TILE_MASK(x) == (x)); /** * Pointer to the tile-array. diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 1f7cb3938..6039d1040 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -818,7 +818,7 @@ no_slope: static bool TerraformTownTile(TileIndex tile, int edges, int dir) { - TILE_ASSERT(tile); + assert(tile < MapSize()); CommandCost r = DoCommand(tile, edges, dir, DC_AUTO | DC_NO_WATER, CMD_TERRAFORM_LAND); if (CmdFailed(r) || r.GetCost() >= (_price.terraform + 2) * 8) return false; @@ -828,7 +828,7 @@ static bool TerraformTownTile(TileIndex tile, int edges, int dir) static void LevelTownLand(TileIndex tile) { - TILE_ASSERT(tile); + assert(tile < MapSize()); /* Don't terraform if land is plain or if there's a house there. */ if (IsTileType(tile, MP_HOUSE)) return; @@ -1027,7 +1027,7 @@ static void GrowTownInTile(TileIndex *tile_ptr, RoadBits cur_rb, DiagDirection t RoadBits rcmd = ROAD_NONE; // RoadBits for the road construction command TileIndex tile = *tile_ptr; // The main tile on which we base our growth - TILE_ASSERT(tile); + assert(tile < MapSize()); if (cur_rb == ROAD_NONE) { /* Tile has no road. First reset the status counter @@ -1195,7 +1195,7 @@ static int GrowTownAtRoad(Town *t, TileIndex tile) */ DiagDirection target_dir = DIAGDIR_END; // The direction in which we want to extend the town - TILE_ASSERT(tile); + assert(tile < MapSize()); /* Number of times to search. * Better roads, 2X2 and 3X3 grid grow quite fast so we give diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp index a3f5b5117..b76a3e017 100644 --- a/src/unmovable_cmd.cpp +++ b/src/unmovable_cmd.cpp @@ -452,7 +452,7 @@ void GenerateUnmovables() MakeLighthouse(tile); IncreaseGeneratingWorldProgress(GWP_UNMOVABLE); lighthouses_to_build--; - TILE_ASSERT(tile); + assert(tile < MapSize()); break; } tile = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDiagDir(dir)); |