src/order_base.h
changeset 8843 45fdf630deaa
parent 8840 332412c2e9c1
child 8845 f9ef3bb70e47
equal deleted inserted replaced
8842:ed3fb21d71c6 8843:45fdf630deaa
    34 	byte refit_subtype;   ///< Refit subtype
    34 	byte refit_subtype;   ///< Refit subtype
    35 
    35 
    36 public:
    36 public:
    37 	Order *next;          ///< Pointer to next order. If NULL, end of list
    37 	Order *next;          ///< Pointer to next order. If NULL, end of list
    38 
    38 
    39 	uint8  flags;
    39 	uint8 flags;          ///< 'Sub'type of order
    40 
    40 
    41 	uint16 wait_time;    ///< How long in ticks to wait at the destination.
    41 	uint16 wait_time;    ///< How long in ticks to wait at the destination.
    42 	uint16 travel_time;  ///< How long in ticks the journey to this destination should take.
    42 	uint16 travel_time;  ///< How long in ticks the journey to this destination should take.
    43 
    43 
    44 	Order() : refit_cargo(CT_NO_REFIT) {}
    44 	Order() : refit_cargo(CT_NO_REFIT) {}
    96 	 */
    96 	 */
    97 	void MakeGoToWaypoint(WaypointID destination);
    97 	void MakeGoToWaypoint(WaypointID destination);
    98 
    98 
    99 	/**
    99 	/**
   100 	 * Makes this order a Loading order.
   100 	 * Makes this order a Loading order.
   101 	 */
   101 	 * @param ordered is this an ordered stop?
   102 	void MakeLoading();
   102 	 */
       
   103 	void MakeLoading(bool ordered);
   103 
   104 
   104 	/**
   105 	/**
   105 	 * Makes this order a Leave Station order.
   106 	 * Makes this order a Leave Station order.
   106 	 */
   107 	 */
   107 	void MakeLeaveStation();
   108 	void MakeLeaveStation();
   157 	 * @param cargo   the cargo type to change to.
   158 	 * @param cargo   the cargo type to change to.
   158 	 * @param subtype the subtype to change to.
   159 	 * @param subtype the subtype to change to.
   159 	 * @pre IsType(OT_GOTO_DEPOT).
   160 	 * @pre IsType(OT_GOTO_DEPOT).
   160 	 */
   161 	 */
   161 	void SetRefit(CargoID cargo, byte subtype = 0);
   162 	void SetRefit(CargoID cargo, byte subtype = 0);
       
   163 
       
   164 	/** How must the consist be loaded? */
       
   165 	inline byte GetLoadType() const { return this->flags & OFB_FULL_LOAD; }
       
   166 	/** How must the consist be unloaded? */
       
   167 	inline byte GetUnloadType() const { return GB(this->flags, 0, 2); }
       
   168 	/** Where must we stop? */
       
   169 	inline byte GetNonStopType() const { return this->flags & OFB_NON_STOP; }
       
   170 	/** What caused us going to the depot? */
       
   171 	inline byte GetDepotOrderType() const { return this->flags; }
       
   172 	/** What are we going to do when in the depot. */
       
   173 	inline byte GetDepotActionType() const { return this->flags; }
       
   174 
       
   175 	/** Set how the consist must be loaded. */
       
   176 	inline void SetLoadType(byte load_type) { SB(this->flags, 2, 1, !!load_type); }
       
   177 	/** Set how the consist must be unloaded. */
       
   178 	inline void SetUnloadType(byte unload_type) { SB(this->flags, 0, 2, unload_type); }
       
   179 	/** Set whether we must stop at stations or not. */
       
   180 	inline void SetNonStopType(byte non_stop_type) { SB(this->flags, 3, 1, !!non_stop_type); }
       
   181 	/** Set the cause to go to the depot. */
       
   182 	inline void SetDepotOrderType(byte depot_order_type) { this->flags = depot_order_type; }
       
   183 	/** Set what we are going to do in the depot. */
       
   184 	inline void SetDepotActionType(byte depot_service_type) { this->flags = depot_service_type; }
   162 
   185 
   163 	bool ShouldStopAtStation(const Vehicle *v, StationID station) const;
   186 	bool ShouldStopAtStation(const Vehicle *v, StationID station) const;
   164 
   187 
   165 	/**
   188 	/**
   166 	 * Assign the given order to this one.
   189 	 * Assign the given order to this one.