@@ -30,7 +30,7 @@
 | 
			
		||||
#include <map>
 | 
			
		||||
#include <vector>
 | 
			
		||||
 | 
			
		||||
CommandCost CmdRefitVehicle(TileIndex, DoCommandFlag, uint32, uint32, const char*);
 | 
			
		||||
CommandCost CmdRefitVehicle(TileIndex, DoCommandFlag, uint32_t, uint32_t, const char*);
 | 
			
		||||
 | 
			
		||||
/** Vehicle status bits in #Vehicle::vehstatus. */
 | 
			
		||||
enum VehStatus {
 | 
			
		||||
@@ -81,12 +81,12 @@ enum NewGRFCacheValidValues {
 | 
			
		||||
/** Cached often queried (NewGRF) values */
 | 
			
		||||
struct NewGRFCache {
 | 
			
		||||
	/* Values calculated when they are requested for the first time after invalidating the NewGRF cache. */
 | 
			
		||||
	uint32 position_consist_length;   ///< Cache for NewGRF var 40.
 | 
			
		||||
	uint32 position_same_id_length;   ///< Cache for NewGRF var 41.
 | 
			
		||||
	uint32 consist_cargo_information; ///< Cache for NewGRF var 42. (Note: The cargotype is untranslated in the cache because the accessing GRF is yet unknown.)
 | 
			
		||||
	uint32 company_information;       ///< Cache for NewGRF var 43.
 | 
			
		||||
	uint32 position_in_vehicle;       ///< Cache for NewGRF var 4D.
 | 
			
		||||
	uint8  cache_valid;               ///< Bitset that indicates which cache values are valid.
 | 
			
		||||
	uint32_t position_consist_length;   ///< Cache for NewGRF var 40.
 | 
			
		||||
	uint32_t position_same_id_length;   ///< Cache for NewGRF var 41.
 | 
			
		||||
	uint32_t consist_cargo_information; ///< Cache for NewGRF var 42. (Note: The cargotype is untranslated in the cache because the accessing GRF is yet unknown.)
 | 
			
		||||
	uint32_t company_information;       ///< Cache for NewGRF var 43.
 | 
			
		||||
	uint32_t position_in_vehicle;       ///< Cache for NewGRF var 4D.
 | 
			
		||||
	uint8_t  cache_valid;               ///< Bitset that indicates which cache values are valid.
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/** Meaning of the various bits of the visual effect. */
 | 
			
		||||
@@ -150,9 +150,9 @@ enum VehicleCacheFlags {
 | 
			
		||||
 | 
			
		||||
/** Cached often queried values common to all vehicles. */
 | 
			
		||||
struct VehicleCache {
 | 
			
		||||
	uint16 cached_max_speed;        ///< Maximum speed of the consist (minimum of the max speed of all vehicles in the consist).
 | 
			
		||||
	uint16 cached_cargo_age_period; ///< Number of ticks before carried cargo is aged.
 | 
			
		||||
	uint16 cached_image_curvature;  ///< Cached neighbour curvature, see: VCF_IMAGE_CURVATURE
 | 
			
		||||
	uint16_t cached_max_speed;        ///< Maximum speed of the consist (minimum of the max speed of all vehicles in the consist).
 | 
			
		||||
	uint16_t cached_cargo_age_period; ///< Number of ticks before carried cargo is aged.
 | 
			
		||||
	uint16_t cached_image_curvature;  ///< Cached neighbour curvature, see: VCF_IMAGE_CURVATURE
 | 
			
		||||
 | 
			
		||||
	byte cached_vis_effect;  ///< Visual effect to show (see #VisualEffect)
 | 
			
		||||
	byte cached_veh_flags;   ///< Vehicle cache flags (see #VehicleCacheFlags)
 | 
			
		||||
@@ -220,10 +220,10 @@ enum PendingSpeedRestrictionChangeFlags {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct PendingSpeedRestrictionChange {
 | 
			
		||||
	uint16 distance;
 | 
			
		||||
	uint16 new_speed;
 | 
			
		||||
	uint16 prev_speed;
 | 
			
		||||
	uint16 flags;
 | 
			
		||||
	uint16_t distance;
 | 
			
		||||
	uint16_t new_speed;
 | 
			
		||||
	uint16_t prev_speed;
 | 
			
		||||
	uint16_t flags;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/** A vehicle pool for a little over 1 million vehicles. */
 | 
			
		||||
@@ -274,8 +274,8 @@ private:
 | 
			
		||||
public:
 | 
			
		||||
	friend SaveLoadTable GetVehicleDescription(VehicleType vt); ///< So we can use private/protected variables in the saveload code
 | 
			
		||||
	friend void FixOldVehicles();
 | 
			
		||||
	friend void AfterLoadVehicles(bool part_of_load);             ///< So we can set the #previous and #first pointers while loading
 | 
			
		||||
	friend bool LoadOldVehicle(LoadgameState *ls, int num);       ///< So we can set the proper next pointer while loading
 | 
			
		||||
	friend void AfterLoadVehicles(bool part_of_load);           ///< So we can set the #previous and #first pointers while loading
 | 
			
		||||
	friend bool LoadOldVehicle(LoadgameState *ls, int num);     ///< So we can set the proper next pointer while loading
 | 
			
		||||
 | 
			
		||||
	friend upstream_sl::SlVehicleCommon;
 | 
			
		||||
	friend upstream_sl::SlVehicleDisaster;
 | 
			
		||||
@@ -299,7 +299,7 @@ public:
 | 
			
		||||
	CargoPayment *cargo_payment;        ///< The cargo payment we're currently in
 | 
			
		||||
 | 
			
		||||
	/* Used for timetabling. */
 | 
			
		||||
	uint32 current_loading_time;        ///< How long loading took. Less than current_order_time if vehicle is early.
 | 
			
		||||
	uint32_t current_loading_time;      ///< How long loading took. Less than current_order_time if vehicle is early.
 | 
			
		||||
 | 
			
		||||
	Rect coord;                         ///< NOSAVE: Graphical bounding box of the vehicle, i.e. what to redraw on moves.
 | 
			
		||||
 | 
			
		||||
@@ -321,16 +321,16 @@ public:
 | 
			
		||||
	DateDelta max_age;                  ///< Maximum age
 | 
			
		||||
	Date date_of_last_service;          ///< Last date the vehicle had a service at a depot.
 | 
			
		||||
	Date date_of_last_service_newgrf;   ///< Last date the vehicle had a service at a depot, unchanged by the date cheat to protect against unsafe NewGRF behavior.
 | 
			
		||||
	uint16 reliability;                 ///< Reliability.
 | 
			
		||||
	uint16 reliability_spd_dec;         ///< Reliability decrease speed.
 | 
			
		||||
	uint16_t reliability;               ///< Reliability.
 | 
			
		||||
	uint16_t reliability_spd_dec;       ///< Reliability decrease speed.
 | 
			
		||||
	byte breakdown_ctr;                 ///< Counter for managing breakdown events. @see Vehicle::HandleBreakdown
 | 
			
		||||
	byte breakdown_delay;               ///< Counter for managing breakdown length.
 | 
			
		||||
	byte breakdowns_since_last_service; ///< Counter for the amount of breakdowns.
 | 
			
		||||
	byte breakdown_chance;              ///< Current chance of breakdowns.
 | 
			
		||||
 | 
			
		||||
	int32 x_pos;                        ///< x coordinate.
 | 
			
		||||
	int32 y_pos;                        ///< y coordinate.
 | 
			
		||||
	int32 z_pos;                        ///< z coordinate.
 | 
			
		||||
	int32_t x_pos;                      ///< x coordinate.
 | 
			
		||||
	int32_t y_pos;                      ///< y coordinate.
 | 
			
		||||
	int32_t z_pos;                      ///< z coordinate.
 | 
			
		||||
	Direction direction;                ///< facing
 | 
			
		||||
 | 
			
		||||
	Owner owner;                        ///< Which company owns the vehicle?
 | 
			
		||||
@@ -345,43 +345,43 @@ public:
 | 
			
		||||
	byte x_extent;                      ///< x-extent of vehicle bounding box
 | 
			
		||||
	byte y_extent;                      ///< y-extent of vehicle bounding box
 | 
			
		||||
	byte z_extent;                      ///< z-extent of vehicle bounding box
 | 
			
		||||
	int8 x_bb_offs;                     ///< x offset of vehicle bounding box
 | 
			
		||||
	int8 y_bb_offs;                     ///< y offset of vehicle bounding box
 | 
			
		||||
	int8 x_offs;                        ///< x offset for vehicle sprite
 | 
			
		||||
	int8 y_offs;                        ///< y offset for vehicle sprite
 | 
			
		||||
	int8_t x_bb_offs;                   ///< x offset of vehicle bounding box
 | 
			
		||||
	int8_t y_bb_offs;                   ///< y offset of vehicle bounding box
 | 
			
		||||
	int8_t x_offs;                      ///< x offset for vehicle sprite
 | 
			
		||||
	int8_t y_offs;                      ///< y offset for vehicle sprite
 | 
			
		||||
	EngineID engine_type;               ///< The type of engine used for this vehicle.
 | 
			
		||||
 | 
			
		||||
	TextEffectID fill_percent_te_id;    ///< a text-effect id to a loading indicator object
 | 
			
		||||
	UnitID unitnumber;                  ///< unit number, for display purposes only
 | 
			
		||||
 | 
			
		||||
	uint16 cur_speed;                   ///< current speed
 | 
			
		||||
	uint16_t cur_speed;                 ///< current speed
 | 
			
		||||
	byte subspeed;                      ///< fractional speed
 | 
			
		||||
	byte acceleration;                  ///< used by train & aircraft
 | 
			
		||||
	uint32 motion_counter;              ///< counter to occasionally play a vehicle sound. (Also used as virtual train client ID).
 | 
			
		||||
	uint32_t motion_counter;            ///< counter to occasionally play a vehicle sound. (Also used as virtual train client ID).
 | 
			
		||||
	byte progress;                      ///< The percentage (if divided by 256) this vehicle already crossed the tile unit.
 | 
			
		||||
 | 
			
		||||
	uint16 random_bits;                 ///< Bits used for randomized variational spritegroups.
 | 
			
		||||
	uint16_t random_bits;               ///< Bits used for randomized variational spritegroups.
 | 
			
		||||
	byte waiting_triggers;              ///< Triggers to be yet matched before rerandomizing the random bits.
 | 
			
		||||
 | 
			
		||||
	StationID last_station_visited;     ///< The last station we stopped at.
 | 
			
		||||
	StationID last_loading_station;     ///< Last station the vehicle has stopped at and could possibly leave from with any cargo loaded. (See VF_LAST_LOAD_ST_SEP).
 | 
			
		||||
	uint64 last_loading_tick;           ///< Last time (relative to _scaled_tick_counter) the vehicle has stopped at a station and could possibly leave with any cargo loaded. (See VF_LAST_LOAD_ST_SEP).
 | 
			
		||||
	uint64_t last_loading_tick;         ///< Last time (relative to _scaled_tick_counter) the vehicle has stopped at a station and could possibly leave with any cargo loaded. (See VF_LAST_LOAD_ST_SEP).
 | 
			
		||||
 | 
			
		||||
	CargoID cargo_type;                 ///< type of cargo this vehicle is carrying
 | 
			
		||||
	byte cargo_subtype;                 ///< Used for livery refits (NewGRF variations)
 | 
			
		||||
	uint16 cargo_cap;                   ///< total capacity
 | 
			
		||||
	uint16 refit_cap;                   ///< Capacity left over from before last refit.
 | 
			
		||||
	uint16_t cargo_cap;                 ///< total capacity
 | 
			
		||||
	uint16_t refit_cap;                 ///< Capacity left over from before last refit.
 | 
			
		||||
	VehicleCargoList cargo;             ///< The cargo this vehicle is carrying
 | 
			
		||||
	uint16 cargo_age_counter;           ///< Ticks till cargo is aged next.
 | 
			
		||||
	int8 trip_occupancy;                ///< NOSAVE: Occupancy of vehicle of the current trip (updated after leaving a station).
 | 
			
		||||
	uint16_t cargo_age_counter;         ///< Ticks till cargo is aged next.
 | 
			
		||||
	int8_t trip_occupancy;              ///< NOSAVE: Occupancy of vehicle of the current trip (updated after leaving a station).
 | 
			
		||||
 | 
			
		||||
	byte day_counter;                   ///< Increased by one for each day
 | 
			
		||||
	byte tick_counter;                  ///< Increased by one for each tick
 | 
			
		||||
	uint16 running_ticks;               ///< Number of ticks this vehicle was not stopped this day
 | 
			
		||||
	uint16_t running_ticks;             ///< Number of ticks this vehicle was not stopped this day
 | 
			
		||||
 | 
			
		||||
	byte vehstatus;                     ///< Status
 | 
			
		||||
 | 
			
		||||
	uint8 order_occupancy_average;      ///< NOSAVE: order occupancy average. 0 = invalid, 1 = n/a, 16-116 = 0-100%
 | 
			
		||||
	uint8_t order_occupancy_average;    ///< NOSAVE: order occupancy average. 0 = invalid, 1 = n/a, 16-116 = 0-100%
 | 
			
		||||
	Order current_order;                ///< The current order (+ status, like: loading)
 | 
			
		||||
 | 
			
		||||
	union {
 | 
			
		||||
@@ -389,7 +389,7 @@ public:
 | 
			
		||||
		Order *old_orders;              ///< Only used during conversion of old save games
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	uint16 load_unload_ticks;           ///< Ticks to wait before starting next cycle.
 | 
			
		||||
	uint16_t load_unload_ticks;         ///< Ticks to wait before starting next cycle.
 | 
			
		||||
	GroupID group_id;                   ///< Index of group Pool array
 | 
			
		||||
	byte subtype;                       ///< subtype (Filled with values from #AircraftSubType/#DisasterSubType/#EffectVehicleType/#GroundVehicleSubtypeFlags)
 | 
			
		||||
	Direction cur_image_valid_dir;      ///< NOSAVE: direction for which cur_image does not need to be regenerated on the next tick
 | 
			
		||||
@@ -401,7 +401,7 @@ public:
 | 
			
		||||
	 * Calculates the weight value that this vehicle will have when fully loaded with its current cargo.
 | 
			
		||||
	 * @return Weight value in tonnes.
 | 
			
		||||
	 */
 | 
			
		||||
	virtual uint16 GetMaxWeight() const
 | 
			
		||||
	virtual uint16_t GetMaxWeight() const
 | 
			
		||||
	{
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
@@ -422,8 +422,8 @@ public:
 | 
			
		||||
	GroundVehicleCache *GetGroundVehicleCache();
 | 
			
		||||
	const GroundVehicleCache *GetGroundVehicleCache() const;
 | 
			
		||||
 | 
			
		||||
	uint16 &GetGroundVehicleFlags();
 | 
			
		||||
	const uint16 &GetGroundVehicleFlags() const;
 | 
			
		||||
	uint16_t &GetGroundVehicleFlags();
 | 
			
		||||
	const uint16_t &GetGroundVehicleFlags() const;
 | 
			
		||||
 | 
			
		||||
	void DeleteUnreachedImplicitOrders();
 | 
			
		||||
 | 
			
		||||
@@ -523,7 +523,7 @@ public:
 | 
			
		||||
	Direction GetMapImageDirection() const { return this->direction; }
 | 
			
		||||
 | 
			
		||||
	const GRFFile *GetGRF() const;
 | 
			
		||||
	uint32 GetGRFID() const;
 | 
			
		||||
	uint32_t GetGRFID() const;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Invalidates cached NewGRF variables
 | 
			
		||||
@@ -852,7 +852,7 @@ public:
 | 
			
		||||
 | 
			
		||||
	void RecalculateOrderOccupancyAverage();
 | 
			
		||||
 | 
			
		||||
	inline uint8 GetOrderOccupancyAverage() const
 | 
			
		||||
	inline uint8_t GetOrderOccupancyAverage() const
 | 
			
		||||
	{
 | 
			
		||||
		if (order_occupancy_average == 0) const_cast<Vehicle *>(this)->RecalculateOrderOccupancyAverage();
 | 
			
		||||
		return this->order_occupancy_average;
 | 
			
		||||
@@ -934,9 +934,9 @@ public:
 | 
			
		||||
	void UpdatePositionAndViewport();
 | 
			
		||||
	void MarkAllViewportsDirty() const;
 | 
			
		||||
 | 
			
		||||
	inline uint16 GetServiceInterval() const { return this->service_interval; }
 | 
			
		||||
	inline uint16_t GetServiceInterval() const { return this->service_interval; }
 | 
			
		||||
 | 
			
		||||
	inline void SetServiceInterval(uint16 interval) { this->service_interval = interval; }
 | 
			
		||||
	inline void SetServiceInterval(uint16_t interval) { this->service_interval = interval; }
 | 
			
		||||
 | 
			
		||||
	inline bool ServiceIntervalIsCustom() const { return HasBit(this->vehicle_flags, VF_SERVINT_IS_CUSTOM); }
 | 
			
		||||
 | 
			
		||||
@@ -1234,8 +1234,8 @@ public:
 | 
			
		||||
	 */
 | 
			
		||||
	IterateWrapper Orders() const { return IterateWrapper(this->orders); }
 | 
			
		||||
 | 
			
		||||
	uint32 GetDisplayMaxWeight() const;
 | 
			
		||||
	uint32 GetDisplayMinPowerToWeight() const;
 | 
			
		||||
	uint32_t GetDisplayMaxWeight() const;
 | 
			
		||||
	uint32_t GetDisplayMinPowerToWeight() const;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
inline bool IsPointInViewportVehicleRedrawArea(const std::vector<Rect> &viewport_redraw_rects, const Point &pt)
 | 
			
		||||
@@ -1394,9 +1394,9 @@ struct SpecializedVehicle : public Vehicle {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	inline uint16 GetVehicleCurvature() const
 | 
			
		||||
	inline uint16_t GetVehicleCurvature() const
 | 
			
		||||
	{
 | 
			
		||||
		uint16 curvature = 0;
 | 
			
		||||
		uint16_t curvature = 0;
 | 
			
		||||
		if (this->Previous() != nullptr) {
 | 
			
		||||
			SB(curvature, 0, 4, this->Previous()->direction);
 | 
			
		||||
			if (this->Previous()->Previous() != nullptr) SB(curvature, 4, 4, this->Previous()->Previous()->direction);
 | 
			
		||||
@@ -1524,7 +1524,7 @@ struct FreeUnitIDGenerator {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/** Sentinel for an invalid coordinate. */
 | 
			
		||||
static const int32 INVALID_COORD = 0x7fffffff;
 | 
			
		||||
static const int32_t INVALID_COORD = 0x7fffffff;
 | 
			
		||||
 | 
			
		||||
inline void InvalidateVehicleTickCaches()
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user