Changeset - r20922:151662ea5510
[Not reviewed]
master
0 6 0
frosch - 11 years ago 2013-11-12 17:57:32
frosch@openttd.org
(svn r25969) -Add: [Script] ScriptTown::GetFundBuildingsDuration.
6 files changed with 20 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/script/api/ai/ai_town.hpp.sq
Show inline comments
 
@@ -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");
src/script/api/ai_changelog.hpp
Show inline comments
 
@@ -23,6 +23,7 @@
 
 * \li AIStation::HasCargoRating
 
 * \li AITile::GetTerrainType
 
 * \li AITown::FoundTown
 
 * \li AITown::GetFundBuildingsDuration
 
 * \li AITown::TOWN_GROWTH_NONE
 
 *
 
 * Other changes:
src/script/api/game/game_town.hpp.sq
Show inline comments
 
@@ -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");
src/script/api/game_changelog.hpp
Show inline comments
 
@@ -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
src/script/api/script_town.cpp
Show inline comments
 
@@ -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;
src/script/api/script_town.hpp
Show inline comments
 
@@ -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).
0 comments (0 inline, 0 general)