(svn r12242) [NoAI] -Add: added AITileList_Industry(Accepting|Producing), giving tiles on which you want to build a station for an industry
/* $Id$ */
/** @file ai_tilelist.hpp a simple tilelist which you can manipulate */
#ifndef AI_TILELIST_HPP
#define AI_TILELIST_HPP
#include "ai_abstractlist.hpp"
#include "../../industry.h"
/**
* Class that creates a simple empty 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);
};
/**
* Class that creates a list of tiles that will accept cargo for the given
* industry.
* @note If a simular industry is close, it might happen that this industry
* receives the cargo.
*/
class AITileList_IndustryAccepting : public AITileList {
public:
/**
* The name of the class, needed by several sub-processes.
*/
static const char *GetClassName() { return "AITileList_IndustryAccepting"; }
/**
* The constructor to make a list of tiles that will accept cargo for the
* given industry.
*/
AITileList_IndustryAccepting(IndustryID industry_id, uint radius);
};
/**
* Class that creates a list of tiles which the industry checks to see if a
* station is there to receive cargo produced by this industry.
*/
class AITileList_IndustryProducing : public AITileList {
public:
/**
* The name of the class, needed by several sub-processes.
*/
static const char *GetClassName() { return "AITileList_IndustryProducing"; }
/**
* The constructor to make a list of tiles which the industry checks to see
* if a station is there to receive cargo produced by this industry.
*/
AITileList_IndustryProducing(IndustryID industry_id, uint radius);
};
#endif /* AI_TILELIST_HPP */