src/ai/api/ai_stationlist_valuator.hpp
author truelight
Fri, 19 Oct 2007 14:03:27 +0000
branchnoai
changeset 9714 fdbdae7ea647
parent 9655 e8e43f333832
child 9753 7209db94ad12
permissions -rw-r--r--
(svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
/* $Id$ */

/** @file ai_stationlist_valuator.hpp all the valuators for stationlist */

#ifndef AI_STATIONLIST_VALUATOR_HPP
#define AI_STATIONLIST_VALUATOR_HPP

#include "ai_abstractlist.hpp"

/**
 * Get the location for entries in an AIStationList instance.
 * @note resulting items are of the type TileIndex
 * @note the input items are of the type StationID
 */
class AIStationListLocation : public AIAbstractList::Valuator {
public:
	/**
	 * The name of the class, needed by several sub-processes.
	 */
	static const char *GetClassName() { return "AIStationListGetLocation"; }

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

/**
 * Get the cargo waiting for entries in an AIStationList instance.
 * @note resulting items are of the type units
 * @note the input items are of the type StationID
 */
class AIStationListCargoWaiting : public AIAbstractList::Valuator {
public:
	/**
	 * The name of the class, needed by several sub-processes.
	 */
	static const char *GetClassName() { return "AIStationListCargoWaiting"; }

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

private:
	CargoID cargo_type;

	int32 Valuate(int32 station) const;
};

/**
 * Get the cargo rating for entries in an AIStationList instance.
 * @note resulting items are of the type percent
 * @note the input items are of the type StationID
 */
class AIStationListCargoRating : public AIAbstractList::Valuator {
public:
	/**
	 * The name of the class, needed by several sub-processes.
	 */
	static const char *GetClassName() { return "AIStationListCargoRating"; }

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

private:
	CargoID cargo_type;

	int32 Valuate(int32 station) const;
};

/**
 * Get the manhattan distance to a tile for entries in an AIStationList instance.
 * @note resulting items are of the type distance
 * @note the input items are of the type StationID
 */
class AIStationListDistanceManhattanToTile : public AIAbstractList::Valuator {
public:
	/**
	 * The name of the class, needed by several sub-processes.
	 */
	static const char *GetClassName() { return "AIStationListDistanceManhattanToTile"; }

	/**
	 * Custom constructor, we want a tile as parameter.
	 */
	AIStationListDistanceManhattanToTile(TileIndex tile) { this->tile = tile; }

private:
	TileIndex tile;

	int32 Valuate(int32 station) const;
};

/**
 * Get the sqsuare distance to a tile for entries in an AIStationList instance.
 * @note resulting items are of the type distance
 * @note the input items are of the type StationID
 */
class AIStationListDistanceSquareToTile : public AIAbstractList::Valuator {
public:
	/**
	 * The name of the class, needed by several sub-processes.
	 */
	static const char *GetClassName() { return "AIStationListDistanceSquareToTile"; }

	/**
	 * Custom constructor, we want a tile as parameter.
	 */
	AIStationListDistanceSquareToTile(TileIndex tile) { this->tile = tile; }

private:
	TileIndex tile;

	int32 Valuate(int32 station) const;
};

#endif /* AI_STATIONLIST_VALUATOR_HPP */