|
@@ -9,12 +9,13 @@
|
|
|
|
|
|
/** @file vehicle_base.h Base class for all vehicles. */
|
|
|
|
|
|
#ifndef VEHICLE_BASE_H
|
|
|
#define VEHICLE_BASE_H
|
|
|
|
|
|
#include "core/smallmap_type.hpp"
|
|
|
#include "track_type.h"
|
|
|
#include "command_type.h"
|
|
|
#include "order_base.h"
|
|
|
#include "cargopacket.h"
|
|
|
#include "texteff.hpp"
|
|
|
#include "engine_type.h"
|
|
@@ -208,16 +209,18 @@ public:
|
|
|
byte progress; ///< The percentage (if divided by 256) this vehicle already crossed the tile unit.
|
|
|
|
|
|
byte random_bits; ///< Bits used for determining which randomized variational spritegroups to use when drawing.
|
|
|
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.
|
|
|
|
|
|
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.
|
|
|
VehicleCargoList cargo; ///< The cargo this vehicle is carrying
|
|
|
uint16 cargo_age_counter; ///< Ticks till cargo is aged next.
|
|
|
|
|
|
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
|
|
@@ -254,12 +257,16 @@ public:
|
|
|
const uint16 &GetGroundVehicleFlags() const;
|
|
|
|
|
|
void DeleteUnreachedImplicitOrders();
|
|
|
|
|
|
void HandleLoading(bool mode = false);
|
|
|
|
|
|
void GetConsistFreeCapacities(SmallMap<CargoID, uint> &capacities) const;
|
|
|
|
|
|
uint GetConsistTotalCapacity() const;
|
|
|
|
|
|
/**
|
|
|
* Marks the vehicles to be redrawn and updates cached variables
|
|
|
*
|
|
|
* This method marks the area of the vehicle on the screen as dirty.
|
|
|
* It can be use to repaint the vehicle.
|
|
|
*
|
|
@@ -595,12 +602,23 @@ public:
|
|
|
* Get the number of manually added orders this vehicle has.
|
|
|
* @return the number of manually added orders this vehicle has.
|
|
|
*/
|
|
|
inline VehicleOrderID GetNumManualOrders() const { return (this->orders.list == NULL) ? 0 : this->orders.list->GetNumManualOrders(); }
|
|
|
|
|
|
/**
|
|
|
* Get the next station the vehicle will stop at.
|
|
|
* @return ID of the next station the vehicle will stop at or INVALID_STATION.
|
|
|
*/
|
|
|
inline StationID GetNextStoppingStation() const
|
|
|
{
|
|
|
return (this->orders.list == NULL) ? INVALID_STATION : this->orders.list->GetNextStoppingStation(this);
|
|
|
}
|
|
|
|
|
|
void RefreshNextHopsStats();
|
|
|
|
|
|
/**
|
|
|
* Copy certain configurations and statistics of a vehicle after successful autoreplace/renew
|
|
|
* The function shall copy everything that cannot be copied by a command (like orders / group etc),
|
|
|
* and that shall not be resetted for the new vehicle.
|
|
|
* @param src The old vehicle
|
|
|
*/
|
|
|
inline void CopyVehicleConfigAndStatistics(const Vehicle *src)
|