truelight@9711: /* $Id$ */ truelight@9711: truebrain@9829: /** @file ai_engine.hpp Everything to query and build engines. */ truelight@9711: truelight@9711: #ifndef AI_ENGINE_HPP truelight@9711: #define AI_ENGINE_HPP truelight@9711: truelight@9711: #include "ai_object.hpp" truelight@9711: #include "ai_vehicle.hpp" truelight@9711: truelight@9711: /** truelight@9711: * Class that handles all engine related functions. truelight@9711: */ truelight@9711: class AIEngine : public AIObject { truelight@9711: public: truelight@9711: static const char *GetClassName() { return "AIEngine"; } truelight@9711: truelight@9711: /** truelight@9711: * Checks whether the given engine type is valid and buildable by you. truebrain@9836: * @param engine_id The engine to check. truebrain@9836: * @return True if and only if the engine type is valid. truelight@9711: */ truelight@9711: static bool IsValidEngine(EngineID engine_id); truelight@9711: truelight@9711: /** truelight@9713: * Get the name of an engine. truebrain@9836: * @param engine_id The engine to get the name of. truelight@9713: * @pre IsValidEngine(engine_id). truebrain@9836: * @return The name the engine has. truelight@9713: */ truelight@9713: static char *GetName(EngineID engine_id); truelight@9713: truelight@9713: /** truelight@9713: * Get the cargo-type of an engine. In case it can transport 2 cargos, it truelight@9713: * returns the first. truebrain@9836: * @param engine_id The engine to get the cargo-type of. truelight@9713: * @pre IsValidEngine(engine_id). truebrain@9836: * @return The cargo-type of the engine. truelight@9713: */ truelight@9713: static CargoID GetCargoType(EngineID engine_id); truelight@9713: truelight@9713: /** truebrain@9809: * Check if the cargo of an engine can be refitted to your requested. If truebrain@9809: * the engine already allows this cargo, the function also returns true. truebrain@9836: * @param engine_id The engine to check for refitting. truebrain@9836: * @param cargo_id The cargo to check for refitting. truebrain@9809: * @pre IsValidEngine(engine_id). truebrain@9809: * @pre AICargo::IsValidCargo(cargo_id). truebrain@9809: * @return True if the engine can carry this cargo, either via refit, or truebrain@9809: * by default. truebrain@9809: */ truebrain@9809: static bool CanRefitCargo(EngineID engine_id, CargoID cargo_id); truebrain@9809: truebrain@9809: /** truelight@9713: * Get the capacity of an engine. In case it can transport 2 cargos, it truelight@9713: * returns the first. truebrain@9836: * @param engine_id The engine to get the capacity of. truelight@9713: * @pre IsValidEngine(engine_id). truebrain@9836: * @return The capacity of the engine. truelight@9713: */ truelight@9713: static uint32 GetCapacity(EngineID engine_id); truelight@9713: truelight@9713: /** truelight@9713: * Get the reliability of an engine. The value is between 0 and 100, where truelight@9713: * 100 means 100% reliability (never breaks down) and 0 means 0% truelight@9713: * reliability (you most likely don't want to buy it). truebrain@9836: * @param engine_id The engine to get the reliability of. truelight@9713: * @pre IsValidEngine(engine_id). truebrain@9836: * @return The reliability the engine has. truelight@9713: */ truelight@9713: static uint32 GetReliability(EngineID engine_id); truelight@9713: truelight@9713: /** truebrain@9836: * Get the maximum speed of an engine (in km/h). truebrain@9836: * @param engine_id The engine to get the maximum speed of. truelight@9713: * @pre IsValidEngine(engine_id). truebrain@9836: * @return The maximum speed the engine has. truelight@9713: */ truelight@9713: static uint32 GetMaxSpeed(EngineID engine_id); truelight@9713: truelight@9713: /** truelight@9713: * Get the new cost of an engine. truebrain@9836: * @param engine_id The engine to get the new cost of. truelight@9713: * @pre IsValidEngine(engine_id). truebrain@9836: * @return The new cost the engine has. truelight@9713: */ truelight@9713: static uint32 GetPrice(EngineID engine_id); truelight@9713: truelight@9713: /** truebrain@9836: * Get the maximum age of a brand new engine. truebrain@9836: * @param engine_id The engine to get the maximum age of. truebrain@9733: * @pre IsValidEngine(engine_id). truebrain@9836: * @returns The maximum age of a new engine in days. truebrain@9842: * @note Age is in days; divide by 366 to get per year. truebrain@9733: */ truebrain@9733: static uint32 GetMaxAge(EngineID engine_id); truebrain@9733: truebrain@9733: /** truebrain@9733: * Get the running cost of an engine. truebrain@9836: * @param engine_id The engine to get the running cost of. truebrain@9733: * @pre IsValidEngine(engine_id). truebrain@9733: * @return The running cost of a vehicle per year. truebrain@9842: * @note Cost is per year; divide by 364 to get per day. truebrain@9733: */ truebrain@9733: static Money GetRunningCost(EngineID engine_id); truebrain@9733: truebrain@9733: /** truelight@9713: * Get the type of an engine. truebrain@9836: * @param engine_id The engine to get the type of. truelight@9713: * @pre IsValidEngine(engine_id). truebrain@9836: * @return The type the engine has. truelight@9713: */ truelight@9713: static AIVehicle::VehicleType GetVehicleType(EngineID engine_id); truelight@9711: }; truelight@9711: truelight@9711: #endif /* AI_ENGINE_HPP */