summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-12-12 18:47:08 +0000
committerrubidium <rubidium@openttd.org>2010-12-12 18:47:08 +0000
commit773b6136a9ac98a2c92f005379668d5396e2ca15 (patch)
tree56a678fe47c58e76da43ebc2eecbf109ddb57a50 /src/ai
parenta1a0526aaf6945698c94bb3dbf140f904568a650 (diff)
downloadopenttd-773b6136a9ac98a2c92f005379668d5396e2ca15.tar.xz
(svn r21488) -Codechange: make use of TILE_AREA_LOOP in the tile list AI API
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/api/ai_tilelist.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ai/api/ai_tilelist.cpp b/src/ai/api/ai_tilelist.cpp
index 8513ba17c..aa7c77661 100644
--- a/src/ai/api/ai_tilelist.cpp
+++ b/src/ai/api/ai_tilelist.cpp
@@ -63,7 +63,8 @@ AITileList_IndustryAccepting::AITileList_IndustryAccepting(IndustryID industry_i
if (!_settings_game.station.modified_catchment) radius = CA_UNMODIFIED;
- TILE_LOOP(cur_tile, i->location.w + radius * 2, i->location.h + radius * 2, i->location.tile - ::TileDiffXY(radius, radius)) {
+ TileArea ta(i->location.tile - ::TileDiffXY(radius, radius), i->location.w + radius * 2, i->location.h + radius * 2);
+ TILE_AREA_LOOP(cur_tile, ta) {
if (!::IsValidTile(cur_tile)) continue;
/* Exclude all tiles that belong to this industry */
if (::IsTileType(cur_tile, MP_INDUSTRY) && ::GetIndustryIndex(cur_tile) == industry_id) continue;
@@ -98,7 +99,8 @@ AITileList_IndustryProducing::AITileList_IndustryProducing(IndustryID industry_i
if (!_settings_game.station.modified_catchment) radius = CA_UNMODIFIED;
- TILE_LOOP(cur_tile, i->location.w + radius * 2, i->location.h + radius * 2, i->location.tile - ::TileDiffXY(radius, radius)) {
+ TileArea ta(i->location.tile - ::TileDiffXY(radius, radius), i->location.w + radius * 2, i->location.h + radius * 2);
+ TILE_AREA_LOOP(cur_tile, ta) {
if (!::IsValidTile(cur_tile)) continue;
/* Exclude all tiles that belong to this industry */
if (::IsTileType(cur_tile, MP_INDUSTRY) && ::GetIndustryIndex(cur_tile) == industry_id) continue;
@@ -122,7 +124,8 @@ AITileList_StationType::AITileList_StationType(StationID station_id, AIStation::
if ((station_type & AIStation::STATION_AIRPORT) != 0) station_type_value |= (1 << ::STATION_AIRPORT) | (1 << ::STATION_OILRIG);
if ((station_type & AIStation::STATION_DOCK) != 0) station_type_value |= (1 << ::STATION_DOCK) | (1 << ::STATION_OILRIG);
- TILE_LOOP(cur_tile, rect->right - rect->left + 1, rect->bottom - rect->top + 1, ::TileXY(rect->left, rect->top)) {
+ TileArea ta(::TileXY(rect->left, rect->top), rect->right - rect->left + 1, rect->bottom - rect->top + 1);
+ TILE_AREA_LOOP(cur_tile, ta) {
if (!::IsTileType(cur_tile, MP_STATION)) continue;
if (::GetStationIndex(cur_tile) != station_id) continue;
if (!HasBit(station_type_value, ::GetStationType(cur_tile))) continue;