summaryrefslogtreecommitdiff
path: root/src/ai/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/ai/api')
-rw-r--r--src/ai/api/ai_industrytype.cpp21
-rw-r--r--src/ai/api/ai_industrytype.hpp24
-rw-r--r--src/ai/api/ai_industrytype.hpp.sq3
3 files changed, 48 insertions, 0 deletions
diff --git a/src/ai/api/ai_industrytype.cpp b/src/ai/api/ai_industrytype.cpp
index 83d356a3c..cc2e2abae 100644
--- a/src/ai/api/ai_industrytype.cpp
+++ b/src/ai/api/ai_industrytype.cpp
@@ -111,3 +111,24 @@
uint32 seed = ::InteractiveRandom();
return AIObject::DoCommand(0, industry_type, seed, CMD_BUILD_INDUSTRY);
}
+
+/* static */ bool AIIndustryType::IsBuiltOnWater(IndustryType industry_type)
+{
+ if (!IsValidIndustryType(industry_type)) return false;
+
+ return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0;
+}
+
+/* static */ bool AIIndustryType::HasHeliport(IndustryType industry_type)
+{
+ if (!IsValidIndustryType(industry_type)) return false;
+
+ return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0;
+}
+
+/* static */ bool AIIndustryType::HasDock(IndustryType industry_type)
+{
+ if (!IsValidIndustryType(industry_type)) return false;
+
+ return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0;
+}
diff --git a/src/ai/api/ai_industrytype.hpp b/src/ai/api/ai_industrytype.hpp
index 2b9241745..2d1063b6c 100644
--- a/src/ai/api/ai_industrytype.hpp
+++ b/src/ai/api/ai_industrytype.hpp
@@ -113,6 +113,30 @@ public:
* @note If true is returned the money is paid, whether a new industry was build or not.
*/
static bool ProspectIndustry(IndustryType industry_type);
+
+ /**
+ * Is this type of industry built on water.
+ * @param industry_type The type of the industry.
+ * @pre IsValidIndustryType(industry_type).
+ * @return True when this type is built on water.
+ */
+ static bool IsBuiltOnWater(IndustryType industry_type);
+
+ /**
+ * Does this type of industry have a heliport?
+ * @param industry_type The type of the industry.
+ * @pre IsValidIndustryType(industry_type).
+ * @return True when this type has a heliport.
+ */
+ static bool HasHeliport(IndustryType industry_type);
+
+ /**
+ * Does this type of industry have a dock?
+ * @param industry_type The type of the industry.
+ * @pre IsValidIndustryType(industry_type).
+ * @return True when this type has a dock.
+ */
+ static bool HasDock(IndustryType industry_type);
};
#endif /* AI_INDUSTRYTYPE_HPP */
diff --git a/src/ai/api/ai_industrytype.hpp.sq b/src/ai/api/ai_industrytype.hpp.sq
index 0d4c60787..a84cc2489 100644
--- a/src/ai/api/ai_industrytype.hpp.sq
+++ b/src/ai/api/ai_industrytype.hpp.sq
@@ -28,6 +28,9 @@ void SQAIIndustryType_Register(Squirrel *engine) {
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::CanProspectIndustry, "CanProspectIndustry", 2, ".i");
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::BuildIndustry, "BuildIndustry", 3, ".ii");
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::ProspectIndustry, "ProspectIndustry", 2, ".i");
+ SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::IsBuiltOnWater, "IsBuiltOnWater", 2, ".i");
+ SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::HasHeliport, "HasHeliport", 2, ".i");
+ SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::HasDock, "HasDock", 2, ".i");
SQAIIndustryType.PostRegister(engine);
}