src/ai/api/ai_tilelist_valuator.hpp
author truelight
Wed, 02 May 2007 12:47:16 +0000
branchnoai
changeset 9609 f0dbf5850145
parent 9603 49323bf80ebd
child 9611 5cf58c6571b7
permissions -rw-r--r--
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
[NoAI] -Update: updated squirrel_export to create template-tag for constructors
[NoAI] -Add: added AITileListCargoAcceptance, to get acceptance of a tile
[NoAI] -Update: updated regression to test AITileListCargoAcceptance
/* $Id$ */

/** @file ai_tilelist_valuator.hpp all the valuators for tilelist */

#ifndef AI_TILELIST_VALUATOR_HPP
#define AI_TILELIST_VALUATOR_HPP

#include "ai_abstractlist.hpp"

/**
 * Check if tiles are buildable for entries in an AITileList instance.
 * @note resulting items are of the type bool (0 = not buildable, 1 = buildable)
 * @note the input items are of the type TileIndex
 */
class AITileListBuildable : public AIAbstractList::Valuator {
public:
	/**
	 * The name of the class, needed by several sub-processes.
	 */
	static const char *GetClassName() { return "AITileListBuildable"; }

private:
	int32 Valuate(int32 tile) const;
};

/**
 * Check if one of the neighbour tiles in AITileList has a piece of road.
 * @note resulting items are of the type int32 (the amount of neighbour road tiles)
 * @note the input items are of the type TileIndex
 */
class AITileListNeighbourRoad : public AIAbstractList::Valuator {
public:
	/**
	 * The name of the class, needed by several sub-processes.
	 */
	static const char *GetClassName() { return "AITileListNeighbourRoad"; }

private:
	int32 Valuate(int32 tile) const;
};

/**
 * Check if the tiles in AITileList have a piece of road on them.
 * @note resulting items are of the type bool (0 = no road, 1 = road)
 * @note the input items are of the type TileIndex
 */
class AITileListRoadTile : public AIAbstractList::Valuator {
public:
	/**
	 * The name of the class, needed by several sub-processes.
	 */
	static const char *GetClassName() { return "AITileListRoadTile"; }

private:
	int32 Valuate(int32 tile) const;
};

/**
 * Get the amount of estimated accepted cargo for all tiles in AITileList.
 * If this value is >= 8, it means it will accept this cargo. For passengers
 *  and mail it is also a good indicator how much cargo would be brought to
 *  the station.
 * @post values < 8 means this tile does not accept this cargo.
 * @note resulting items are of the type int32 (indicating acceptance)
 * @note the input items are of the type TileIndex
 */
class AITileListCargoAcceptance : public AIAbstractList::Valuator {
public:
	/**
	 * The name of the class, needed by several sub-processes.
	 */
	static const char *GetClassName() { return "AITileListCargoAcceptance"; }

	/**
	 * Custom constructor, we want a cargo-type as parameter.
	 */
	AITileListCargoAcceptance(CargoID cargo_type) { this->cargo_type = cargo_type; }

private:
	CargoID cargo_type;

	int32 Valuate(int32 tile) const;
};

#endif /* AI_TILELIST_VALUATOR_HPP */