summaryrefslogtreecommitdiff
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
commitd05ab5a5310c184113cf237076044245464fb665 (patch)
tree72c929c2b942fecf53b0e2fca64eeb9a47c218a3
parent130870e6a950c8a320b9f97f198f55f6a1654fcb (diff)
downloadopenttd-d05ab5a5310c184113cf237076044245464fb665.tar.xz
(svn r15244) -Fix (r15027): The station tile of an oilrig-like industry is not neccessarily the first industry tile.
-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)