src/ai/api/ai_industrylist_valuator.hpp
author rubidium
Sun, 03 Feb 2008 20:17:54 +0000
branchnoai
changeset 9724 b39bc69bb2f2
parent 9710 ba44f8c1fd52
child 9753 7209db94ad12
permissions -rw-r--r--
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
/* $Id$ */

/** @file ai_industrylist_valuator.hpp all the valuators for industrylist */

#ifndef AI_INDUSTRYLIST_VALUATOR_HPP
#define AI_INDUSTRYLIST_VALUATOR_HPP

#include "ai_abstractlist.hpp"

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

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

private:
	CargoID cargo_type;

	int32 Valuate(int32 industry) const;
};

/**
 * See which entries in the AIIndustryList instance accepts a certain cargo.
 * @note resulting items are of the type bool
 * @note the input items are of the type IndustryID
 */
class AIIndustryListCargoAccepted : public AIAbstractList::Valuator {
public:
	/**
	 * The name of the class, needed by several sub-processes.
	 */
	static const char *GetClassName() { return "AIIndustryListCargoAccepted"; }

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

private:
	CargoID cargo_type;

	int32 Valuate(int32 industry) const;
};

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

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

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

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

private:
	TileIndex tile;

	int32 Valuate(int32 station) const;
};

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

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

private:
	TileIndex tile;

	int32 Valuate(int32 station) const;
};

#endif /* AI_INDUSTRYLIST_VALUATOR_HPP */