(svn r25969) -Add: [Script] ScriptTown::GetFundBuildingsDuration.

This commit is contained in:
frosch 2013-11-12 17:57:32 +00:00
parent 88175c2503
commit d2624c6947
6 changed files with 20 additions and 0 deletions

View File

@ -69,6 +69,7 @@ void SQAITown_Register(Squirrel *engine)
SQAITown.DefSQStaticMethod(engine, &ScriptTown::HasStatue, "HasStatue", 2, ".i"); SQAITown.DefSQStaticMethod(engine, &ScriptTown::HasStatue, "HasStatue", 2, ".i");
SQAITown.DefSQStaticMethod(engine, &ScriptTown::IsCity, "IsCity", 2, ".i"); SQAITown.DefSQStaticMethod(engine, &ScriptTown::IsCity, "IsCity", 2, ".i");
SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetRoadReworkDuration, "GetRoadReworkDuration", 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::GetExclusiveRightsCompany, "GetExclusiveRightsCompany", 2, ".i");
SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetExclusiveRightsDuration, "GetExclusiveRightsDuration", 2, ".i"); SQAITown.DefSQStaticMethod(engine, &ScriptTown::GetExclusiveRightsDuration, "GetExclusiveRightsDuration", 2, ".i");
SQAITown.DefSQStaticMethod(engine, &ScriptTown::IsActionAvailable, "IsActionAvailable", 3, ".ii"); SQAITown.DefSQStaticMethod(engine, &ScriptTown::IsActionAvailable, "IsActionAvailable", 3, ".ii");

View File

@ -23,6 +23,7 @@
* \li AIStation::HasCargoRating * \li AIStation::HasCargoRating
* \li AITile::GetTerrainType * \li AITile::GetTerrainType
* \li AITown::FoundTown * \li AITown::FoundTown
* \li AITown::GetFundBuildingsDuration
* \li AITown::TOWN_GROWTH_NONE * \li AITown::TOWN_GROWTH_NONE
* *
* Other changes: * Other changes:

View File

@ -73,6 +73,7 @@ void SQGSTown_Register(Squirrel *engine)
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::HasStatue, "HasStatue", 2, ".i"); SQGSTown.DefSQStaticMethod(engine, &ScriptTown::HasStatue, "HasStatue", 2, ".i");
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::IsCity, "IsCity", 2, ".i"); SQGSTown.DefSQStaticMethod(engine, &ScriptTown::IsCity, "IsCity", 2, ".i");
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetRoadReworkDuration, "GetRoadReworkDuration", 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::GetExclusiveRightsCompany, "GetExclusiveRightsCompany", 2, ".i");
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetExclusiveRightsDuration, "GetExclusiveRightsDuration", 2, ".i"); SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetExclusiveRightsDuration, "GetExclusiveRightsDuration", 2, ".i");
SQGSTown.DefSQStaticMethod(engine, &ScriptTown::IsActionAvailable, "IsActionAvailable", 3, ".ii"); SQGSTown.DefSQStaticMethod(engine, &ScriptTown::IsActionAvailable, "IsActionAvailable", 3, ".ii");

View File

@ -29,6 +29,7 @@
* \li GSStoryPage * \li GSStoryPage
* \li GSTile::GetTerrainType * \li GSTile::GetTerrainType
* \li GSTown::FoundTown * \li GSTown::FoundTown
* \li GSTown::GetFundBuildingsDuration
* \li GSTown::SetName * \li GSTown::SetName
* \li GSTown::TOWN_GROWTH_NONE * \li GSTown::TOWN_GROWTH_NONE
* \li GSTown::TOWN_GROWTH_NORMAL * \li GSTown::TOWN_GROWTH_NORMAL

View File

@ -228,6 +228,13 @@
return ::Town::Get(town_id)->road_build_months; 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) /* static */ ScriptCompany::CompanyID ScriptTown::GetExclusiveRightsCompany(TownID town_id)
{ {
if (ScriptObject::GetCompany() == OWNER_DEITY) return ScriptCompany::COMPANY_INVALID; if (ScriptObject::GetCompany() == OWNER_DEITY) return ScriptCompany::COMPANY_INVALID;

View File

@ -333,6 +333,15 @@ public:
*/ */
static int GetRoadReworkDuration(TownID town_id); 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. * Find out which company currently has the exclusive rights of this town.
* @param town_id The town to check. * @param town_id The town to check.