(svn r12902) [NoAI] -Fix r12901 [API CHANGE]: renamed IsWithinTownRadius to IsWithinTownInfluence, as that reflects the meaning much better
/* $Id$ */
/** @file ai_town.hpp Everything to query towns. */
#ifndef AI_TOWN_HPP
#define AI_TOWN_HPP
#include "ai_object.hpp"
/**
* Class that handles all town related functions.
*/
class AITown : public AIObject {
public:
static const char *GetClassName() { return "AITown"; }
/**
* Gets the maximum town index; there are no valid towns with a higher index.
* @return The maximum town index.
* @post Return value is always non-negative.
*/
static TownID GetMaxTownID();
/**
* Gets the number of towns. This is different than GetMaxTownID()
* because of the way OpenTTD works internally.
* @return The number of towns.
* @post Return value is always non-negative.
*/
static int32 GetTownCount();
/**
* Checks whether the given town index is valid.
* @param town_id The index to check.
* @return True if and only if the town is valid.
*/
static bool IsValidTown(TownID town_id);
/**
* Get the name of the town.
* @param town_id The town to get the name of.
* @pre IsValidTown(town_id).
* @return The name of the town.
*/
static char *GetName(TownID town_id);
/**
* Gets the number of inhabitants in the town.
* @param town_id The town to get the name of.
* @pre IsValidTown(town_id).
* @return The number of inhabitants.
* @post Return value is always non-negative.
*/
static int32 GetPopulation(TownID town_id);
/**
* Gets the location of the town.
* @param town_id The location of the town.
* @pre IsValidTown(town_id).
* @return The location of the town.
*/
static TileIndex GetLocation(TownID town_id);
/**
* Get the manhattan distance from the tile to the AITown::GetLocation()
* of the town.
* @param town_id The town to get the distance to.
* @param tile The tile to get the distance to.
* @pre IsValidTown(town_id).
* @return The distance between town and tile.
*/
static int32 GetDistanceManhattanToTile(TownID town_id, TileIndex tile);
/**
* Get the square distance from the tile to the AITown::GetLocation()
* of the town.
* @param town_id The town to get the distance to.
* @param tile The tile to get the distance to.
* @pre IsValidTown(town_id).
* @return The distance between town and tile.
*/
static int32 GetDistanceSquareToTile(TownID town_id, TileIndex tile);
/**
* Find out if this tile is within the rating influence of a town.
* Stations on this tile influence the rating of the town.
* @param town_id The town to check.
* @param tile The tile to check.
* @return True if the tile is within the rating influence of the town.
*/
static bool IsWithinTownInfluence(TownID town_id, TileIndex tile);
};
#endif /* AI_TOWN_HPP */