summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/ai/ai_industrytype.hpp.sq1
-rw-r--r--src/script/api/ai_changelog.hpp1
-rw-r--r--src/script/api/game/game_industrytype.hpp.sq1
-rw-r--r--src/script/api/game_changelog.hpp1
-rw-r--r--src/script/api/script_industrytype.cpp7
-rw-r--r--src/script/api/script_industrytype.hpp20
6 files changed, 31 insertions, 0 deletions
diff --git a/src/script/api/ai/ai_industrytype.hpp.sq b/src/script/api/ai/ai_industrytype.hpp.sq
index fe84b70f9..7c56acee9 100644
--- a/src/script/api/ai/ai_industrytype.hpp.sq
+++ b/src/script/api/ai/ai_industrytype.hpp.sq
@@ -29,6 +29,7 @@ void SQAIIndustryType_Register(Squirrel *engine)
SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::GetProducedCargo, "GetProducedCargo", 2, ".i");
SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::GetAcceptedCargo, "GetAcceptedCargo", 2, ".i");
SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::IsRawIndustry, "IsRawIndustry", 2, ".i");
+ SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::IsProcessingIndustry, "IsProcessingIndustry", 2, ".i");
SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::ProductionCanIncrease, "ProductionCanIncrease", 2, ".i");
SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::GetConstructionCost, "GetConstructionCost", 2, ".i");
SQAIIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::CanBuildIndustry, "CanBuildIndustry", 2, ".i");
diff --git a/src/script/api/ai_changelog.hpp b/src/script/api/ai_changelog.hpp
index 7161d9a3d..fda888c0c 100644
--- a/src/script/api/ai_changelog.hpp
+++ b/src/script/api/ai_changelog.hpp
@@ -22,6 +22,7 @@
* API additions:
* \li AIEventExclusiveTransportRights
* \li AIEventRoadReconstruction
+ * \li AIIndustryType::IsProcessingIndustry
* \li AIStation::IsAirportClosed
* \li AIStation::OpenCloseAirport
*
diff --git a/src/script/api/game/game_industrytype.hpp.sq b/src/script/api/game/game_industrytype.hpp.sq
index 66425a512..460cc513c 100644
--- a/src/script/api/game/game_industrytype.hpp.sq
+++ b/src/script/api/game/game_industrytype.hpp.sq
@@ -29,6 +29,7 @@ void SQGSIndustryType_Register(Squirrel *engine)
SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::GetProducedCargo, "GetProducedCargo", 2, ".i");
SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::GetAcceptedCargo, "GetAcceptedCargo", 2, ".i");
SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::IsRawIndustry, "IsRawIndustry", 2, ".i");
+ SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::IsProcessingIndustry, "IsProcessingIndustry", 2, ".i");
SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::ProductionCanIncrease, "ProductionCanIncrease", 2, ".i");
SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::GetConstructionCost, "GetConstructionCost", 2, ".i");
SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::CanBuildIndustry, "CanBuildIndustry", 2, ".i");
diff --git a/src/script/api/game_changelog.hpp b/src/script/api/game_changelog.hpp
index 46da1d4f8..8948822e4 100644
--- a/src/script/api/game_changelog.hpp
+++ b/src/script/api/game_changelog.hpp
@@ -25,6 +25,7 @@
* \li GSEventExclusiveTransportRights
* \li GSEventRoadReconstruction
* \li GSNews::NT_ACCIDENT, GSNews::NT_COMPANY_INFO, GSNews::NT_ADVICE, GSNews::NT_ACCEPTANCE
+ * \li GSIndustryType::IsProcessingIndustry
* \li GSStation::IsAirportClosed
* \li GSStation::OpenCloseAirport
*
diff --git a/src/script/api/script_industrytype.cpp b/src/script/api/script_industrytype.cpp
index 26a93cda1..7db905829 100644
--- a/src/script/api/script_industrytype.cpp
+++ b/src/script/api/script_industrytype.cpp
@@ -32,6 +32,13 @@
return ::GetIndustrySpec(industry_type)->IsRawIndustry();
}
+/* static */ bool ScriptIndustryType::IsProcessingIndustry(IndustryType industry_type)
+{
+ if (!IsValidIndustryType(industry_type)) return false;
+
+ return ::GetIndustrySpec(industry_type)->IsProcessingIndustry();
+}
+
/* static */ bool ScriptIndustryType::ProductionCanIncrease(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return false;
diff --git a/src/script/api/script_industrytype.hpp b/src/script/api/script_industrytype.hpp
index 1d642ac38..de5180c43 100644
--- a/src/script/api/script_industrytype.hpp
+++ b/src/script/api/script_industrytype.hpp
@@ -65,13 +65,33 @@ public:
/**
* Is this industry type a raw industry?
+ * Raw industries usually produce cargo without any prerequisites.
+ * ("Usually" means that advanced NewGRF industry concepts might not fit the "raw"/"processing"
+ * classification, so it's up to the interpretation of the NewGRF author.)
* @param industry_type The type of the industry.
* @pre IsValidIndustryType(industry_type).
* @return True if it should be handled as a raw industry.
+ * @note Industries might be neither raw nor processing.
+ * This is usually the case for industries which produce nothing (e.g. power plants),
+ * but also for weird industries like temperate banks and tropic lumber mills.
*/
static bool IsRawIndustry(IndustryType industry_type);
/**
+ * Is this industry type a processing industry?
+ * Processing industries usually produce cargo when delivered with input cargo.
+ * ("Usually" means that advanced NewGRF industry concepts might not fit the "raw"/"processing"
+ * classification, so it's up to the interpretation of the NewGRF author.)
+ * @param industry_type The type of the industry.
+ * @pre IsValidIndustryType(industry_type).
+ * @return True if it is a processing industry.
+ * @note Industries might be neither raw nor processing.
+ * This is usually the case for industries which produce nothing (e.g. power plants),
+ * but also for weird industries like temperate banks and tropic lumber mills.
+ */
+ static bool IsProcessingIndustry(IndustryType industry_type);
+
+ /**
* Can the production of this industry increase?
* @param industry_type The type of the industry.
* @pre IsValidIndustryType(industry_type).