From 2eb5af3bb840ac0dcabec9f1e3604aa119e01baa Mon Sep 17 00:00:00 2001 From: frosch Date: Fri, 23 Jan 2009 22:36:17 +0000 Subject: (svn r15244) -Fix (r15027): The station tile of an oilrig-like industry is not neccessarily the first industry tile. --- src/ai/api/ai_industry.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/ai/api') 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) -- cgit v1.2.3-70-g09d2