summaryrefslogtreecommitdiff
path: root/src/ai/api
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-01-23 22:36:17 +0000
committerfrosch <frosch@openttd.org>2009-01-23 22:36:17 +0000
commit2eb5af3bb840ac0dcabec9f1e3604aa119e01baa (patch)
tree72c929c2b942fecf53b0e2fca64eeb9a47c218a3 /src/ai/api
parent5ecd1be89d79268628cd5c9e7e096bcd95f8c9c2 (diff)
downloadopenttd-2eb5af3bb840ac0dcabec9f1e3604aa119e01baa.tar.xz
(svn r15244) -Fix (r15027): The station tile of an oilrig-like industry is not neccessarily the first industry tile.
Diffstat (limited to 'src/ai/api')
-rw-r--r--src/ai/api/ai_industry.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ai/api/ai_industry.cpp b/src/ai/api/ai_industry.cpp
index 10178ed7e..0cb5989aa 100644
--- a/src/ai/api/ai_industry.cpp
+++ b/src/ai/api/ai_industry.cpp
@@ -8,7 +8,9 @@
#include "../../openttd.h"
#include "../../tile_type.h"
#include "../../industry.h"
+#include "../../tile_map.h"
#include "../../strings_func.h"
+#include "../../station_map.h"
#include "../../station_func.h"
#include "table/strings.h"
@@ -161,7 +163,14 @@
if (!IsValidIndustry(industry_id)) return INVALID_TILE;
if (!HasHeliportAndDock(industry_id)) return INVALID_TILE;
- return ::GetIndustry(industry_id)->xy;
+ const Industry *ind = ::GetIndustry(industry_id);
+ BEGIN_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;
}
/* static */ IndustryType AIIndustry::GetIndustryType(IndustryID industry_id)