summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/script/api/ai/ai_town.hpp.sq1
-rw-r--r--src/script/api/ai_changelog.hpp1
-rw-r--r--src/script/api/game/game_town.hpp.sq1
-rw-r--r--src/script/api/game_changelog.hpp1
-rw-r--r--src/script/api/script_town.cpp7
-rw-r--r--src/script/api/script_town.hpp9
6 files changed, 20 insertions, 0 deletions
diff --git a/src/script/api/ai/ai_town.hpp.sq b/src/script/api/ai/ai_town.hpp.sq
index 27f1ec72e..6b09190be 100644
--- a/src/script/api/ai/ai_town.hpp.sq
+++ b/src/script/api/ai/ai_town.hpp.sq
@@ -69,6 +69,7 @@ void SQAITown_Register(Squirrel *engine)
SQAITown.DefSQStaticMethod(engine, &ScriptTown::HasStatue, "HasStatue", 2, ".i");
SQAITown.DefSQStaticMethod(engine, &ScriptTown::IsCity, "IsCity", 2, ".i");
SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetRoadReworkDuration, "GetRoadReworkDuration", 2, ".i");
+ SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetFundBuildingsDuration, "GetFundBuildingsDuration", 2, ".i");
SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetExclusiveRightsCompany, "GetExclusiveRightsCompany", 2, ".i");
SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetExclusiveRightsDuration, "GetExclusiveRightsDuration", 2, ".i");
SQAITown.DefSQStaticMethod(engine, &ScriptTown::IsActionAvailable, "IsActionAvailable", 3, ".ii");
diff --git a/src/script/api/ai_changelog.hpp b/src/script/api/ai_changelog.hpp
index 0852f679c..0039eaf91 100644
--- a/src/script/api/ai_changelog.hpp
+++ b/src/script/api/ai_changelog.hpp
@@ -23,6 +23,7 @@
* \li AIStation::HasCargoRating
* \li AITile::GetTerrainType
* \li AITown::FoundTown
+ * \li AITown::GetFundBuildingsDuration
* \li AITown::TOWN_GROWTH_NONE
*
* Other changes:
diff --git a/src/script/api/game/game_town.hpp.sq b/src/script/api/game/game_town.hpp.sq
index 0ef4e0ddd..30eec6928 100644
--- a/src/script/api/game/game_town.hpp.sq
+++ b/src/script/api/game/game_town.hpp.sq
@@ -73,6 +73,7 @@ void SQGSTown_Register(Squirrel *engine)
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::HasStatue, "HasStatue", 2, ".i");
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::IsCity, "IsCity", 2, ".i");
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetRoadReworkDuration, "GetRoadReworkDuration", 2, ".i");
+ SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetFundBuildingsDuration, "GetFundBuildingsDuration", 2, ".i");
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetExclusiveRightsCompany, "GetExclusiveRightsCompany", 2, ".i");
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetExclusiveRightsDuration, "GetExclusiveRightsDuration", 2, ".i");
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::IsActionAvailable, "IsActionAvailable", 3, ".ii");
diff --git a/src/script/api/game_changelog.hpp b/src/script/api/game_changelog.hpp
index e34dc4fda..4d8a2b7d9 100644
--- a/src/script/api/game_changelog.hpp
+++ b/src/script/api/game_changelog.hpp
@@ -29,6 +29,7 @@
* \li GSStoryPage
* \li GSTile::GetTerrainType
* \li GSTown::FoundTown
+ * \li GSTown::GetFundBuildingsDuration
* \li GSTown::SetName
* \li GSTown::TOWN_GROWTH_NONE
* \li GSTown::TOWN_GROWTH_NORMAL
diff --git a/src/script/api/script_town.cpp b/src/script/api/script_town.cpp
index 5d67cb76d..8fd033e9e 100644
--- a/src/script/api/script_town.cpp
+++ b/src/script/api/script_town.cpp
@@ -228,6 +228,13 @@
return ::Town::Get(town_id)->road_build_months;
}
+/* static */ int ScriptTown::GetFundBuildingsDuration(TownID town_id)
+{
+ if (!IsValidTown(town_id)) return -1;
+
+ return ::Town::Get(town_id)->fund_buildings_months;
+}
+
/* static */ ScriptCompany::CompanyID ScriptTown::GetExclusiveRightsCompany(TownID town_id)
{
if (ScriptObject::GetCompany() == OWNER_DEITY) return ScriptCompany::COMPANY_INVALID;
diff --git a/src/script/api/script_town.hpp b/src/script/api/script_town.hpp
index 3f7cf998c..4aef587e6 100644
--- a/src/script/api/script_town.hpp
+++ b/src/script/api/script_town.hpp
@@ -334,6 +334,15 @@ public:
static int GetRoadReworkDuration(TownID town_id);
/**
+ * Find out how long new buildings are still being funded in a town.
+ * @param town_id The town to check.
+ * @pre IsValidTown(town_id).
+ * @return The number of months building construction is still funded.
+ * The value 0 means that there is currently no funding.
+ */
+ static int GetFundBuildingsDuration(TownID town_id);
+
+ /**
* Find out which company currently has the exclusive rights of this town.
* @param town_id The town to check.
* @pre IsValidTown(town_id).