File diff r20077:1122c5c64e88 → r20078:a7a34cf316df
src/order_base.h
Show inline comments
 
@@ -33,25 +33,24 @@ extern OrderListPool _orderlist_pool;
 
 */
 
struct Order : OrderPool::PoolItem<&_order_pool> {
 
private:
 
	friend const struct SaveLoad *GetVehicleDescription(VehicleType vt); ///< Saving and loading the current order of vehicles.
 
	friend void Load_VEHS();                                             ///< Loading of ancient vehicles.
 
	friend const struct SaveLoad *GetOrderDescription();                 ///< Saving and loading of orders.
 

	
 
	uint8 type;           ///< The type of order + non-stop flags
 
	uint8 flags;          ///< Load/unload types, depot order/action types.
 
	DestinationID dest;   ///< The destination of the order.
 

	
 
	CargoID refit_cargo;  ///< Refit CargoID
 
	byte refit_subtype;   ///< Refit subtype
 

	
 
public:
 
	Order *next;          ///< Pointer to next order. If NULL, end of list
 

	
 
	uint16 wait_time;    ///< How long in ticks to wait at the destination.
 
	uint16 travel_time;  ///< How long in ticks the journey to this destination should take.
 
	uint16 max_speed;    ///< How fast the vehicle may go on the way to the destination.
 

	
 
	Order() : refit_cargo(CT_NO_REFIT), max_speed(UINT16_MAX) {}
 
	~Order();
 

	
 
	Order(uint32 packed);
 
@@ -63,25 +62,25 @@ public:
 
	 */
 
	inline bool IsType(OrderType type) const { return this->GetType() == type; }
 

	
 
	/**
 
	 * Get the type of order of this order.
 
	 * @return the order type.
 
	 */
 
	inline OrderType GetType() const { return (OrderType)GB(this->type, 0, 4); }
 

	
 
	void Free();
 

	
 
	void MakeGoToStation(StationID destination);
 
	void MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, OrderNonStopFlags non_stop_type = ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS, OrderDepotActionFlags action = ODATF_SERVICE_ONLY, CargoID cargo = CT_NO_REFIT, byte subtype = 0);
 
	void MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, OrderNonStopFlags non_stop_type = ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS, OrderDepotActionFlags action = ODATF_SERVICE_ONLY, CargoID cargo = CT_NO_REFIT);
 
	void MakeGoToWaypoint(StationID destination);
 
	void MakeLoading(bool ordered);
 
	void MakeLeaveStation();
 
	void MakeDummy();
 
	void MakeConditional(VehicleOrderID order);
 
	void MakeImplicit(StationID destination);
 

	
 
	/**
 
	 * Is this a 'goto' order with a real destination?
 
	 * @return True if the type is either #OT_GOTO_WAYPOINT, #OT_GOTO_DEPOT or #OT_GOTO_STATION.
 
	 */
 
	inline bool IsGotoOrder() const
 
@@ -115,32 +114,25 @@ public:
 
	 * @pre IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION)
 
	 * @return true if a auto-refit should happen.
 
	 */
 
	inline bool IsAutoRefit() const { return this->refit_cargo == CT_AUTO_REFIT; }
 

	
 
	/**
 
	 * Get the cargo to to refit to.
 
	 * @pre IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION)
 
	 * @return the cargo type.
 
	 */
 
	inline CargoID GetRefitCargo() const { return this->refit_cargo; }
 

	
 
	/**
 
	 * Get the cargo subtype to to refit to.
 
	 * @pre IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION)
 
	 * @return the cargo subtype.
 
	 */
 
	inline byte GetRefitSubtype() const { return this->refit_subtype; }
 

	
 
	void SetRefit(CargoID cargo, byte subtype = 0);
 
	void SetRefit(CargoID cargo);
 

	
 
	/** How must the consist be loaded? */
 
	inline OrderLoadFlags GetLoadType() const { return (OrderLoadFlags)GB(this->flags, 4, 4); }
 
	/** How must the consist be unloaded? */
 
	inline OrderUnloadFlags GetUnloadType() const { return (OrderUnloadFlags)GB(this->flags, 0, 4); }
 
	/** At which stations must we stop? */
 
	inline OrderNonStopFlags GetNonStopType() const { return (OrderNonStopFlags)GB(this->type, 6, 2); }
 
	/** Where must we stop at the platform? */
 
	inline OrderStopLocation GetStopLocation() const { return (OrderStopLocation)GB(this->type, 4, 2); }
 
	/** What caused us going to the depot? */
 
	inline OrderDepotTypeFlags GetDepotOrderType() const { return (OrderDepotTypeFlags)GB(this->flags, 0, 4); }
 
	/** What are we going to do when in the depot. */