summaryrefslogtreecommitdiff
path: root/src/ai/api
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-01-04 18:21:07 +0000
committerrubidium <rubidium@openttd.org>2010-01-04 18:21:07 +0000
commit87466a4ed091035b758ef981e6600e2b03cbfe30 (patch)
treeb5a79792fb0f12f7f3a96e400091c1fda26de9c5 /src/ai/api
parent71f2789270ca091af14ab4cfd64a4f17234cf007 (diff)
downloadopenttd-87466a4ed091035b758ef981e6600e2b03cbfe30.tar.xz
(svn r18717) -Codechange: use TileArea in industry instead of three separate variables. Also make use of TileArea functions for determining the 'width' and 'height' of an industry.
Diffstat (limited to 'src/ai/api')
-rw-r--r--src/ai/api/ai_industry.cpp8
-rw-r--r--src/ai/api/ai_tilelist.cpp4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/ai/api/ai_industry.cpp b/src/ai/api/ai_industry.cpp
index d9fcf36eb..cf715d34e 100644
--- a/src/ai/api/ai_industry.cpp
+++ b/src/ai/api/ai_industry.cpp
@@ -115,7 +115,7 @@
{
if (!IsValidIndustry(industry_id)) return INVALID_TILE;
- return ::Industry::Get(industry_id)->xy;
+ return ::Industry::Get(industry_id)->location.tile;
}
/* static */ int32 AIIndustry::GetAmountOfStationsAround(IndustryID industry_id)
@@ -124,7 +124,7 @@
Industry *ind = ::Industry::Get(industry_id);
StationList stations;
- ::FindStationsAroundTiles(TileArea(ind->xy, ind->width, ind->height), &stations);
+ ::FindStationsAroundTiles(ind->location, &stations);
return (int32)stations.Length();
}
@@ -162,7 +162,7 @@
if (!HasHeliport(industry_id)) return INVALID_TILE;
const Industry *ind = ::Industry::Get(industry_id);
- TILE_LOOP(tile_cur, ind->width, ind->height, ind->xy) {
+ TILE_LOOP(tile_cur, ind->location.w, ind->location.h, ind->location.tile) {
if (IsTileType(tile_cur, MP_STATION) && IsOilRig(tile_cur)) {
return tile_cur;
}
@@ -184,7 +184,7 @@
if (!HasDock(industry_id)) return INVALID_TILE;
const Industry *ind = ::Industry::Get(industry_id);
- TILE_LOOP(tile_cur, ind->width, ind->height, ind->xy) {
+ TILE_LOOP(tile_cur, ind->location.w, ind->location.h, ind->location.tile) {
if (IsTileType(tile_cur, MP_STATION) && IsOilRig(tile_cur)) {
return tile_cur;
}
diff --git a/src/ai/api/ai_tilelist.cpp b/src/ai/api/ai_tilelist.cpp
index 22ce7968d..2cf5ca661 100644
--- a/src/ai/api/ai_tilelist.cpp
+++ b/src/ai/api/ai_tilelist.cpp
@@ -86,7 +86,7 @@ AITileList_IndustryAccepting::AITileList_IndustryAccepting(IndustryID industry_i
if (!_settings_game.station.modified_catchment) radius = CA_UNMODIFIED;
- TILE_LOOP(cur_tile, i->width + radius * 2, i->height + radius * 2, i->xy - ::TileDiffXY(radius, radius)) {
+ TILE_LOOP(cur_tile, i->location.w + radius * 2, i->location.h+ radius * 2, i->location.tile - ::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;
@@ -123,7 +123,7 @@ AITileList_IndustryProducing::AITileList_IndustryProducing(IndustryID industry_i
if (!_settings_game.station.modified_catchment) radius = CA_UNMODIFIED;
- TILE_LOOP(cur_tile, i->width + radius * 2, i->height + radius * 2, i->xy - ::TileDiffXY(radius, radius)) {
+ TILE_LOOP(cur_tile, i->location.w + radius * 2, i->location.h+ radius * 2, i->location.tile - ::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;