src/ai/core/ai_map.hpp
author truelight
Thu, 15 Mar 2007 19:33:07 +0000
branchnoai
changeset 9422 33efcc5f1b09
parent 9404 ef9e171617a3
child 9425 8eec6d10844a
permissions -rw-r--r--
(svn r9223) [NoAI] -Change: moved squirrel/engine.cpp to squirrel.cpp in root
-Change: renamed SquirrelEngine to Squirrel
/* $Id$ */

/** @file ai_map.hpp Everything to query map metadata */

#ifndef AI_MAP_HPP
#define AI_MAP_HPP

#include "ai_object.hpp"

class AIMap : public AIObject {
public:
	/**
	 * Checks whether the given tile is valid
	 * @param t the tile to check
	 * @return true is the tile it within the boundaries of the map
	 */
	bool IsValidTile(TileIndex t);

	/**
	 * Gets the number of tiles in the map
	 * @return the size of the map in tiles
	 * @post return > 0
	 */
	TileIndex GetMapSize();

	/**
	 * Gets the amount of tiles along the SW and NE border
	 * @return the length along the SW and NE borders
	 * @post return > 0
	 */
	uint32 GetMapSizeX();

	/**
	 * Gets the amount of tiles along the SE and NW border
	 * @return the length along the SE and NW borders
	 * @post return > 0
	 */
	uint32 GetMapSizeY();

	/**
	 * Gets the X (place along the SW/NE border)
	 * @param t the tile to get the X of
	 * @pre this->IsValidTile(t)
	 * @return the x-position
	 * @post return <= this->GetMapSizeX()
	 */
	uint32 GetTileX(TileIndex t);

	/**
	 * Gets the Y (place along the SE/NW border)
	 * @param t the tile to get the Y of
	 * @pre this->IsValidTile(t)
	 * @return the y-position
	 * @post return <= this->GetMapSizeY()
	 */
	uint32 GetTileY(TileIndex t);
};

#ifdef SQUIRREL_CLASS
void SQAIMapRegister(Squirrel *engine) {
	DefSQClass <AIMap> SQAIMap("AIMap");
	SQAIMap.PreRegister(engine);
	SQAIMap.AddConstructor(engine);
	SQAIMap.DefSQFunction(engine, &AIMap::IsValidTile, "IsValidTile");
	SQAIMap.DefSQFunction(engine, &AIMap::GetMapSize,  "GetMapSize");
	SQAIMap.DefSQFunction(engine, &AIMap::GetMapSizeX, "GetMapSizeX");
	SQAIMap.DefSQFunction(engine, &AIMap::GetMapSizeY, "GetMapSizeY");
	SQAIMap.DefSQFunction(engine, &AIMap::GetTileX,    "GetTileX");
	SQAIMap.DefSQFunction(engine, &AIMap::GetTileY,    "GetTileY");
	SQAIMap.PostRegister(engine);
}
#endif /* SQUIRREL_CLASS */

#endif /* AI_MAP_HPP */