diff options
Diffstat (limited to 'src/ai')
-rw-r--r-- | src/ai/api/ai_industry.cpp | 8 | ||||
-rw-r--r-- | src/ai/api/ai_order.cpp | 4 | ||||
-rw-r--r-- | src/ai/api/ai_tilelist.cpp | 20 |
3 files changed, 14 insertions, 18 deletions
diff --git a/src/ai/api/ai_industry.cpp b/src/ai/api/ai_industry.cpp index 686a5d3fe..670fce050 100644 --- a/src/ai/api/ai_industry.cpp +++ b/src/ai/api/ai_industry.cpp @@ -142,11 +142,11 @@ if (!HasHeliport(industry_id)) return INVALID_TILE; const Industry *ind = ::Industry::Get(industry_id); - BEGIN_TILE_LOOP(tile_cur, ind->width, ind->height, ind->xy); + TILE_LOOP(tile_cur, ind->width, ind->height, ind->xy) { if (IsTileType(tile_cur, MP_STATION) && IsOilRig(tile_cur)) { return tile_cur; } - END_TILE_LOOP(tile_cur, ind->width, ind->height, ind->xy); + } return INVALID_TILE; } @@ -164,11 +164,11 @@ if (!HasDock(industry_id)) return INVALID_TILE; const Industry *ind = ::Industry::Get(industry_id); - BEGIN_TILE_LOOP(tile_cur, ind->width, ind->height, ind->xy); + TILE_LOOP(tile_cur, ind->width, ind->height, ind->xy) { if (IsTileType(tile_cur, MP_STATION) && IsOilRig(tile_cur)) { return tile_cur; } - END_TILE_LOOP(tile_cur, ind->width, ind->height, ind->xy); + } return INVALID_TILE; } diff --git a/src/ai/api/ai_order.cpp b/src/ai/api/ai_order.cpp index fcf1658fe..50d94d346 100644 --- a/src/ai/api/ai_order.cpp +++ b/src/ai/api/ai_order.cpp @@ -192,9 +192,9 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or return st->truck_stops->xy; } else if (st->airport_tile != INVALID_TILE) { const AirportFTAClass *fta = st->Airport(); - BEGIN_TILE_LOOP(tile, fta->size_x, fta->size_y, st->airport_tile) { + TILE_LOOP(tile, fta->size_x, fta->size_y, st->airport_tile) { if (!::IsHangar(tile)) return tile; - } END_TILE_LOOP(tile, fta->size_x, fta->size_y, st->airport_tile) + } } return INVALID_TILE; } diff --git a/src/ai/api/ai_tilelist.cpp b/src/ai/api/ai_tilelist.cpp index 587460a75..cdaaa9b95 100644 --- a/src/ai/api/ai_tilelist.cpp +++ b/src/ai/api/ai_tilelist.cpp @@ -34,9 +34,7 @@ void AITileList::AddRectangle(TileIndex t1, TileIndex t2) uint w = TileX(t2) - TileX(t1) + 1; uint h = TileY(t2) - TileY(t1) + 1; - BEGIN_TILE_LOOP(t, w, h, t1) { - this->AddItem(t); - } END_TILE_LOOP(t, w, h, t1) + TILE_LOOP(t, w, h, t1) this->AddItem(t); } void AITileList::AddTile(TileIndex tile) @@ -56,9 +54,7 @@ void AITileList::RemoveRectangle(TileIndex t1, TileIndex t2) uint w = TileX(t2) - TileX(t1) + 1; uint h = TileY(t2) - TileY(t1) + 1; - BEGIN_TILE_LOOP(t, w, h, t1) { - this->RemoveItem(t); - } END_TILE_LOOP(t, w, h, t1) + TILE_LOOP(t, w, h, t1) this->RemoveItem(t); } void AITileList::RemoveTile(TileIndex tile) @@ -85,7 +81,7 @@ AITileList_IndustryAccepting::AITileList_IndustryAccepting(IndustryID industry_i if (!_settings_game.station.modified_catchment) radius = CA_UNMODIFIED; - BEGIN_TILE_LOOP(cur_tile, i->width + radius * 2, i->height + radius * 2, i->xy - ::TileDiffXY(radius, radius)) { + TILE_LOOP(cur_tile, i->width + radius * 2, i->height + radius * 2, i->xy - ::TileDiffXY(radius, radius)) { 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; @@ -102,7 +98,7 @@ AITileList_IndustryAccepting::AITileList_IndustryAccepting(IndustryID industry_i } this->AddTile(cur_tile); - } END_TILE_LOOP(cur_tile, i->width + radius * 2, i->height + radius * 2, i->xy - ::TileDiffXY(radius, radius)) + } } AITileList_IndustryProducing::AITileList_IndustryProducing(IndustryID industry_id, int radius) @@ -122,7 +118,7 @@ AITileList_IndustryProducing::AITileList_IndustryProducing(IndustryID industry_i if (!_settings_game.station.modified_catchment) radius = CA_UNMODIFIED; - BEGIN_TILE_LOOP(cur_tile, i->width + radius * 2, i->height + radius * 2, i->xy - ::TileDiffXY(radius, radius)) { + TILE_LOOP(cur_tile, i->width + radius * 2, i->height + radius * 2, i->xy - ::TileDiffXY(radius, radius)) { 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; @@ -139,7 +135,7 @@ AITileList_IndustryProducing::AITileList_IndustryProducing(IndustryID industry_i } this->AddTile(cur_tile); - } END_TILE_LOOP(cur_tile, i->width + radius * 2, i->height + radius * 2, i->xy - ::TileDiffXY(radius, radius)) + } } AITileList_StationType::AITileList_StationType(StationID station_id, AIStation::StationType station_type) @@ -157,10 +153,10 @@ 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); - BEGIN_TILE_LOOP(cur_tile, rect->right - rect->left + 1, rect->bottom - rect->top + 1, ::TileXY(rect->left, rect->top)) { + TILE_LOOP(cur_tile, rect->right - rect->left + 1, rect->bottom - rect->top + 1, ::TileXY(rect->left, rect->top)) { if (!::IsTileType(cur_tile, MP_STATION)) continue; if (::GetStationIndex(cur_tile) != station_id) continue; if (!HasBit(station_type_value, ::GetStationType(cur_tile))) continue; this->AddTile(cur_tile); - } END_TILE_LOOP(cur_tile, rect->right - rect->left + 1, rect->bottom - rect->top + 1, ::TileXY(rect->left, rect->top)) + } } |