rubidium@9379: /* $Id$ */ rubidium@9379: truelight@9388: /** @file ai_map.hpp Everything to query map metadata */ rubidium@9379: rubidium@9379: #ifndef AI_MAP_HPP rubidium@9379: #define AI_MAP_HPP rubidium@9379: rubidium@9379: #include "ai_object.hpp" rubidium@9379: rubidium@9379: class AIMap : public AIObject { rubidium@9379: public: rubidium@9379: /** rubidium@9379: * Checks whether the given tile is valid rubidium@9379: * @param t the tile to check rubidium@9379: * @return true is the tile it within the boundaries of the map rubidium@9379: */ rubidium@9379: bool IsValidTile(TileIndex t); rubidium@9379: rubidium@9379: /** rubidium@9379: * Gets the number of tiles in the map rubidium@9379: * @return the size of the map in tiles rubidium@9379: * @post return > 0 rubidium@9379: */ rubidium@9379: TileIndex GetMapSize(); rubidium@9379: rubidium@9379: /** rubidium@9379: * Gets the amount of tiles along the SW and NE border rubidium@9379: * @return the length along the SW and NE borders rubidium@9379: * @post return > 0 rubidium@9379: */ rubidium@9379: uint32 GetMapSizeX(); rubidium@9379: rubidium@9379: /** rubidium@9379: * Gets the amount of tiles along the SE and NW border rubidium@9379: * @return the length along the SE and NW borders rubidium@9379: * @post return > 0 rubidium@9379: */ rubidium@9379: uint32 GetMapSizeY(); rubidium@9379: rubidium@9379: /** rubidium@9379: * Gets the X (place along the SW/NE border) rubidium@9379: * @param t the tile to get the X of rubidium@9379: * @pre this->IsValidTile(t) rubidium@9379: * @return the x-position rubidium@9379: * @post return <= this->GetMapSizeX() rubidium@9379: */ rubidium@9379: uint32 GetTileX(TileIndex t); rubidium@9379: rubidium@9379: /** rubidium@9379: * Gets the Y (place along the SE/NW border) rubidium@9379: * @param t the tile to get the Y of rubidium@9379: * @pre this->IsValidTile(t) rubidium@9379: * @return the y-position rubidium@9379: * @post return <= this->GetMapSizeY() rubidium@9379: */ rubidium@9379: uint32 GetTileY(TileIndex t); rubidium@9379: }; rubidium@9379: truelight@9387: #ifdef SQUIRREL_CLASS truelight@9397: void SQAIMapRegister(SquirrelEngine *engine) { truelight@9387: DefSQClass SQAIMap("AIMap"); truelight@9397: SQAIMap.PreRegister(engine); truelight@9404: SQAIMap.AddConstructor(engine); truelight@9397: SQAIMap.DefSQFunction(engine, &AIMap::IsValidTile, "IsValidTile"); truelight@9397: SQAIMap.DefSQFunction(engine, &AIMap::GetMapSize, "GetMapSize"); truelight@9397: SQAIMap.DefSQFunction(engine, &AIMap::GetMapSizeX, "GetMapSizeX"); truelight@9397: SQAIMap.DefSQFunction(engine, &AIMap::GetMapSizeY, "GetMapSizeY"); truelight@9397: SQAIMap.DefSQFunction(engine, &AIMap::GetTileX, "GetTileX"); truelight@9397: SQAIMap.DefSQFunction(engine, &AIMap::GetTileY, "GetTileY"); truelight@9397: SQAIMap.PostRegister(engine); truelight@9387: } truelight@9387: #endif /* SQUIRREL_CLASS */ truelight@9387: rubidium@9379: #endif /* AI_MAP_HPP */