truelight@9592: /* $Id$ */ truelight@9592: truebrain@9778: /** @file ai_tilelist_valuator.hpp all the valuators for AITileList */ truelight@9592: truelight@9592: #ifndef AI_TILELIST_VALUATOR_HPP truelight@9592: #define AI_TILELIST_VALUATOR_HPP truelight@9592: truelight@9593: #include "ai_abstractlist.hpp" truelight@9592: truelight@9592: /** truebrain@9756: * Check if tiles are buildable for entries in an AITileList instance. truebrain@9778: * @note Resulting items are of the type bool (0 = not buildable, 1 = buildable). truebrain@9778: * @note Can only operate on an AITileList instance. truebrain@9778: * @ingroup AITileList truelight@9592: */ truebrain@9753: class AITileList_vBuildable : public AIAbstractList::Valuator { truelight@9592: public: truebrain@9753: static const char *GetClassName() { return "AITileList_vBuildable"; } truelight@9592: truelight@9592: private: truebrain@9772: const char *GetListName() const { return "AITileList"; } truelight@9592: int32 Valuate(int32 tile) const; truelight@9592: }; truelight@9592: truelight@9603: /** truebrain@9756: * Check if tiles are water-tiles for entries in an AITileList instance. truebrain@9778: * @note Resulting items are of the type bool (0 = not water-tile, 1 = water-tile). truebrain@9778: * @note Can only operate on an AITileList instance. truebrain@9778: * @ingroup AITileList truelight@9698: */ truebrain@9753: class AITileList_vWater : public AIAbstractList::Valuator { truelight@9698: public: truebrain@9753: static const char *GetClassName() { return "AITileList_vWater"; } truelight@9698: truelight@9698: private: truebrain@9772: const char *GetListName() const { return "AITileList"; } truelight@9698: int32 Valuate(int32 tile) const; truelight@9698: }; truelight@9698: truelight@9698: /** truebrain@9756: * Check if tiles are buildable in a rectangle around entries in an AITileList instance, with the entry in the list as top-left. truebrain@9778: * @note Resulting items are of the type bool (0 = not buildable, 1 = buildable). truebrain@9778: * @note Can only operate on an AITileList instance. truebrain@9778: * @ingroup AITileList truelight@9657: */ truebrain@9753: class AITileList_vBuildableRectangle : public AIAbstractList::Valuator { truelight@9657: public: truebrain@9753: static const char *GetClassName() { return "AITileList_vBuildableRectangle"; } truelight@9657: truelight@9669: /** truebrain@9778: * @param width The width of the rectangle. truebrain@9778: * @param height The height of the rectangle. truelight@9669: */ truebrain@9778: AITileList_vBuildableRectangle(uint width, uint height) : truebrain@9778: width(width), truebrain@9778: height(height) truebrain@9778: {} truelight@9657: truelight@9657: private: truelight@9657: uint width, height; truelight@9657: truebrain@9772: const char *GetListName() const { return "AITileList"; } truelight@9657: int32 Valuate(int32 tile) const; truelight@9657: }; truelight@9657: truelight@9657: /** truebrain@9756: * Check how tiles in an AITileList instance are sloped. truebrain@9778: * @note Resulting items are of the type int32 (0 = flat, > 1 = slope). truebrain@9778: * @note Can only operate on an AITileList instance. truebrain@9778: * @ingroup AITileList truelight@9611: */ truebrain@9753: class AITileList_vSlope : public AIAbstractList::Valuator { truelight@9611: public: truebrain@9753: static const char *GetClassName() { return "AITileList_vSlope"; } truelight@9700: truelight@9700: private: truebrain@9772: const char *GetListName() const { return "AITileList"; } truelight@9700: int32 Valuate(int32 tile) const; truelight@9700: }; truelight@9700: truelight@9700: /** truebrain@9756: * Check the height of the tiles in an AITileList instance. truebrain@9778: * @note Resulting items are of the type int32 (height, ranging from 0 to 15). truebrain@9778: * @note Can only operate on an AITileList instance. truebrain@9778: * @ingroup AITileList truelight@9603: */ truebrain@9753: class AITileList_vHeight : public AIAbstractList::Valuator { truelight@9603: public: truebrain@9753: static const char *GetClassName() { return "AITileList_vHeight"; } truelight@9603: truelight@9603: private: truebrain@9772: const char *GetListName() const { return "AITileList"; } truelight@9603: int32 Valuate(int32 tile) const; truelight@9603: }; truelight@9603: truelight@9603: /** truebrain@9756: * Count for each entry in AITileList the amount of neighbours that contain road. truebrain@9753: * This is a value between 0 and 4, as it only check horizontal and vertical. truebrain@9778: * @note Resulting items are of the type int32 (the amount of neighbour road tiles, value between 0 and 4). truebrain@9778: * @note Can only operate on an AITileList instance. truebrain@9778: * @ingroup AITileList truelight@9603: */ truebrain@9753: class AITileList_vNeighbourRoadCount : public AIAbstractList::Valuator { truelight@9603: public: truebrain@9753: static const char *GetClassName() { return "AITileList_vNeighbourRoad"; } truelight@9603: truelight@9603: private: truebrain@9772: const char *GetListName() const { return "AITileList"; } truelight@9603: int32 Valuate(int32 tile) const; truelight@9603: }; truelight@9603: truelight@9609: /** truebrain@9756: * Check if the tiles in AITileList have a piece of road on them. truebrain@9778: * @note Resulting items are of the type bool (0 = no road, 1 = road). truebrain@9778: * @note Can only operate on an AITileList instance. truebrain@9778: * @ingroup AITileList truebrain@9753: */ truebrain@9753: class AITileList_vRoadTile : public AIAbstractList::Valuator { truebrain@9753: public: truebrain@9753: static const char *GetClassName() { return "AITileList_vRoadTile"; } truebrain@9753: truebrain@9753: private: truebrain@9772: const char *GetListName() const { return "AITileList"; } truebrain@9753: int32 Valuate(int32 tile) const; truebrain@9753: }; truebrain@9753: truebrain@9753: /** truebrain@9771: * Get the amount of estimated accepted cargo for all tiles in AITileList. truelight@9609: * If this value is >= 8, it means it will accept this cargo. For passengers truelight@9609: * and mail it is also a good indicator how much cargo would be brought to truelight@9609: * the station. truebrain@9778: * @post Values < 8 means this tile does not accept this cargo. truebrain@9778: * @note Resulting items are of the type int32 (indicating acceptance). truebrain@9778: * @note Can only operate on an AITileList instance. truebrain@9778: * @ingroup AITileList truelight@9609: */ truebrain@9753: class AITileList_vCargoAcceptance : public AIAbstractList::Valuator { truelight@9609: public: truebrain@9753: static const char *GetClassName() { return "AITileList_vCargoAcceptance"; } truelight@9609: truelight@9609: /** truebrain@9778: * @param cargo_id The cargo to check the acceptance for. truebrain@9778: * @param width The width of your station. truebrain@9778: * @param height The height of your station. truebrain@9778: * @param radius The radius of your station-type. truelight@9609: */ truebrain@9778: AITileList_vCargoAcceptance(CargoID cargo_id, uint width, uint height, uint radius) : truebrain@9778: cargo_id(cargo_id), truebrain@9778: width(width), truebrain@9778: height(height), truebrain@9778: radius(radius) truebrain@9778: {} truelight@9609: truelight@9609: private: truebrain@9778: CargoID cargo_id; truelight@9658: uint width, height, radius; truelight@9609: truebrain@9772: const char *GetListName() const { return "AITileList"; } truelight@9609: int32 Valuate(int32 tile) const; truelight@9609: }; truelight@9609: truelight@9655: /** truebrain@9771: * Get the amount of tiles producing cargo for all tiles in AITileList. truebrain@9771: * This counts the tiles that produce this cargo. It doesn't give any truebrain@9771: * indication about the amount it will be producing. truebrain@9778: * @note Town(houses) are not included in the value. truebrain@9778: * @note Resulting items are of the type int32 (indicating tiles of production). truebrain@9778: * @note Can only operate on an AITileList instance. truebrain@9778: * @ingroup AITileList truebrain@9771: */ truebrain@9771: class AITileList_vCargoProduction : public AIAbstractList::Valuator { truebrain@9771: public: truebrain@9771: static const char *GetClassName() { return "AITileList_vCargoProduction"; } truebrain@9771: truebrain@9771: /** truebrain@9778: * @param cargo_id The cargo to check the production for. truebrain@9778: * @param width The width of your station. truebrain@9778: * @param height The height of your station. truebrain@9778: * @param radius The radius of your station-type. truebrain@9771: */ truebrain@9778: AITileList_vCargoProduction(CargoID cargo_id, uint width, uint height, uint radius) : truebrain@9778: cargo_id(cargo_id), truebrain@9778: width(width), truebrain@9778: height(height), truebrain@9778: radius(radius) truebrain@9778: {} truebrain@9771: truebrain@9771: private: truebrain@9778: CargoID cargo_id; truebrain@9771: uint width, height, radius; truebrain@9771: truebrain@9772: const char *GetListName() const { return "AITileList"; } truebrain@9771: int32 Valuate(int32 tile) const; truebrain@9771: }; truebrain@9771: truebrain@9771: /** truebrain@9756: * Get the manhattan distance to a tile for entries in an AITileList instance. truebrain@9778: * @note Resulting items are of the type uint32. truebrain@9778: * @note Can only operate on an AITileList instance. truebrain@9778: * @ingroup AITileList truelight@9655: */ truebrain@9753: class AITileList_vDistanceManhattanToTile : public AIAbstractList::Valuator { truelight@9655: public: truebrain@9753: static const char *GetClassName() { return "AITileList_vDistanceManhattanToTile"; } truelight@9655: truelight@9655: /** truebrain@9778: * @param tile The tile to get the distance to. truelight@9655: */ truebrain@9778: AITileList_vDistanceManhattanToTile(TileIndex tile) : truebrain@9778: tile(tile) truebrain@9778: {} truelight@9655: truelight@9655: private: truelight@9655: TileIndex tile; truelight@9655: truebrain@9772: const char *GetListName() const { return "AITileList"; } truelight@9655: int32 Valuate(int32 station) const; truelight@9655: }; truelight@9655: truelight@9655: /** truebrain@9781: * Get the square distance to a tile for entries in an AITileList instance. truebrain@9778: * @note Resulting items are of the type uint32. truebrain@9778: * @note Can only operate on an AITileList instance. truebrain@9778: * @ingroup AITileList truelight@9655: */ truebrain@9753: class AITileList_vDistanceSquareToTile : public AIAbstractList::Valuator { truelight@9655: public: truebrain@9753: static const char *GetClassName() { return "AITileList_vDistanceSquareToTile"; } truelight@9655: truelight@9655: /** truebrain@9778: * @param tile The tile to get the distance to. truelight@9655: */ truebrain@9778: AITileList_vDistanceSquareToTile(TileIndex tile) : truebrain@9778: tile(tile) truebrain@9778: {} truelight@9655: truelight@9655: private: truelight@9655: TileIndex tile; truelight@9655: truebrain@9772: const char *GetListName() const { return "AITileList"; } truelight@9655: int32 Valuate(int32 station) const; truelight@9655: }; truelight@9655: truelight@9655: truelight@9592: #endif /* AI_TILELIST_VALUATOR_HPP */