diff options
author | rubidium <rubidium@openttd.org> | 2013-02-14 17:24:55 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2013-02-14 17:24:55 +0000 |
commit | ced17303c2a721560e31fb035fd331be4518e298 (patch) | |
tree | 81ff122d1c26d62c87e5fd3290abda9c8c6bffa0 /src/vehicle_base.h | |
parent | 3d7860e0a5490b0f008a4abca024b94311593fc1 (diff) | |
download | openttd-ced17303c2a721560e31fb035fd331be4518e298.tar.xz |
(svn r24998) -Fix [FS#5137]: Set vehicle's service interval is percent flag appropriately on creation (peter1138)
Diffstat (limited to 'src/vehicle_base.h')
-rw-r--r-- | src/vehicle_base.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/vehicle_base.h b/src/vehicle_base.h index 3343359d5..f0502a218 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -45,6 +45,8 @@ enum VehicleFlags { VF_AUTOFILL_PRES_WAIT_TIME, ///< Whether non-destructive auto-fill should preserve waiting times VF_STOP_LOADING, ///< Don't load anymore during the next load cycle. VF_PATHFINDER_LOST, ///< Vehicle's pathfinder is lost. + VF_SERVINT_IS_CUSTOM, ///< Service interval is custom. + VF_SERVINT_IS_PERCENT, ///< Service interval is percent. }; /** Bit numbers used to indicate which of the #NewGRFCache values are valid. */ @@ -645,16 +647,17 @@ public: void UpdateVisualEffect(bool allow_power_change = true); void ShowVisualEffect() const; - inline uint16 GetServiceInterval() const { return GB(this->service_interval, 0, 16); } - inline void SetServiceInterval(uint16 interval) { SB(this->service_interval, 0, 16, interval); } + inline uint16 GetServiceInterval() const { return this->service_interval; } - inline bool ServiceIntervalIsCustom() const { return HasBit(this->service_interval, 31); } + inline void SetServiceInterval(uint16 interval) { this->service_interval = interval; } - inline bool ServiceIntervalIsPercent() const { return HasBit(this->service_interval, 30); } + inline bool ServiceIntervalIsCustom() const { return HasBit(this->vehicle_flags, VF_SERVINT_IS_CUSTOM); } - inline void SetServiceIntervalIsCustom(bool on) { SB(this->service_interval, 31, 1, on); } + inline bool ServiceIntervalIsPercent() const { return HasBit(this->vehicle_flags, VF_SERVINT_IS_PERCENT); } - inline void SetServiceIntervalIsPercent(bool on) { SB(this->service_interval, 30, 1, on); } + inline void SetServiceIntervalIsCustom(bool on) { SB(this->vehicle_flags, VF_SERVINT_IS_CUSTOM, 1, on); } + + inline void SetServiceIntervalIsPercent(bool on) { SB(this->vehicle_flags, VF_SERVINT_IS_PERCENT, 1, on); } private: /** |