/* $Id$ */
/** @file ai_town.hpp Everything to query towns */
#ifndef AI_TOWN_HPP
#define AI_TOWN_HPP
#include "ai_object.hpp"
class AITown : public AIObject {
public:
/**
* Gets the maximum town index; there are no valid towns with a higher index
* @return the maximum town index
* @post return >= 0
*/
TownID GetMaxTownID();
/**
* Gets the number of towns
* @return the number of towns
* @post return >= 0
*/
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
*/
bool IsValidTown(TownID town_id);
/**
* Get the name of the town
* @param town_id the town to get the name of
* @pre this->IsValidTown(town)
* @return the name of the town
* @note the returned name must be freed
*/
char *GetName(TownID town_id);
/**
* Gets the number of inhabitants in the town
* @param town_id the town to get the name of
* @pre this->IsValidTown(town_id)
* @return the number of inhabitants
* @post return >= 0
*/
int32 GetPopulation(TownID town_id);
/**
* Gets the location of the town
* @param town_id the location of the town
* @pre this->IsValidTown(town_id)
* @return the location of the town
* @post return >= 0
*/
TileIndex GetLocation(TownID town_id);
};
#ifdef DEFINE_SQUIRREL_CLASS
void SQAITownRegister(Squirrel *engine) {
DefSQClass <AITown> SQAITown("AITown");
SQAITown.PreRegister(engine);
SQAITown.AddConstructor(engine);
SQAITown.DefSQFunction(engine, &AITown::GetMaxTownID, "GetMaxTownID");
SQAITown.DefSQFunction(engine, &AITown::GetTownCount, "GetTownCount");
SQAITown.DefSQFunction(engine, &AITown::IsValidTown, "IsValidTown");
SQAITown.DefSQFunction(engine, &AITown::GetName, "GetName");
SQAITown.DefSQFunction(engine, &AITown::GetPopulation, "GetPopulation");
SQAITown.DefSQFunction(engine, &AITown::GetLocation, "GetLocation");
SQAITown.PostRegister(engine);
}
#endif /* SQUIRREL_CLASS */
#endif /* AI_TOWN_HPP */