src/ai/api/ai_cargolist_valuator.hpp
branchnoai
changeset 9788 e9dbd4ec1784
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ai/api/ai_cargolist_valuator.hpp	Tue Feb 26 23:47:37 2008 +0000
@@ -0,0 +1,51 @@
+/** @file ai_cargolist_valuator.hpp all the valuators for AICargoList */
+
+#ifndef AI_CARGOLIST_VALUATOR_HPP
+#define AI_CARGOLIST_VALUATOR_HPP
+
+#include "ai_abstractlist.hpp"
+
+
+/**
+ * Checks if the given cargo is freight cargo, for all entries in an AICargoList.
+ * @note Resulting items are of the type uint32.
+ * @note Can only operate on a AICargoList.
+ * @ingroup AICargoList.
+ */
+class AICargoList_vIsFreight : public AIAbstractList::Valuator {
+public:
+	static const char *GetClassName() { return "AICargoList_vIsFreight"; }
+
+private:
+	const char *GetListName() const { return "AICargoList"; }
+	int32 Valuate(int32 cargo) const;
+};
+
+/**
+ * Get the income for transporting one unit of cargo over the given distance
+ *  within the specified time.
+ * @note Resulting items are of the type uint32.
+ * @note Can only operate on a AICargoList.
+ * @ingroup AICargoList.
+ */
+class AICargoList_vCargoIncomes : public AIAbstractList::Valuator {
+public:
+	static const char *GetClassName() { return "AICargoList_vCargoIncomes"; }
+
+	/**
+	 * @param distance The distance the cargo travels from begin to end.
+	 * @param days_in_transit Amount of (game)days the cargo is in transit.
+	 */
+	AICargoList_vCargoIncomes(uint32 distance, uint32 days_in_transit) :
+		distance(distance),
+		days_in_transit(days_in_transit)
+	{}
+
+private:
+	uint32 distance, days_in_transit;
+
+	const char *GetListName() const { return "AICargoList"; }
+	int32 Valuate(int32 cargo) const;
+};
+
+#endif // AI_CARGOLIST_VALUATOR_HPP