diff options
author | rubidium <rubidium@openttd.org> | 2008-04-06 07:07:21 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-04-06 07:07:21 +0000 |
commit | e68b2088ce090c1eaf182e120195d8453f4f02c2 (patch) | |
tree | 914d1e0005bd1676636f2860ef07b9137d189d14 /src/order_base.h | |
parent | 630d5ad766c8632e9b47aed2de97b4996c9fa216 (diff) | |
download | openttd-e68b2088ce090c1eaf182e120195d8453f4f02c2.tar.xz |
(svn r12586) -Codechange: do not access an order's refit variables directly.
Diffstat (limited to 'src/order_base.h')
-rw-r--r-- | src/order_base.h | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/src/order_base.h b/src/order_base.h index ada3aad37..8acea0069 100644 --- a/src/order_base.h +++ b/src/order_base.h @@ -31,7 +31,10 @@ private: friend Order UnpackOldOrder(uint16 packed); ///< 'Uncompressing' a loaded old order. friend Order UnpackVersion4Order(uint16 packed); ///< 'Uncompressing' a loaded ancient order. - OrderTypeByte type; + OrderTypeByte type; ///< The type of order + + CargoID refit_cargo; ///< Refit CargoID + byte refit_subtype; ///< Refit subtype public: Order *next; ///< Pointer to next order. If NULL, end of list @@ -39,9 +42,6 @@ public: uint8 flags; DestinationID dest; ///< The destionation of the order. - CargoID refit_cargo; // Refit CargoID - byte refit_subtype; // Refit subtype - 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. @@ -83,8 +83,10 @@ public: * Makes this order a Go To Depot order. * @param destination the depot to go to. * @param order is this order a 'default' order, or an overriden vehicle order? + * @param cargo the cargo type to change to. + * @param subtype the subtype to change to. */ - void MakeGoToDepot(DepotID destination, bool order); + void MakeGoToDepot(DepotID destination, bool order, CargoID cargo = CT_NO_REFIT, byte subtype = 0); /** * Makes this order a Go To Waypoint order. @@ -113,6 +115,35 @@ public: */ void FreeChain(); + /** + * Is this order a refit order. + * @pre IsType(OT_GOTO_DEPOT) + * @return true if a refit should happen. + */ + inline bool IsRefit() const { return this->refit_cargo < NUM_CARGO; } + + /** + * Get the cargo to to refit to. + * @pre IsType(OT_GOTO_DEPOT) + * @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) + * @return the cargo subtype. + */ + inline byte GetRefitSubtype() const { return this->refit_subtype; } + + /** + * Make this depot order also a refit order. + * @param cargo the cargo type to change to. + * @param subtype the subtype to change to. + * @pre IsType(OT_GOTO_DEPOT). + */ + void SetRefit(CargoID cargo, byte subtype = 0); + bool ShouldStopAtStation(const Vehicle *v, StationID station) const; /** |