Index: src/ai/api/ai_town.hpp =================================================================== --- src/ai/api/ai_town.hpp (revision 12187) +++ src/ai/api/ai_town.hpp (working copy) @@ -23,7 +23,7 @@ * @return the maximum town index. * @post return value is always non-negative. */ - TownID GetMaxTownID(); + static TownID GetMaxTownID(); /** * Gets the number of towns. This is different than GetMaxTownID() @@ -31,7 +31,7 @@ * @return the number of towns. * @post return value is always non-negative. */ - int32 GetTownCount(); + static int32 GetTownCount(); /** * Checks whether the given town index is valid. Index: src/ai/api/ai_town.hpp.sq =================================================================== --- src/ai/api/ai_town.hpp.sq (revision 12187) +++ src/ai/api/ai_town.hpp.sq (working copy) @@ -15,13 +15,12 @@ SQAITown.AddConstructor(engine, "x"); SQAITown.DefSQStaticMethod(engine, &AITown::GetClassName, "GetClassName", 1, "x"); + SQAITown.DefSQStaticMethod(engine, &AITown::GetMaxTownID, "GetMaxTownID", 1, "x"); + SQAITown.DefSQStaticMethod(engine, &AITown::GetTownCount, "GetTownCount", 1, "x"); SQAITown.DefSQStaticMethod(engine, &AITown::IsValidTown, "IsValidTown", 2, "xi"); SQAITown.DefSQStaticMethod(engine, &AITown::GetName, "GetName", 2, "xi"); SQAITown.DefSQStaticMethod(engine, &AITown::GetPopulation, "GetPopulation", 2, "xi"); SQAITown.DefSQStaticMethod(engine, &AITown::GetLocation, "GetLocation", 2, "xi"); - SQAITown.DefSQMethod(engine, &AITown::GetMaxTownID, "GetMaxTownID", 1, "x"); - SQAITown.DefSQMethod(engine, &AITown::GetTownCount, "GetTownCount", 1, "x"); - SQAITown.PostRegister(engine); } Index: src/ai/api/ai_town.cpp =================================================================== --- src/ai/api/ai_town.cpp (revision 12187) +++ src/ai/api/ai_town.cpp (working copy) @@ -9,12 +9,12 @@ #include "../../core/alloc_func.hpp" #include "table/strings.h" -TownID AITown::GetMaxTownID() +/* static */ TownID AITown::GetMaxTownID() { return ::GetMaxTownIndex(); } -int32 AITown::GetTownCount() +/* static */ int32 AITown::GetTownCount() { return ::GetNumTowns(); } @@ -24,7 +24,7 @@ return ::IsValidTownID(town_id); } -char *AITown::GetName(TownID town_id) +/* static */ char *AITown::GetName(TownID town_id) { if (!AITown::IsValidTown(town_id)) return NULL; static const int len = 64; @@ -36,14 +36,14 @@ return town_name; } -int32 AITown::GetPopulation(TownID town_id) +/* static */ int32 AITown::GetPopulation(TownID town_id) { if (!AITown::IsValidTown(town_id)) return 0; const Town *t = ::GetTown(town_id); return t->population; } -TileIndex AITown::GetLocation(TownID town_id) +/* static */ TileIndex AITown::GetLocation(TownID town_id) { if (!AITown::IsValidTown(town_id)) return INVALID_TILE; const Town *t = ::GetTown(town_id);