--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ai/api/ai_map.hpp Thu Mar 15 22:28:14 2007 +0000
@@ -0,0 +1,74 @@
+/* $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 DEFINE_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 */