src/ai/api/ai_cargo.hpp
author truebrain
Mon, 31 Mar 2008 18:33:33 +0000
branchnoai
changeset 9851 a5f5a7cf2b61
parent 9835 2541c2d325ed
child 10196 aecabd927420
permissions -rw-r--r--
(svn r12519) [NoAI] -Add: added AILog with Info(), Warning(), and Error()
[NoAI] -Add: redirect AI outputs to the AI Debug GUI to show it per AI, in a clear way ingame (no more need for stderr viewing)
NOTE: it still does output to stderr, but on an other DEBUG() level (depending on the message).
/* $Id$ */

/** @file ai_cargo.hpp Everything to query cargos. */

#ifndef AI_CARGO_HPP
#define AI_CARGO_HPP

#include "ai_object.hpp"

/**
 * Class that handles all cargo related functions.
 */
class AICargo : public AIObject {
public:
	static const char *GetClassName() { return "AICargo"; }

	/**
	 * Checks whether the given cargo type is valid.
	 * @param cargo_type The cargo to check.
	 * @return True if and only if the cargo type is valid.
	 */
	static bool IsValidCargo(CargoID cargo_type);

	/**
	 * Gets the string representation of the cargo label.
	 * @param cargo_type The cargo to get the string representation of.
	 * @return The cargo label.
	 * @note Never use this to check if it is a certain cargo. NewGRF can
	 *  redefine all of the names.
	 */
	static char *GetCargoLabel(CargoID cargo_type);

	/**
	 * Checks whether the give cargo is a freight or not.
	 * @param cargo_type The cargo to check on.
	 * @return True if and only if the cargo is freight.
	 */
	static bool IsFreight(CargoID cargo_type);

	/**
	 * Get the income for transporting a piece of cargo over the
	 *   given distance within the specified time.
	 * @param cargo_type The cargo to transport.
	 * @param distance The distance the cargo travels from begin to end.
	 * @param days_in_transit Amount of (game) days the cargo is in transit.
	 * @return The amount of money that would be earned by this trip.
	 */
	static int32 GetCargoIncome(CargoID cargo_type, uint32 distance, uint32 days_in_transit);
};

#endif /* AI_CARGO_HPP */