src/ai/api/ai_vehicle.hpp
branchnoai
changeset 9737 ee408edf3851
parent 9733 49e424cd4edd
child 9829 80fbe02a4184
equal deleted inserted replaced
9736:183b38e0a480 9737:ee408edf3851
    50 	 *   0 is returned if it was successful; any other value indicates failure.
    50 	 *   0 is returned if it was successful; any other value indicates failure.
    51 	 * @note in test-mode it means you can't assign orders yet to this vehicle,
    51 	 * @note in test-mode it means you can't assign orders yet to this vehicle,
    52 	 *   as the vehicle isn't really built yet. Build it for real first before
    52 	 *   as the vehicle isn't really built yet. Build it for real first before
    53 	 *   assigning orders.
    53 	 *   assigning orders.
    54 	 */
    54 	 */
    55 	VehicleID BuildVehicle(TileIndex depot, EngineID engine_id);
    55 	static VehicleID BuildVehicle(TileIndex depot, EngineID engine_id);
    56 
    56 
    57 	/**
    57 	/**
    58 	 * Clones a vehicle at the given depot, copying or cloning it's orders.
    58 	 * Clones a vehicle at the given depot, copying or cloning it's orders.
    59 	 * @param depot        the depot where the vehicle will be build.
    59 	 * @param depot        the depot where the vehicle will be build.
    60 	 * @param vehicle_id   the vehicle to use as example for the new vehicle.
    60 	 * @param vehicle_id   the vehicle to use as example for the new vehicle.
    63 	 * @pre IsValidVehicle(vehicle_id).
    63 	 * @pre IsValidVehicle(vehicle_id).
    64 	 * @return the VehicleID of the new vehicle, or an invalid VehicleID when
    64 	 * @return the VehicleID of the new vehicle, or an invalid VehicleID when
    65 	 *   it failed. Check the return value using IsValidVehicle. In test-mode
    65 	 *   it failed. Check the return value using IsValidVehicle. In test-mode
    66 	 *   0 is returned if it was successful; any other value indicates failure.
    66 	 *   0 is returned if it was successful; any other value indicates failure.
    67 	 */
    67 	 */
    68 	VehicleID CloneVehicle(TileIndex depot, VehicleID vehicle_id, bool share_orders);
    68 	static VehicleID CloneVehicle(TileIndex depot, VehicleID vehicle_id, bool share_orders);
    69 
    69 
    70 	/**
    70 	/**
    71 	 * Refits a vehicle to the given cargo type
    71 	 * Refits a vehicle to the given cargo type
    72 	 * @param vehicle_id the vehicle to refit
    72 	 * @param vehicle_id the vehicle to refit
    73 	 * @param cargo      the cargo to refit to
    73 	 * @param cargo      the cargo to refit to
    75 	 * @pre AICargo::IsValidCargo(cargo)
    75 	 * @pre AICargo::IsValidCargo(cargo)
    76 	 * @pre you must own the vehicle
    76 	 * @pre you must own the vehicle
    77 	 * @pre the vehicle must be stopped in the depot
    77 	 * @pre the vehicle must be stopped in the depot
    78 	 * @return true if and only if the refit succeeded.
    78 	 * @return true if and only if the refit succeeded.
    79 	 */
    79 	 */
    80 	bool RefitVehicle(VehicleID vehicle_id, CargoID cargo);
    80 	static bool RefitVehicle(VehicleID vehicle_id, CargoID cargo);
    81 
    81 
    82 	/**
    82 	/**
    83 	 * Sells the given vehicle.
    83 	 * Sells the given vehicle.
    84 	 * @param vehicle_id the vehicle to sell.
    84 	 * @param vehicle_id the vehicle to sell.
    85 	 * @pre IsValidVehicle(vehicle_id).
    85 	 * @pre IsValidVehicle(vehicle_id).
    86 	 * @pre you must own the vehicle
    86 	 * @pre you must own the vehicle
    87 	 * @pre the vehicle must be stopped in the depot
    87 	 * @pre the vehicle must be stopped in the depot
    88 	 * @return true if and only if the vehicle has been sold.
    88 	 * @return true if and only if the vehicle has been sold.
    89 	 */
    89 	 */
    90 	bool SellVehicle(VehicleID vehicle_id);
    90 	static bool SellVehicle(VehicleID vehicle_id);
    91 
    91 
    92 	/**
    92 	/**
    93 	 * Sends the given vehicle to a depot.
    93 	 * Sends the given vehicle to a depot.
    94 	 * @param vehicle_id the vehicle to send to a depot.
    94 	 * @param vehicle_id the vehicle to send to a depot.
    95 	 * @pre IsValidVehicle(vehicle_id).
    95 	 * @pre IsValidVehicle(vehicle_id).
    96 	 * @return true if and only if the vehicle has been sent to a depot.
    96 	 * @return true if and only if the vehicle has been sent to a depot.
    97 	 */
    97 	 */
    98 	bool SendVehicleToDepot(VehicleID vehicle_id);
    98 	static bool SendVehicleToDepot(VehicleID vehicle_id);
    99 
    99 
   100 	/**
   100 	/**
   101 	 * Check if a vehicle is in a depot.
   101 	 * Check if a vehicle is in a depot.
   102 	 * @param vehicle_id the vehicle to check.
   102 	 * @param vehicle_id the vehicle to check.
   103 	 * @pre isValidVehicle(vehicle_id).
   103 	 * @pre isValidVehicle(vehicle_id).
   104 	 * @return true if and only if the vehicle is in a depot.
   104 	 * @return true if and only if the vehicle is in a depot.
   105 	 */
   105 	 */
   106 	bool IsInDepot(VehicleID vehicle_id);
   106 	static bool IsInDepot(VehicleID vehicle_id);
   107 
   107 
   108 	/**
   108 	/**
   109 	 * Check if a vehicle is in a depot and stopped.
   109 	 * Check if a vehicle is in a depot and stopped.
   110 	 * @param vehicle_id the vehicle to check.
   110 	 * @param vehicle_id the vehicle to check.
   111 	 * @pre isValidVehicle(vehicle_id).
   111 	 * @pre isValidVehicle(vehicle_id).
   112 	 * @return true if and only if the vehicle is in a depot and stopped.
   112 	 * @return true if and only if the vehicle is in a depot and stopped.
   113 	 */
   113 	 */
   114 	bool IsStoppedInDepot(VehicleID vehicle_id);
   114 	static bool IsStoppedInDepot(VehicleID vehicle_id);
   115 
   115 
   116 	/**
   116 	/**
   117 	 * Starts or stops the given vehicle depending on the current state.
   117 	 * Starts or stops the given vehicle depending on the current state.
   118 	 * @param vehicle_id the vehicle to start/stop.
   118 	 * @param vehicle_id the vehicle to start/stop.
   119 	 * @pre IsValidVehicle(vehicle_id).
   119 	 * @pre IsValidVehicle(vehicle_id).
   120 	 * @return true if and only if the vehicle has been started or stopped.
   120 	 * @return true if and only if the vehicle has been started or stopped.
   121 	 */
   121 	 */
   122 	bool StartStopVehicle(VehicleID vehicle_id);
   122 	static bool StartStopVehicle(VehicleID vehicle_id);
   123 
   123 
   124 	/**
   124 	/**
   125 	 * Skips the current order of the given vehicle.
   125 	 * Skips the current order of the given vehicle.
   126 	 * @param vehicle_id the vehicle to skip the order for.
   126 	 * @param vehicle_id the vehicle to skip the order for.
   127 	 * @param order_id the selected order to which we want to skip.
   127 	 * @param order_id the selected order to which we want to skip.
   128 	 * @pre IsValidVehicleOrder(vehicle_id, order_id).
   128 	 * @pre IsValidVehicleOrder(vehicle_id, order_id).
   129 	 * @return true if and only if the order has been skipped.
   129 	 * @return true if and only if the order has been skipped.
   130 	 */
   130 	 */
   131 	bool SkipToVehicleOrder(VehicleID vehicle_id, uint32 order_id);
   131 	static bool SkipToVehicleOrder(VehicleID vehicle_id, uint32 order_id);
   132 
   132 
   133 	/**
   133 	/**
   134 	 * Set the name of a vehicle.
   134 	 * Set the name of a vehicle.
   135 	 * @param vehicle_id the vehicle to set the name for.
   135 	 * @param vehicle_id the vehicle to set the name for.
   136 	 * @param name the name for the vehicle.
   136 	 * @param name the name for the vehicle.
   137 	 * @pre IsValidVehicle(vehicle_id).
   137 	 * @pre IsValidVehicle(vehicle_id).
   138 	 * @pre Name has to be unique.
   138 	 * @pre Name has to be unique.
   139 	 * @pre You have to own the vehicle.
   139 	 * @pre You have to own the vehicle.
   140 	 * @return true if and only if the name was changed.
   140 	 * @return true if and only if the name was changed.
   141 	 */
   141 	 */
   142 	bool SetName(VehicleID vehicle_id, const char *name);
   142 	static bool SetName(VehicleID vehicle_id, const char *name);
   143 
   143 
   144 	/**
   144 	/**
   145 	 * Get the current location of a vehicle.
   145 	 * Get the current location of a vehicle.
   146 	 * @param vehicle_id the vehicle to get the location of.
   146 	 * @param vehicle_id the vehicle to get the location of.
   147 	 * @pre IsValidVehicle(vehicle_id).
   147 	 * @pre IsValidVehicle(vehicle_id).
   232 	 * @param vehicle_id the vehicle to get the type of.
   232 	 * @param vehicle_id the vehicle to get the type of.
   233 	 * @pre IsValidVehicle(vehicle_id).
   233 	 * @pre IsValidVehicle(vehicle_id).
   234 	 * @return the vehicle type.
   234 	 * @return the vehicle type.
   235 	 */
   235 	 */
   236 	static AIVehicle::VehicleType GetVehicleType(VehicleID vehicle_id);
   236 	static AIVehicle::VehicleType GetVehicleType(VehicleID vehicle_id);
       
   237 
   237 };
   238 };
   238 
   239 
   239 #endif /* AI_VEHICLE_HPP */
   240 #endif /* AI_VEHICLE_HPP */