mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-26 16:09:10 +00:00
(svn r21654) -Add: [NoAI] AITown::IsCity() so AIs can find out which towns grow faster than others (Lord Aro)
This commit is contained in:
@@ -129,6 +129,13 @@
|
||||
return ::HasBit(::Town::Get(town_id)->statues, _current_company);
|
||||
}
|
||||
|
||||
/* static */ bool AITown::IsCity(TownID town_id)
|
||||
{
|
||||
if (!IsValidTown(town_id)) return false;
|
||||
|
||||
return ::Town::Get(town_id)->larger_town;
|
||||
}
|
||||
|
||||
/* static */ int AITown::GetRoadReworkDuration(TownID town_id)
|
||||
{
|
||||
if (!IsValidTown(town_id)) return -1;
|
||||
|
@@ -226,6 +226,14 @@ public:
|
||||
*/
|
||||
static bool HasStatue(TownID town_id);
|
||||
|
||||
/**
|
||||
* Find out if the town is a city.
|
||||
* @param town_id The town to check.
|
||||
* @pre IsValidTown(town_id).
|
||||
* @return True if the town is a city.
|
||||
*/
|
||||
static bool IsCity(TownID town_id);
|
||||
|
||||
/**
|
||||
* Find out how long the town is undergoing road reconstructions.
|
||||
* @param town_id The town to check.
|
||||
|
@@ -71,6 +71,7 @@ void SQAITown_Register(Squirrel *engine)
|
||||
SQAITown.DefSQStaticMethod(engine, &AITown::GetDistanceSquareToTile, "GetDistanceSquareToTile", 3, ".ii");
|
||||
SQAITown.DefSQStaticMethod(engine, &AITown::IsWithinTownInfluence, "IsWithinTownInfluence", 3, ".ii");
|
||||
SQAITown.DefSQStaticMethod(engine, &AITown::HasStatue, "HasStatue", 2, ".i");
|
||||
SQAITown.DefSQStaticMethod(engine, &AITown::IsCity, "IsCity", 2, ".i");
|
||||
SQAITown.DefSQStaticMethod(engine, &AITown::GetRoadReworkDuration, "GetRoadReworkDuration", 2, ".i");
|
||||
SQAITown.DefSQStaticMethod(engine, &AITown::GetExclusiveRightsCompany, "GetExclusiveRightsCompany", 2, ".i");
|
||||
SQAITown.DefSQStaticMethod(engine, &AITown::GetExclusiveRightsDuration, "GetExclusiveRightsDuration", 2, ".i");
|
||||
|
Reference in New Issue
Block a user