src/ai/api/ai_tilelist.hpp
author truelight
Sun, 15 Apr 2007 10:30:00 +0000
branchnoai
changeset 9600 59cc173953ae
parent 9596 8af5a1399842
child 9751 556f25efbc54
permissions -rw-r--r--
(svn r9634) [NoAI] -Fix: typo in doxygen comment
/* $Id$ */

/** @file ai_tilelist.hpp a simple tilelist which you can manipulate */

#ifndef AI_TILELIST_HPP
#define AI_TILELIST_HPP

#include "ai_abstractlist.hpp"

/**
 * Class that creates a simple list of tiles which you can manipulate.
 */
class AITileList : public AIAbstractList {
public:
	/**
	 * The name of the class, needed by several sub-processes.
	 */
	static const char *GetClassName() { return "AITileList"; }

private:
	/**
	 * Make sure t1.x is smaller than t2.x and t1.y is smaller than t2.y.
	 * They are swapped to ensure they are after calling this function.
	 */
	void FixRectangleSpan(TileIndex &t1, TileIndex &t2);

public:

	/**
	 * Adds the rectangle between tile_from and tile_to to the to-be-evaluated tiles.
	 * @param tile_from one corner of the tiles to add.
	 * @param tile_to the other corner of the tiles to add.
	 * @pre tile_from is below AIMap::GetMapSize().
	 * @pre tile_to is below AIMap::GetMapSize().
	 */
	void AddRectangle(TileIndex tile_from, TileIndex tile_to);

	/**
	 * Add a tile to the to-be-evaluated tiles.
	 * @param tile the tile to add.
	 * @pre tile is below AIMap::GetMapSize().
	 */
	void AddTile(TileIndex tile);

	/**
	 * Remove the tiles inside the rectangle between tile_from and tile_to form the list.
	 * @param tile_from one corner of the tiles to remove.
	 * @param tile_to the other corner of the files to remove.
	 * @pre tile_from is below AIMap::GetMapSize().
	 * @pre tile_to is below AIMap::GetMapSize().
	 */
	void RemoveRectangle(TileIndex tile_from, TileIndex tile_to);

	/**
	 * Remove a tile from the list.
	 * @param tile the tile to remove.
	 * @pre tile is below AIMap::GetMapSize().
	 */
	void RemoveTile(TileIndex tile);
};

#endif /* AI_TILELIST_HPP */