File diff r10489:56d60b4765b1 → r10490:36e425ea6fc5
src/vehicle_base.h
Show inline comments
 
@@ -191,50 +191,48 @@ struct VehicleShip {
 

	
 
DECLARE_OLD_POOL(Vehicle, Vehicle, 9, 125)
 

	
 
/* Some declarations of functions, so we can make them friendly */
 
struct SaveLoad;
 
extern const SaveLoad *GetVehicleDescription(VehicleType vt);
 
extern void AfterLoadVehicles(bool clear_te_id);
 
struct LoadgameState;
 
extern bool LoadOldVehicle(LoadgameState *ls, int num);
 

	
 
struct Vehicle : PoolItem<Vehicle, VehicleID, &_Vehicle_pool>, BaseVehicle {
 
private:
 
	Vehicle *next;           ///< pointer to the next vehicle in the chain
 
	Vehicle *previous;       ///< NOSAVE: pointer to the previous vehicle in the chain
 
	Vehicle *first;          ///< NOSAVE: pointer to the first vehicle in the chain
 

	
 
	Vehicle *next_shared;     ///< pointer to the next vehicle that shares the order
 
	Vehicle *previous_shared; ///< NOSAVE: pointer to the previous vehicle in the shared order chain
 
	Vehicle *first_shared;    ///< NOSAVE: pointer to the first vehicle in the shared order chain
 
public:
 
	friend const SaveLoad *GetVehicleDescription(VehicleType vt); ///< So we can use private/protected variables in the saveload code
 
	friend void AfterLoadVehicles(bool clear_te_id);              ///< 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
 

	
 
	Vehicle *depot_list;     ///< NOSAVE: linked list to tell what vehicles entered a depot during the last tick. Used by autoreplace
 

	
 
	char *name;              ///< Name of vehicle
 

	
 
	TileIndex tile;          ///< Current tile index
 

	
 
	/**
 
	 * Heading for this tile.
 
	 * For airports and train stations this tile does not necessarily belong to the destination station,
 
	 * but it can be used for heuristical purposes to estimate the distance.
 
	 */
 
	TileIndex dest_tile;
 

	
 
	Money profit_this_year;        ///< Profit this year << 8, low 8 bits are fract
 
	Money profit_last_year;        ///< Profit last year << 8, low 8 bits are fract
 
	Money value;
 

	
 
	/* Used for timetabling. */
 
	uint32 current_order_time;     ///< How many ticks have passed since this order started.
 
	int32 lateness_counter;        ///< How many ticks late (or early if negative) this vehicle is.
 

	
 
	/* Boundaries for the current position in the world and a next hash link.
 
	 * NOSAVE: All of those can be updated with VehiclePositionChanged() */
 
	int32 left_coord;
 
	int32 top_coord;
 
	int32 right_coord;
 
@@ -288,50 +286,48 @@ public:
 
	/* for randomized variational spritegroups
 
	 * bitmask used to resolve them; parts of it get reseeded when triggers
 
	 * of corresponding spritegroups get matched */
 
	byte random_bits;
 
	byte waiting_triggers;   ///< triggers to be yet matched
 

	
 
	StationID last_station_visited;
 

	
 
	CargoID cargo_type;      ///< type of cargo this vehicle is carrying
 
	byte cargo_subtype;      ///< Used for livery refits (NewGRF variations)
 
	uint16 cargo_cap;        ///< total capacity
 
	CargoList cargo;         ///< The cargo this vehicle is carrying
 

	
 
	byte day_counter;        ///< Increased by one for each day
 
	byte tick_counter;       ///< Increased by one for each tick
 
	byte running_ticks;      ///< Number of ticks this vehicle was not stopped this day
 

	
 
	byte vehstatus;                 ///< Status
 
	Order current_order;            ///< The current order (+ status, like: loading)
 
	VehicleOrderID num_orders;      ///< How many orders there are in the list
 
	VehicleOrderID cur_order_index; ///< The index to the current order
 

	
 
	Order *orders;                  ///< Pointer to the first order for this vehicle
 

	
 
	bool leave_depot_instantly;     ///< NOSAVE: stores if the vehicle needs to leave the depot it just entered. Used by autoreplace
 

	
 
	byte vehicle_flags;             ///< Used for gradual loading and other miscellaneous things (@see VehicleFlags enum)
 
	uint16 load_unload_time_rem;
 

	
 
	GroupID group_id;               ///< Index of group Pool array
 

	
 
	byte subtype;                   ///< subtype (Filled with values from EffectVehicles/TrainSubTypes/AircraftSubTypes)
 

	
 
	union {
 
		VehicleRail rail;
 
		VehicleAir air;
 
		VehicleRoad road;
 
		VehicleEffect effect;
 
		VehicleDisaster disaster;
 
		VehicleShip ship;
 
	} u;
 

	
 

	
 
	/**
 
	 * Allocates a lot of vehicles.
 
	 * @param vl pointer to an array of vehicles to get allocated. Can be NULL if the vehicles aren't needed (makes it test only)
 
	 * @param num number of vehicles to allocate room for
 
	 * @return true if there is room to allocate all the vehicles
 
	 */
 
	static bool AllocateList(Vehicle **vl, int num);