src/ai/api/ai_engine.hpp
author truebrain
Wed, 26 Mar 2008 15:17:40 +0000
branchnoai
changeset 9823 0b7f816cf46f
parent 9809 9b21c21052fa
child 9829 80fbe02a4184
permissions -rw-r--r--
(svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
/* $Id$ */

/** @file ai_engine.hpp Everything to query and build engines */

#ifndef AI_ENGINE_HPP
#define AI_ENGINE_HPP

#include "ai_object.hpp"
#include "ai_vehicle.hpp"

/**
 * Class that handles all engine related functions.
 */
class AIEngine : public AIObject {
public:
	/**
	 * The name of the class, needed by several sub-processes.
	 */
	static const char *GetClassName() { return "AIEngine"; }

	/**
	 * Checks whether the given engine type is valid and buildable by you.
	 * @param engine_id the engine to check.
	 * @return true if and only if the engine type is valid.
	 */
	static bool IsValidEngine(EngineID engine_id);

	/**
	 * Get the name of an engine.
	 * @param engine_id the engine to get the name of.
	 * @pre IsValidEngine(engine_id).
	 * @return the name the engine has.
	 */
	static char *GetName(EngineID engine_id);

	/**
	 * Get the cargo-type of an engine. In case it can transport 2 cargos, it
	 *  returns the first.
	 * @param engine_id the engine to get the cargo-type of.
	 * @pre IsValidEngine(engine_id).
	 * @return the cargo-type of the engine.
	 */
	static CargoID GetCargoType(EngineID engine_id);

	/**
	 * Check if the cargo of an engine can be refitted to your requested. If
	 *  the engine already allows this cargo, the function also returns true.
	 * @param engine_id the engine to check for refitting.
	 * @param cargo_id the cargo to check for refitting.
	 * @pre IsValidEngine(engine_id).
	 * @pre AICargo::IsValidCargo(cargo_id).
	 * @return True if the engine can carry this cargo, either via refit, or
	 *  by default.
	 */
	static bool CanRefitCargo(EngineID engine_id, CargoID cargo_id);

	/**
	 * Get the capacity of an engine. In case it can transport 2 cargos, it
	 *  returns the first.
	 * @param engine_id the engine to get the capacity of.
	 * @pre IsValidEngine(engine_id).
	 * @return the capacity of the engine.
	 */
	static uint32 GetCapacity(EngineID engine_id);

	/**
	 * Get the reliability of an engine. The value is between 0 and 100, where
	 *  100 means 100% reliability (never breaks down) and 0 means 0%
	 *  reliability (you most likely don't want to buy it).
	 * @param engine_id the engine to get the reliability of.
	 * @pre IsValidEngine(engine_id).
	 * @return the reliability the engine has.
	 */
	static uint32 GetReliability(EngineID engine_id);

	/**
	 * Get the max speed of an engine (in km/h).
	 * @param engine_id the engine to get the max speed of.
	 * @pre IsValidEngine(engine_id).
	 * @return the max speed the engine has.
	 */
	static uint32 GetMaxSpeed(EngineID engine_id);

	/**
	 * Get the new cost of an engine.
	 * @param engine_id the engine to get the new cost of.
	 * @pre IsValidEngine(engine_id).
	 * @return the new cost the engine has.
	 */
	static uint32 GetPrice(EngineID engine_id);

	/**
	 * Get the max age of a brand new engine.
	 * @note age is in days; divide by 366 to get per year.
	 * @param engine_id the engine to get the max age of.
	 * @pre IsValidEngine(engine_id).
	 * @returns The max age of a new engine in days.
	 */
	static uint32 GetMaxAge(EngineID engine_id);

	/**
	 * Get the running cost of an engine.
	 * @note cost is per year; divide by 364 to get per day.
	 * @param engine_id the engine to get the running cost of.
	 * @pre IsValidEngine(engine_id).
	 * @return The running cost of a vehicle per year.
	 */
	static Money GetRunningCost(EngineID engine_id);

	/**
	 * Get the type of an engine.
	 * @param engine_id the engine to get the type of.
	 * @pre IsValidEngine(engine_id).
	 * @return the type the engine has.
	 */
	static AIVehicle::VehicleType GetVehicleType(EngineID engine_id);
};

#endif /* AI_ENGINE_HPP */