src/ai/api/ai_vehicle.hpp
author truelight
Tue, 24 Jul 2007 21:09:39 +0000
branchnoai
changeset 9691 1231d4e5f5aa
parent 9685 d988aad9fc52
child 9699 e1b5f29cc6f9
permissions -rw-r--r--
(svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
[NoAI] -Change [API Change]: renamed FindBestAircraftVehicle to FindBestAirVehicle for naming consistency
9491
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
     1
/* $Id$ */
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
     2
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
     3
/** @file ai_vehicle.hpp Everything to query and build vehicles */
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
     4
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
     5
#ifndef AI_VEHICLE_HPP
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
     6
#define AI_VEHICLE_HPP
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
     7
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
     8
#include "ai_object.hpp"
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9615
diff changeset
     9
#include "../../vehicle.h"
9491
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    10
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    11
/**
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    12
 * Class that handles all vehicle related functions.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    13
 */
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    14
class AIVehicle : public AIObject {
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    15
public:
9685
d988aad9fc52 (svn r10634) [NoAI] -Documentation: of course I forgot to document the VehicleType enum
truelight
parents: 9684
diff changeset
    16
	/**
d988aad9fc52 (svn r10634) [NoAI] -Documentation: of course I forgot to document the VehicleType enum
truelight
parents: 9684
diff changeset
    17
	 * The type of a vehicle available in the game. Trams for example are
d988aad9fc52 (svn r10634) [NoAI] -Documentation: of course I forgot to document the VehicleType enum
truelight
parents: 9684
diff changeset
    18
	 *  road vehicles, as maglev is a rail vehicle.
d988aad9fc52 (svn r10634) [NoAI] -Documentation: of course I forgot to document the VehicleType enum
truelight
parents: 9684
diff changeset
    19
	 */
9684
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
    20
	enum VehicleType {
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
    21
		/* Order IS important, as it now matches the internal state of the game for vehicle type */
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
    22
		VEHICLE_RAIL,
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
    23
		VEHICLE_ROAD,
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
    24
		VEHICLE_WATER,
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
    25
		VEHICLE_AIR,
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
    26
		VEHICLE_INVALID = 0xFF,
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
    27
	};
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
    28
9491
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    29
	/**
9529
5f26f4bc574b (svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents: 9526
diff changeset
    30
	 * The name of the class, needed by several sub-processes.
5f26f4bc574b (svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents: 9526
diff changeset
    31
	 */
5f26f4bc574b (svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents: 9526
diff changeset
    32
	static const char *GetClassName() { return "AIVehicle"; }
5f26f4bc574b (svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents: 9526
diff changeset
    33
5f26f4bc574b (svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents: 9526
diff changeset
    34
	/**
9491
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    35
	 * Checks whether the given engine type is valid and buildable by you.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    36
	 * @param engine_id the engine to check.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    37
	 * @return true if and only if the engine type is valid.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    38
	 */
9497
f6678533ccba (svn r9369) [NoAI] -Codechange: make some IsValidXXX() function static, so they can be used by the other classes without the need for an instance.
rubidium
parents: 9491
diff changeset
    39
	static bool IsValidEngine(EngineID engine_id);
9491
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    40
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    41
	/**
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    42
	 * Checks whether the given vehicle is valid and owned by you.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    43
	 * @param vehicle_id the vehicle to check.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    44
	 * @return true if and only if the vehicle is valid.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    45
	 */
9497
f6678533ccba (svn r9369) [NoAI] -Codechange: make some IsValidXXX() function static, so they can be used by the other classes without the need for an instance.
rubidium
parents: 9491
diff changeset
    46
	static bool IsValidVehicle(VehicleID vehicle_id);
9491
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    47
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    48
	/**
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    49
	 * Find the best road vehicle for this job, given a minimum reliability.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    50
	 * @param cargo           the cargo the vehicle has to transport.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    51
	 * @param min_reliability the minimum reliability of the vehicle,
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    52
	 *   between 0 and 100.
9672
18c71ca987e4 (svn r10611) [NoAI] -Fix: improved FindBestXXX, it now finds the fastest, biggest vehicle available
truelight
parents: 9654
diff changeset
    53
	 * @param max_cost        the maximum cost for the vehicle.
9491
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    54
	 * @pre AICargo::IsValidCargo(cargo).
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    55
	 * @pre min_reliability is between 0 and 100.
9522
f6c7f9f213c5 (svn r9442) [NoAI] -Documentation: do not reference any non-exported INVALID_* in the AI API documentation.
rubidium
parents: 9520
diff changeset
    56
	 * @return the engine with the best characteristics, or an invalid engine
f6c7f9f213c5 (svn r9442) [NoAI] -Documentation: do not reference any non-exported INVALID_* in the AI API documentation.
rubidium
parents: 9520
diff changeset
    57
	 *   when no engine was found given the cargo and reliability. Check the
f6c7f9f213c5 (svn r9442) [NoAI] -Documentation: do not reference any non-exported INVALID_* in the AI API documentation.
rubidium
parents: 9520
diff changeset
    58
	 *   return value using IsValidEngine.
9491
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    59
	 */
9672
18c71ca987e4 (svn r10611) [NoAI] -Fix: improved FindBestXXX, it now finds the fastest, biggest vehicle available
truelight
parents: 9654
diff changeset
    60
	EngineID FindBestRoadVehicle(CargoID cargo, uint8 min_reliability, uint max_cost);
9491
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    61
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    62
	/**
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9615
diff changeset
    63
	 * Find the best aircraft for this job, given a minimum reliability.
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9615
diff changeset
    64
	 * @param cargo           the cargo the vehicle has to transport.
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9615
diff changeset
    65
	 * @param min_reliability the minimum reliability of the vehicle,
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9615
diff changeset
    66
	 *   between 0 and 100.
9672
18c71ca987e4 (svn r10611) [NoAI] -Fix: improved FindBestXXX, it now finds the fastest, biggest vehicle available
truelight
parents: 9654
diff changeset
    67
	 * @param max_cost        the maximum cost for the vehicle.
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9615
diff changeset
    68
	 * @pre AICargo::IsValidCargo(cargo).
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9615
diff changeset
    69
	 * @pre min_reliability is between 0 and 100.
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9615
diff changeset
    70
	 * @return the engine with the best characteristics, or an invalid engine
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9615
diff changeset
    71
	 *   when no engine was found given the cargo and reliability. Check the
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9615
diff changeset
    72
	 *   return value using IsValidEngine.
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9615
diff changeset
    73
	 */
9691
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9685
diff changeset
    74
	EngineID FindBestAirVehicle(CargoID cargo, uint8 min_reliability, uint max_cost);
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9685
diff changeset
    75
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9685
diff changeset
    76
	/**
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9685
diff changeset
    77
	 * Find the best ship for this job, given a minimum reliability.
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9685
diff changeset
    78
	 * @param cargo           the cargo the vehicle has to transport.
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9685
diff changeset
    79
	 * @param min_reliability the minimum reliability of the vehicle,
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9685
diff changeset
    80
	 *   between 0 and 100.
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9685
diff changeset
    81
	 * @param max_cost        the maximum cost for the vehicle.
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9685
diff changeset
    82
	 * @pre AICargo::IsValidCargo(cargo).
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9685
diff changeset
    83
	 * @pre min_reliability is between 0 and 100.
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9685
diff changeset
    84
	 * @return the engine with the best characteristics, or an invalid engine
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9685
diff changeset
    85
	 *   when no engine was found given the cargo and reliability. Check the
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9685
diff changeset
    86
	 *   return value using IsValidEngine.
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9685
diff changeset
    87
	 */
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9685
diff changeset
    88
	EngineID FindBestWaterVehicle(CargoID cargo, uint8 min_reliability, uint max_cost);
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9615
diff changeset
    89
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9615
diff changeset
    90
	/**
9491
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    91
	 * Builds a vehicle with the given engine at the given depot.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    92
	 * @param depot     the depot where the vehicle will be build.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    93
	 * @param engine_id the engine to use for this vehicle.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    94
	 * @pre the tile at depot has a depot that can build the engine and
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    95
	 *   is owned by you.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    96
	 * @pre IsValidEngine(engine_id).
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
    97
	 * @return the VehicleID of the new vehicle, or an invalid VehicleID when
9562
2f4087d63527 (svn r9500) [NoAI] -Add: document behavoir in test-mode
truelight
parents: 9559
diff changeset
    98
	 *   it failed. Check the return value using IsValidVehicle. In test-mode
2f4087d63527 (svn r9500) [NoAI] -Add: document behavoir in test-mode
truelight
parents: 9559
diff changeset
    99
	 *   0 is returned if it was successful; any other value indicates failure.
9563
2c0a7ea15d4c (svn r9501) [NoAI] -Add: document that you can't assign orders to a vehicle build in test-mode
truelight
parents: 9562
diff changeset
   100
	 * @note in test-mode it means you can't assign orders yet to this vehicle,
2c0a7ea15d4c (svn r9501) [NoAI] -Add: document that you can't assign orders to a vehicle build in test-mode
truelight
parents: 9562
diff changeset
   101
	 *   as the vehicle isn't really built yet. Build it for real first before
2c0a7ea15d4c (svn r9501) [NoAI] -Add: document that you can't assign orders to a vehicle build in test-mode
truelight
parents: 9562
diff changeset
   102
	 *   assigning orders.
9491
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   103
	 */
9550
31e558ce0c04 (svn r9487) [NoAI] -Fix: BuildVehicle had as param vehicle_id in .hpp, which of course should be engine_id
truelight
parents: 9541
diff changeset
   104
	VehicleID BuildVehicle(TileIndex depot, EngineID engine_id);
9491
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   105
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   106
	/**
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   107
	 * Clones a vehicle at the given depot, copying or cloning it's orders.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   108
	 * @param depot        the depot where the vehicle will be build.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   109
	 * @param vehicle_id   the vehicle to use as example for the new vehicle.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   110
	 * @param share_orders should the orders be copied or shared?
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   111
	 * @pre the tile at depot has a depot.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   112
	 * @pre IsValidVehicle(vehicle_id).
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   113
	 * @return the VehicleID of the new vehicle, or an invalid VehicleID when
9562
2f4087d63527 (svn r9500) [NoAI] -Add: document behavoir in test-mode
truelight
parents: 9559
diff changeset
   114
	 *   it failed. Check the return value using IsValidVehicle. In test-mode
2f4087d63527 (svn r9500) [NoAI] -Add: document behavoir in test-mode
truelight
parents: 9559
diff changeset
   115
	 *   0 is returned if it was successful; any other value indicates failure.
9491
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   116
	 */
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   117
	VehicleID CloneVehicle(TileIndex depot, VehicleID vehicle_id, bool share_orders);
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   118
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   119
	/**
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   120
	 * Refits a vehicle to the given cargo type
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   121
	 * @param vehicle_id the vehicle to refit
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   122
	 * @param cargo      the cargo to refit to
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   123
	 * @pre IsValidVehicle(vehicle_id).
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   124
	 * @pre AICargo::IsValidCargo(cargo)
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   125
	 * @pre you must own the vehicle
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   126
	 * @pre the vehicle must be stopped in the depot
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   127
	 * @return true if and only if the refit succeeded.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   128
	 */
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   129
	bool RefitVehicle(VehicleID vehicle_id, CargoID cargo);
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   130
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   131
	/**
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   132
	 * Sells the given vehicle.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   133
	 * @param vehicle_id the vehicle to sell.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   134
	 * @pre IsValidVehicle(vehicle_id).
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   135
	 * @pre you must own the vehicle
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   136
	 * @pre the vehicle must be stopped in the depot
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   137
	 * @return true if and only if the vehicle has been sold.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   138
	 */
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   139
	bool SellVehicle(VehicleID vehicle_id);
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   140
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   141
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   142
	/**
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   143
	 * Sends the given vehicle to a depot.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   144
	 * @param vehicle_id the vehicle to send to a depot.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   145
	 * @pre IsValidVehicle(vehicle_id).
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   146
	 * @return true if and only if the vehicle has been sent to a depot.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   147
	 */
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   148
	bool SendVehicleToDepot(VehicleID vehicle_id);
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   149
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   150
	/**
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   151
	 * Starts or stops the given vehicle depending on the current state.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   152
	 * @param vehicle_id the vehicle to start/stop.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   153
	 * @pre IsValidVehicle(vehicle_id).
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   154
	 * @return true if and only if the vehicle has been started or stopped.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   155
	 */
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   156
	bool StartStopVehicle(VehicleID vehicle_id);
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   157
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   158
	/**
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   159
	 * Skips the current order of the given vehicle.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   160
	 * @param vehicle_id the vehicle to skip the order for.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   161
	 * @pre IsValidVehicle(vehicle_id).
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   162
	 * @return true if and only if the order has been skipped.
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   163
	 */
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   164
	bool SkipVehicleOrder(VehicleID vehicle_id);
9615
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   165
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   166
	/**
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   167
	 * Get the current location of a vehicle.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   168
	 * @param vehicle_id the vehicle to get the location of.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   169
	 * @pre IsValidVehicle(vehicle_id).
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   170
	 * @return the tile the vehicle is currently on.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   171
	 */
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   172
	static TileIndex GetLocation(VehicleID vehicle_id);
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   173
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   174
	/**
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   175
	 * Get the engine-type of a vehicle.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   176
	 * @param vehicle_id the vehicle to get the engine-type of.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   177
	 * @pre IsValidVehicle(vehicle_id).
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   178
	 * @return the engine type the vehicle has.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   179
	 */
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   180
	static EngineID GetEngineType(VehicleID vehicle_id);
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   181
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   182
	/**
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   183
	 * Get the unitnumber of a vehicle.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   184
	 * @param vehicle_id the vehicle to get the unitnumber of.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   185
	 * @pre IsValidVehicle(vehicle_id).
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   186
	 * @return the unitnumber the vehicle has.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   187
	 */
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   188
	static int32 GetUnitNumber(VehicleID vehicle_id);
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   189
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   190
	/**
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   191
	 * Get the current age of a vehicle.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   192
	 * @note age is in days.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   193
	 * @param vehicle_id the vehicle to get the age of.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   194
	 * @pre IsValidVehicle(vehicle_id).
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   195
	 * @return the current age the vehicle has.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   196
	 */
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   197
	static int32 GetAge(VehicleID vehicle_id);
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   198
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   199
	/**
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   200
	 * Get the max age of a vehicle.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   201
	 * @note age is in days.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   202
	 * @param vehicle_id the vehicle to get the age of.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   203
	 * @pre IsValidVehicle(vehicle_id).
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   204
	 * @return the max age the vehicle has.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   205
	 */
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   206
	static int32 GetMaxAge(VehicleID vehicle_id);
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   207
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   208
	/**
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   209
	 * Get the age a vehicle has left (max - current).
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   210
	 * @note age is in days.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   211
	 * @param vehicle_id the vehicle to get the age of.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   212
	 * @pre IsValidVehicle(vehicle_id).
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   213
	 * @return the age the vehicle has left.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   214
	 */
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   215
	static int32 GetAgeLeft(VehicleID vehicle_id);
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   216
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   217
	/**
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   218
	 * Get the current profit of a vehicle.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   219
	 * @param vehicle_id the vehicle to get the profit of.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   220
	 * @pre IsValidVehicle(vehicle_id).
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   221
	 * @return the current profit the vehicle has.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   222
	 */
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   223
	static int32 GetProfitThisYear(VehicleID vehicle_id);
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   224
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   225
	/**
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   226
	 * Get the profit of last year of a vehicle.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   227
	 * @param vehicle_id the vehicle to get the profit of.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   228
	 * @pre IsValidVehicle(vehicle_id).
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   229
	 * @return the profit the vehicle had last year.
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   230
	 */
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9596
diff changeset
   231
	static int32 GetProfitLastYear(VehicleID vehicle_id);
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9615
diff changeset
   232
9684
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
   233
	/**
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
   234
	 * Get the type of vehicle.
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
   235
	 * @param vehicle_id the vehicle to get the type of.
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
   236
	 * @pre IsValidVehicle(vehicle_id).
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
   237
	 * @return the vehicle type.
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
   238
	 */
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
   239
	static AIVehicle::VehicleType GetVehicleType(VehicleID vehicle_id);
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
   240
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9615
diff changeset
   241
private:
9684
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9672
diff changeset
   242
	EngineID FindBestVehicle(CargoID cargo, uint8 min_reliability, AIVehicle::VehicleType veh_type, uint max_cost);
9491
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   243
};
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   244
351239ad524c (svn r9361) [NoAI] -Add: some function to find, build and sell road vehicles.
rubidium
parents:
diff changeset
   245
#endif /* AI_VEHICLE_HPP */