(svn r22764) -Add: [NoAI] AITile::GetTownAuthority().

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
frosch 13 years ago
parent b8f8cef34c
commit 27aff44e77

@ -26,6 +26,7 @@
* \li AICompany::GetQuarterlyCargoDelivered
* \li AICompany::GetQuarterlyPerformanceRating
* \li AICompany::GetQuarterlyCompanyValue
* \li AITown::GetTownAuthority
*
* API removals:
* \li AICompany::GetCompanyValue, use AICompany::GetQuarterlyCompanyValue instead.

@ -268,6 +268,13 @@
return AITown::IsWithinTownInfluence(town_id, tile);
}
/* static */ TownID AITile::GetTownAuthority(TileIndex tile)
{
if (!::IsValidTile(tile)) return false;
return ::ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority)->index;
}
/* static */ TownID AITile::GetClosestTown(TileIndex tile)
{
if (!::IsValidTile(tile)) return INVALID_TOWN;

@ -449,6 +449,13 @@ public:
*/
static bool IsWithinTownInfluence(TileIndex tile, TownID town_id);
/**
* Find the town which has authority for the tile.
* The rating of your company in this town will be checked and affected when
* building stations, trees etc.
*/
static TownID GetTownAuthority(TileIndex tile);
/**
* Find the town that is closest to a tile. Stations you build at this tile
* will belong to this town.

@ -125,6 +125,7 @@ void SQAITile_Register(Squirrel *engine)
SQAITile.DefSQStaticMethod(engine, &AITile::PlantTree, "PlantTree", 2, ".i");
SQAITile.DefSQStaticMethod(engine, &AITile::PlantTreeRectangle, "PlantTreeRectangle", 4, ".iii");
SQAITile.DefSQStaticMethod(engine, &AITile::IsWithinTownInfluence, "IsWithinTownInfluence", 3, ".ii");
SQAITile.DefSQStaticMethod(engine, &AITile::GetTownAuthority, "GetTownAuthority", 2, ".i");
SQAITile.DefSQStaticMethod(engine, &AITile::GetClosestTown, "GetClosestTown", 2, ".i");
SQAITile.DefSQStaticMethod(engine, &AITile::GetBuildCost, "GetBuildCost", 2, ".i");

Loading…
Cancel
Save