truelight@9592: /* $Id$ */ truelight@9592: truelight@9592: /** @file ai_tilelist.hpp a simple tilelist which you can manipulate */ truelight@9592: truelight@9592: #ifndef AI_TILELIST_HPP truelight@9592: #define AI_TILELIST_HPP truelight@9592: truelight@9593: #include "ai_abstractlist.hpp" truelight@9592: truelight@9592: /** truelight@9592: * Class that creates a simple list of tiles which you can manipulate. truelight@9592: */ truelight@9593: class AITileList : public AIAbstractList { truelight@9592: public: truelight@9592: /** truelight@9592: * The name of the class, needed by several sub-processes. truelight@9592: */ truelight@9592: static const char *GetClassName() { return "AITileList"; } truelight@9592: truelight@9592: private: truelight@9592: /** truelight@9592: * Make sure t1.x is smaller than t2.x and t1.y is smaller than t2.y. truelight@9592: * They are swapped to ensure they are after calling this function. truelight@9592: */ truelight@9592: void FixRectangleSpan(TileIndex &t1, TileIndex &t2); truelight@9592: truelight@9592: public: truelight@9592: truelight@9592: /** truelight@9592: * Adds the rectangle between tile_from and tile_to to the to-be-evaluated tiles. truelight@9592: * @param tile_from one corner of the tiles to add. truelight@9592: * @param tile_to the other corner of the tiles to add. truelight@9592: * @pre tile_from is below AIMap::GetMapSize(). truelight@9592: * @pre tile_to is below AIMap::GetMapSize(). truelight@9592: */ truelight@9592: void AddRectangle(TileIndex tile_from, TileIndex tile_to); truelight@9592: truelight@9592: /** truelight@9592: * Add a tile to the to-be-evaluated tiles. truelight@9592: * @param tile the tile to add. truelight@9592: * @pre tile is below AIMap::GetMapSize(). truelight@9592: */ truelight@9592: void AddTile(TileIndex tile); truelight@9592: truelight@9592: /** truelight@9592: * Remove the tiles inside the rectangle between tile_from and tile_to form the list. truelight@9600: * @param tile_from one corner of the tiles to remove. truelight@9592: * @param tile_to the other corner of the files to remove. truelight@9592: * @pre tile_from is below AIMap::GetMapSize(). truelight@9592: * @pre tile_to is below AIMap::GetMapSize(). truelight@9592: */ truelight@9592: void RemoveRectangle(TileIndex tile_from, TileIndex tile_to); truelight@9592: truelight@9592: /** truelight@9592: * Remove a tile from the list. truelight@9592: * @param tile the tile to remove. truelight@9592: * @pre tile is below AIMap::GetMapSize(). truelight@9592: */ truelight@9592: void RemoveTile(TileIndex tile); truelight@9592: }; truelight@9592: truelight@9592: #endif /* AI_TILELIST_HPP */