Re-order various structs to reduce holes/padding
This commit is contained in:
@@ -65,25 +65,25 @@ struct StationRect : public Rect {
|
|||||||
|
|
||||||
/** Base class for all station-ish types */
|
/** Base class for all station-ish types */
|
||||||
struct BaseStation : StationPool::PoolItem<&_station_pool> {
|
struct BaseStation : StationPool::PoolItem<&_station_pool> {
|
||||||
TileIndex xy; ///< Base tile of the station
|
|
||||||
TrackedViewportSign sign; ///< NOSAVE: Dimensions of sign
|
|
||||||
byte delete_ctr; ///< Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted.
|
|
||||||
|
|
||||||
TinyString name; ///< Custom name
|
|
||||||
StringID string_id; ///< Default name (town area) of station
|
|
||||||
mutable std::string cached_name; ///< NOSAVE: Cache of the resolved name of the station, if not using a custom name
|
|
||||||
|
|
||||||
Town *town; ///< The town this station is associated with
|
|
||||||
Owner owner; ///< The owner of this station
|
Owner owner; ///< The owner of this station
|
||||||
StationFacility facilities; ///< The facilities that this station has
|
StationFacility facilities; ///< The facilities that this station has
|
||||||
|
TileIndex xy; ///< Base tile of the station
|
||||||
|
TrackedViewportSign sign; ///< NOSAVE: Dimensions of sign
|
||||||
|
|
||||||
|
mutable std::string cached_name; ///< NOSAVE: Cache of the resolved name of the station, if not using a custom name
|
||||||
|
TinyString name; ///< Custom name
|
||||||
|
StringID string_id; ///< Default name (town area) of station
|
||||||
|
|
||||||
|
Date build_date; ///< Date of construction
|
||||||
|
|
||||||
|
Town *town; ///< The town this station is associated with
|
||||||
|
|
||||||
std::vector<StationSpecList> speclist; ///< List of rail station specs of this station.
|
std::vector<StationSpecList> speclist; ///< List of rail station specs of this station.
|
||||||
std::vector<RoadStopSpecList> roadstop_speclist; ///< List of road stop specs of this station
|
std::vector<RoadStopSpecList> roadstop_speclist; ///< List of road stop specs of this station
|
||||||
|
|
||||||
Date build_date; ///< Date of construction
|
|
||||||
|
|
||||||
uint16_t random_bits; ///< Random bits assigned to this station
|
uint16_t random_bits; ///< Random bits assigned to this station
|
||||||
byte waiting_triggers; ///< Waiting triggers (NewGRF) for this station
|
byte waiting_triggers; ///< Waiting triggers (NewGRF) for this station
|
||||||
|
byte delete_ctr; ///< Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted.
|
||||||
uint8_t cached_anim_triggers; ///< NOSAVE: Combined animation trigger bitmask, used to determine if trigger processing should happen.
|
uint8_t cached_anim_triggers; ///< NOSAVE: Combined animation trigger bitmask, used to determine if trigger processing should happen.
|
||||||
uint8_t cached_roadstop_anim_triggers; ///< NOSAVE: Combined animation trigger bitmask for road stops, used to determine if trigger processing should happen.
|
uint8_t cached_roadstop_anim_triggers; ///< NOSAVE: Combined animation trigger bitmask for road stops, used to determine if trigger processing should happen.
|
||||||
CargoTypes cached_cargo_triggers; ///< NOSAVE: Combined cargo trigger bitmask
|
CargoTypes cached_cargo_triggers; ///< NOSAVE: Combined cargo trigger bitmask
|
||||||
|
@@ -25,7 +25,7 @@ struct Backup {
|
|||||||
* @param file Filename for debug output. Use FILE_LINE macro.
|
* @param file Filename for debug output. Use FILE_LINE macro.
|
||||||
* @param line Linenumber for debug output. Use FILE_LINE macro.
|
* @param line Linenumber for debug output. Use FILE_LINE macro.
|
||||||
*/
|
*/
|
||||||
Backup(T &original, const char * const file, const int line) : original(original), valid(true), original_value(original), file(file), line(line) {}
|
Backup(T &original, const char * const file, const int line) : original(original), file(file), line(line), valid(true), original_value(original) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backup variable and switch to new value.
|
* Backup variable and switch to new value.
|
||||||
@@ -35,7 +35,7 @@ struct Backup {
|
|||||||
* @param line Linenumber for debug output. Use FILE_LINE macro.
|
* @param line Linenumber for debug output. Use FILE_LINE macro.
|
||||||
*/
|
*/
|
||||||
template <typename U>
|
template <typename U>
|
||||||
Backup(T &original, const U &new_value, const char * const file, const int line) : original(original), valid(true), original_value(original), file(file), line(line)
|
Backup(T &original, const U &new_value, const char * const file, const int line) : original(original), file(file), line(line), valid(true), original_value(original)
|
||||||
{
|
{
|
||||||
/* Note: We use a separate typename U, so type conversions are handled by assignment operator. */
|
/* Note: We use a separate typename U, so type conversions are handled by assignment operator. */
|
||||||
original = new_value;
|
original = new_value;
|
||||||
@@ -137,11 +137,10 @@ struct Backup {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
T &original;
|
T &original;
|
||||||
bool valid;
|
|
||||||
T original_value;
|
|
||||||
|
|
||||||
const char * const file;
|
const char * const file;
|
||||||
const int line;
|
const int line;
|
||||||
|
bool valid;
|
||||||
|
T original_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AutoRestoreBackupNoNewValueTag {};
|
struct AutoRestoreBackupNoNewValueTag {};
|
||||||
|
@@ -73,9 +73,9 @@ struct RemoveVia {
|
|||||||
struct Departure {
|
struct Departure {
|
||||||
DateTicksScaled scheduled_date; ///< The date this departure is scheduled to finish on (i.e. when the vehicle leaves the station)
|
DateTicksScaled scheduled_date; ///< The date this departure is scheduled to finish on (i.e. when the vehicle leaves the station)
|
||||||
Ticks lateness; ///< How delayed the departure is expected to be
|
Ticks lateness; ///< How delayed the departure is expected to be
|
||||||
CallAt terminus; ///< The station at which the vehicle will terminate following this departure
|
|
||||||
StationID via; ///< The station the departure should list as going via
|
StationID via; ///< The station the departure should list as going via
|
||||||
StationID via2; ///< Secondary station the departure should list as going via
|
StationID via2; ///< Secondary station the departure should list as going via
|
||||||
|
CallAt terminus; ///< The station at which the vehicle will terminate following this departure
|
||||||
std::vector<CallAt> calling_at; ///< The stations both called at and unloaded at by the vehicle after this departure before it terminates
|
std::vector<CallAt> calling_at; ///< The stations both called at and unloaded at by the vehicle after this departure before it terminates
|
||||||
std::vector<RemoveVia> remove_vias; ///< Vias to remove when using smart terminus.
|
std::vector<RemoveVia> remove_vias; ///< Vias to remove when using smart terminus.
|
||||||
DepartureStatus status; ///< Whether the vehicle has arrived yet for this departure
|
DepartureStatus status; ///< Whether the vehicle has arrived yet for this departure
|
||||||
@@ -83,7 +83,7 @@ struct Departure {
|
|||||||
const Vehicle *vehicle; ///< The vehicle performing this departure
|
const Vehicle *vehicle; ///< The vehicle performing this departure
|
||||||
const Order *order; ///< The order corresponding to this departure
|
const Order *order; ///< The order corresponding to this departure
|
||||||
Ticks scheduled_waiting_time; ///< Scheduled waiting time if scheduled dispatch is used
|
Ticks scheduled_waiting_time; ///< Scheduled waiting time if scheduled dispatch is used
|
||||||
Departure() : terminus(INVALID_STATION), via(INVALID_STATION), via2(INVALID_STATION), vehicle(nullptr), order(nullptr) { }
|
Departure() : via(INVALID_STATION), via2(INVALID_STATION), terminus(INVALID_STATION), vehicle(nullptr), order(nullptr) { }
|
||||||
|
|
||||||
inline bool operator==(const Departure& d) const {
|
inline bool operator==(const Departure& d) const {
|
||||||
if (this->calling_at.size() != d.calling_at.size()) return false;
|
if (this->calling_at.size() != d.calling_at.size()) return false;
|
||||||
|
@@ -61,6 +61,9 @@ DECLARE_ENUM_AS_BIT_SET(IndustryControlFlags);
|
|||||||
* Defines the internal data of a functional industry.
|
* Defines the internal data of a functional industry.
|
||||||
*/
|
*/
|
||||||
struct Industry : IndustryPool::PoolItem<&_industry_pool> {
|
struct Industry : IndustryPool::PoolItem<&_industry_pool> {
|
||||||
|
IndustryType type; ///< Type of industry.
|
||||||
|
Owner owner; ///< Owner of the industry. Which SHOULD always be (imho) OWNER_NONE
|
||||||
|
Date construction_date; ///< Date of the construction of the industry
|
||||||
TileArea location; ///< Location of the industry
|
TileArea location; ///< Location of the industry
|
||||||
Town *town; ///< Nearest town
|
Town *town; ///< Nearest town
|
||||||
Station *neutral_station; ///< Associated neutral station
|
Station *neutral_station; ///< Associated neutral station
|
||||||
@@ -74,27 +77,25 @@ struct Industry : IndustryPool::PoolItem<&_industry_pool> {
|
|||||||
std::array<byte, INDUSTRY_NUM_OUTPUTS> last_month_pct_transported{}; ///< percentage transported per cargo in the last full month
|
std::array<byte, INDUSTRY_NUM_OUTPUTS> last_month_pct_transported{}; ///< percentage transported per cargo in the last full month
|
||||||
std::array<uint16_t, INDUSTRY_NUM_OUTPUTS> last_month_production{}; ///< total units produced per cargo in the last full month
|
std::array<uint16_t, INDUSTRY_NUM_OUTPUTS> last_month_production{}; ///< total units produced per cargo in the last full month
|
||||||
std::array<uint16_t, INDUSTRY_NUM_OUTPUTS> last_month_transported{}; ///< total units transported per cargo in the last full month
|
std::array<uint16_t, INDUSTRY_NUM_OUTPUTS> last_month_transported{}; ///< total units transported per cargo in the last full month
|
||||||
|
|
||||||
|
StationList stations_near; ///< NOSAVE: List of nearby stations.
|
||||||
|
mutable std::string cached_name; ///< NOSAVE: Cache of the resolved name of the industry
|
||||||
|
|
||||||
uint16_t counter; ///< used for animation and/or production (if available cargo)
|
uint16_t counter; ///< used for animation and/or production (if available cargo)
|
||||||
byte prod_level; ///< general production level
|
byte prod_level; ///< general production level
|
||||||
|
|
||||||
IndustryType type; ///< type of industry.
|
|
||||||
Owner owner; ///< owner of the industry. Which SHOULD always be (imho) OWNER_NONE
|
|
||||||
byte random_colour; ///< randomized colour of the industry, for display purpose
|
byte random_colour; ///< randomized colour of the industry, for display purpose
|
||||||
Year last_prod_year; ///< last year of production
|
Year last_prod_year; ///< last year of production
|
||||||
byte was_cargo_delivered; ///< flag that indicate this has been the closest industry chosen for cargo delivery by a station. see DeliverGoodsToIndustry
|
byte was_cargo_delivered; ///< flag that indicate this has been the closest industry chosen for cargo delivery by a station. see DeliverGoodsToIndustry
|
||||||
IndustryControlFlags ctlflags; ///< flags overriding standard behaviours
|
IndustryControlFlags ctlflags; ///< flags overriding standard behaviours
|
||||||
|
|
||||||
PartOfSubsidy part_of_subsidy; ///< NOSAVE: is this industry a source/destination of a subsidy?
|
PartOfSubsidy part_of_subsidy; ///< NOSAVE: is this industry a source/destination of a subsidy?
|
||||||
StationList stations_near; ///< NOSAVE: List of nearby stations.
|
|
||||||
mutable std::string cached_name; ///< NOSAVE: Cache of the resolved name of the industry
|
|
||||||
|
|
||||||
Owner founder; ///< Founder of the industry
|
Owner founder; ///< Founder of the industry
|
||||||
Date construction_date; ///< Date of the construction of the industry
|
|
||||||
uint8_t construction_type; ///< Way the industry was constructed (@see IndustryConstructionType)
|
uint8_t construction_type; ///< Way the industry was constructed (@see IndustryConstructionType)
|
||||||
Date last_cargo_accepted_at[INDUSTRY_NUM_INPUTS]; ///< Last day each cargo type was accepted by this industry
|
|
||||||
byte selected_layout; ///< Which tile layout was used when creating the industry
|
byte selected_layout; ///< Which tile layout was used when creating the industry
|
||||||
Owner exclusive_supplier; ///< Which company has exclusive rights to deliver cargo (INVALID_OWNER = anyone)
|
Owner exclusive_supplier; ///< Which company has exclusive rights to deliver cargo (INVALID_OWNER = anyone)
|
||||||
Owner exclusive_consumer; ///< Which company has exclusive rights to take cargo (INVALID_OWNER = anyone)
|
Owner exclusive_consumer; ///< Which company has exclusive rights to take cargo (INVALID_OWNER = anyone)
|
||||||
|
Date last_cargo_accepted_at[INDUSTRY_NUM_INPUTS]; ///< Last day each cargo type was accepted by this industry
|
||||||
std::string text; ///< General text with additional information.
|
std::string text; ///< General text with additional information.
|
||||||
|
|
||||||
uint16_t random; ///< Random value used for randomisation of all kinds of things
|
uint16_t random; ///< Random value used for randomisation of all kinds of things
|
||||||
|
@@ -76,7 +76,7 @@ public:
|
|||||||
* @param scale Desired thickness of lines and size of station dots.
|
* @param scale Desired thickness of lines and size of station dots.
|
||||||
*/
|
*/
|
||||||
LinkGraphOverlay(Window *w, WidgetID wid, CargoTypes cargo_mask, CompanyMask company_mask, uint scale) :
|
LinkGraphOverlay(Window *w, WidgetID wid, CargoTypes cargo_mask, CompanyMask company_mask, uint scale) :
|
||||||
window(w), widget_id(wid), cargo_mask(cargo_mask), company_mask(company_mask), scale(scale), dirty(true)
|
window(w), widget_id(wid), cargo_mask(cargo_mask), scale(scale), company_mask(company_mask), dirty(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool RebuildCacheCheckChanged();
|
bool RebuildCacheCheckChanged();
|
||||||
@@ -105,11 +105,11 @@ protected:
|
|||||||
Window *window; ///< Window to be drawn into.
|
Window *window; ///< Window to be drawn into.
|
||||||
const WidgetID widget_id; ///< ID of Widget in Window to be drawn to.
|
const WidgetID widget_id; ///< ID of Widget in Window to be drawn to.
|
||||||
CargoTypes cargo_mask; ///< Bitmask of cargos to be displayed.
|
CargoTypes cargo_mask; ///< Bitmask of cargos to be displayed.
|
||||||
CompanyMask company_mask; ///< Bitmask of companies to be displayed.
|
|
||||||
LinkList cached_links; ///< Cache for links to reduce recalculation.
|
LinkList cached_links; ///< Cache for links to reduce recalculation.
|
||||||
StationSupplyList cached_stations; ///< Cache for stations to be drawn.
|
StationSupplyList cached_stations; ///< Cache for stations to be drawn.
|
||||||
Rect cached_region; ///< Region covered by cached_links and cached_stations.
|
Rect cached_region; ///< Region covered by cached_links and cached_stations.
|
||||||
uint scale; ///< Width of link lines.
|
uint scale; ///< Width of link lines.
|
||||||
|
CompanyMask company_mask; ///< Bitmask of companies to be displayed.
|
||||||
bool dirty; ///< Set if overlay should be rebuilt.
|
bool dirty; ///< Set if overlay should be rebuilt.
|
||||||
uint64_t last_update_number = 0; ///< Last window update number
|
uint64_t last_update_number = 0; ///< Last window update number
|
||||||
uint64_t rebuild_counter = 0; ///< Rebuild counter
|
uint64_t rebuild_counter = 0; ///< Rebuild counter
|
||||||
|
@@ -30,7 +30,7 @@ enum TileContext : uint8_t {
|
|||||||
/**
|
/**
|
||||||
* Flags to enable register usage in sprite layouts.
|
* Flags to enable register usage in sprite layouts.
|
||||||
*/
|
*/
|
||||||
enum TileLayoutFlags {
|
enum TileLayoutFlags : uint16_t {
|
||||||
TLF_NOTHING = 0x00,
|
TLF_NOTHING = 0x00,
|
||||||
|
|
||||||
TLF_DODRAW = 0x01, ///< Only draw sprite if value of register TileLayoutRegisters::dodraw is non-zero.
|
TLF_DODRAW = 0x01, ///< Only draw sprite if value of register TileLayoutRegisters::dodraw is non-zero.
|
||||||
@@ -50,7 +50,7 @@ enum TileLayoutFlags {
|
|||||||
TLF_KNOWN_FLAGS = 0xFF, ///< Known flags. Any unknown set flag will disable the GRF.
|
TLF_KNOWN_FLAGS = 0xFF, ///< Known flags. Any unknown set flag will disable the GRF.
|
||||||
|
|
||||||
/** Flags which are still required after loading the GRF. */
|
/** Flags which are still required after loading the GRF. */
|
||||||
TLF_DRAWING_FLAGS = ~TLF_CUSTOM_PALETTE,
|
TLF_DRAWING_FLAGS = (uint16_t)~TLF_CUSTOM_PALETTE,
|
||||||
|
|
||||||
/** Flags which do not work for the (first) ground sprite. */
|
/** Flags which do not work for the (first) ground sprite. */
|
||||||
TLF_NON_GROUND_FLAGS = TLF_BB_XY_OFFSET | TLF_BB_Z_OFFSET | TLF_CHILD_X_OFFSET | TLF_CHILD_Y_OFFSET,
|
TLF_NON_GROUND_FLAGS = TLF_BB_XY_OFFSET | TLF_BB_Z_OFFSET | TLF_CHILD_X_OFFSET | TLF_CHILD_Y_OFFSET,
|
||||||
@@ -90,11 +90,11 @@ inline uint GetConstructionStageOffset(uint construction_stage, uint num_sprites
|
|||||||
*/
|
*/
|
||||||
struct TileLayoutRegisters {
|
struct TileLayoutRegisters {
|
||||||
TileLayoutFlags flags; ///< Flags defining which members are valid and to be used.
|
TileLayoutFlags flags; ///< Flags defining which members are valid and to be used.
|
||||||
|
uint16_t max_sprite_offset; ///< Maximum offset to add to the sprite. (limited by size of the spriteset)
|
||||||
|
uint16_t max_palette_offset; ///< Maximum offset to add to the palette. (limited by size of the spriteset)
|
||||||
uint8_t dodraw; ///< Register deciding whether the sprite shall be drawn at all. Non-zero means drawing.
|
uint8_t dodraw; ///< Register deciding whether the sprite shall be drawn at all. Non-zero means drawing.
|
||||||
uint8_t sprite; ///< Register specifying a signed offset for the sprite.
|
uint8_t sprite; ///< Register specifying a signed offset for the sprite.
|
||||||
uint8_t palette; ///< Register specifying a signed offset for the palette.
|
uint8_t palette; ///< Register specifying a signed offset for the palette.
|
||||||
uint16_t max_sprite_offset; ///< Maximum offset to add to the sprite. (limited by size of the spriteset)
|
|
||||||
uint16_t max_palette_offset; ///< Maximum offset to add to the palette. (limited by size of the spriteset)
|
|
||||||
union {
|
union {
|
||||||
uint8_t parent[3]; ///< Registers for signed offsets for the bounding box position of parent sprites.
|
uint8_t parent[3]; ///< Registers for signed offsets for the bounding box position of parent sprites.
|
||||||
uint8_t child[2]; ///< Registers for signed offsets for the position of child sprites.
|
uint8_t child[2]; ///< Registers for signed offsets for the position of child sprites.
|
||||||
|
@@ -113,10 +113,11 @@ private:
|
|||||||
friend void Load_VEOX(); ///< Saving and loading of orders.
|
friend void Load_VEOX(); ///< Saving and loading of orders.
|
||||||
friend void Save_VEOX(); ///< Saving and loading of orders.
|
friend void Save_VEOX(); ///< Saving and loading of orders.
|
||||||
|
|
||||||
std::unique_ptr<OrderExtraInfo> extra; ///< Extra order info
|
|
||||||
|
|
||||||
uint16_t flags; ///< Load/unload types, depot order/action types.
|
uint16_t flags; ///< Load/unload types, depot order/action types.
|
||||||
DestinationID dest; ///< The destination of the order.
|
DestinationID dest; ///< The destination of the order.
|
||||||
|
|
||||||
|
std::unique_ptr<OrderExtraInfo> extra; ///< Extra order info
|
||||||
|
|
||||||
uint8_t type; ///< The type of order + non-stop flags
|
uint8_t type; ///< The type of order + non-stop flags
|
||||||
|
|
||||||
CargoID refit_cargo; ///< Refit CargoID
|
CargoID refit_cargo; ///< Refit CargoID
|
||||||
@@ -720,9 +721,8 @@ private:
|
|||||||
friend SaveLoadTable GetDispatchScheduleDescription(); ///< Saving and loading of dispatch schedules
|
friend SaveLoadTable GetDispatchScheduleDescription(); ///< Saving and loading of dispatch schedules
|
||||||
|
|
||||||
std::vector<uint32_t> scheduled_dispatch; ///< Scheduled dispatch time
|
std::vector<uint32_t> scheduled_dispatch; ///< Scheduled dispatch time
|
||||||
uint32_t scheduled_dispatch_duration = 0; ///< Scheduled dispatch duration
|
|
||||||
DateTicksScaled scheduled_dispatch_start_tick = -1; ///< Scheduled dispatch start tick
|
DateTicksScaled scheduled_dispatch_start_tick = -1; ///< Scheduled dispatch start tick
|
||||||
/// this counts to (DAY_TICK * _settings_game.economy.day_length_factor)
|
uint32_t scheduled_dispatch_duration = 0; ///< Scheduled dispatch duration
|
||||||
int32_t scheduled_dispatch_last_dispatch = INVALID_SCHEDULED_DISPATCH_OFFSET; ///< Last vehicle dispatched offset
|
int32_t scheduled_dispatch_last_dispatch = INVALID_SCHEDULED_DISPATCH_OFFSET; ///< Last vehicle dispatched offset
|
||||||
int32_t scheduled_dispatch_max_delay = 0; ///< Maximum allowed delay
|
int32_t scheduled_dispatch_max_delay = 0; ///< Maximum allowed delay
|
||||||
uint8_t scheduled_dispatch_flags = 0; ///< Flags
|
uint8_t scheduled_dispatch_flags = 0; ///< Flags
|
||||||
@@ -858,10 +858,10 @@ private:
|
|||||||
void ReindexOrderList();
|
void ReindexOrderList();
|
||||||
Order *GetOrderAtFromList(int index) const;
|
Order *GetOrderAtFromList(int index) const;
|
||||||
|
|
||||||
Order *first; ///< First order of the order list.
|
|
||||||
std::vector<Order *> order_index; ///< NOSAVE: Vector index of order list.
|
|
||||||
VehicleOrderID num_manual_orders; ///< NOSAVE: How many manually added orders are there in the list.
|
VehicleOrderID num_manual_orders; ///< NOSAVE: How many manually added orders are there in the list.
|
||||||
uint num_vehicles; ///< NOSAVE: Number of vehicles that share this order list.
|
uint num_vehicles; ///< NOSAVE: Number of vehicles that share this order list.
|
||||||
|
Order *first; ///< First order of the order list.
|
||||||
|
std::vector<Order *> order_index; ///< NOSAVE: Vector index of order list.
|
||||||
Vehicle *first_shared; ///< NOSAVE: pointer to the first vehicle in the shared order chain.
|
Vehicle *first_shared; ///< NOSAVE: pointer to the first vehicle in the shared order chain.
|
||||||
|
|
||||||
Ticks timetable_duration; ///< NOSAVE: Total timetabled duration of the order list.
|
Ticks timetable_duration; ///< NOSAVE: Total timetabled duration of the order list.
|
||||||
@@ -872,7 +872,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
/** Default constructor producing an invalid order list. */
|
/** Default constructor producing an invalid order list. */
|
||||||
OrderList(VehicleOrderID num_orders = INVALID_VEH_ORDER_ID)
|
OrderList(VehicleOrderID num_orders = INVALID_VEH_ORDER_ID)
|
||||||
: first(nullptr), num_manual_orders(0), num_vehicles(0), first_shared(nullptr),
|
: num_manual_orders(0), num_vehicles(0), first(nullptr), first_shared(nullptr),
|
||||||
timetable_duration(0), total_duration(0) { }
|
timetable_duration(0), total_duration(0) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -38,10 +38,10 @@ struct CFollowTrackT
|
|||||||
};
|
};
|
||||||
|
|
||||||
const VehicleType *m_veh; ///< moving vehicle
|
const VehicleType *m_veh; ///< moving vehicle
|
||||||
Owner m_veh_owner; ///< owner of the vehicle
|
|
||||||
TileIndex m_old_tile; ///< the origin (vehicle moved from) before move
|
TileIndex m_old_tile; ///< the origin (vehicle moved from) before move
|
||||||
Trackdir m_old_td; ///< the trackdir (the vehicle was on) before move
|
|
||||||
TileIndex m_new_tile; ///< the new tile (the vehicle has entered)
|
TileIndex m_new_tile; ///< the new tile (the vehicle has entered)
|
||||||
|
Owner m_veh_owner; ///< owner of the vehicle
|
||||||
|
Trackdir m_old_td; ///< the trackdir (the vehicle was on) before move
|
||||||
TrackdirBits m_new_td_bits; ///< the new set of available trackdirs
|
TrackdirBits m_new_td_bits; ///< the new set of available trackdirs
|
||||||
DiagDirection m_exitdir; ///< exit direction (leaving the old tile)
|
DiagDirection m_exitdir; ///< exit direction (leaving the old tile)
|
||||||
bool m_is_tunnel; ///< last turn passed tunnel
|
bool m_is_tunnel; ///< last turn passed tunnel
|
||||||
|
@@ -125,8 +125,6 @@ struct CYapfRailNodeT
|
|||||||
CYapfRailSegment *m_segment;
|
CYapfRailSegment *m_segment;
|
||||||
uint16_t m_num_signals_passed;
|
uint16_t m_num_signals_passed;
|
||||||
uint16_t m_num_signals_res_through_passed;
|
uint16_t m_num_signals_res_through_passed;
|
||||||
TileIndex m_last_non_reserve_through_signal_tile;
|
|
||||||
Trackdir m_last_non_reserve_through_signal_td;
|
|
||||||
union {
|
union {
|
||||||
uint32_t m_inherited_flags;
|
uint32_t m_inherited_flags;
|
||||||
struct {
|
struct {
|
||||||
@@ -139,6 +137,8 @@ struct CYapfRailNodeT
|
|||||||
} flags_u;
|
} flags_u;
|
||||||
SignalType m_last_red_signal_type;
|
SignalType m_last_red_signal_type;
|
||||||
SignalType m_last_signal_type;
|
SignalType m_last_signal_type;
|
||||||
|
Trackdir m_last_non_reserve_through_signal_td;
|
||||||
|
TileIndex m_last_non_reserve_through_signal_tile;
|
||||||
|
|
||||||
inline void Set(CYapfRailNodeT *parent, TileIndex tile, Trackdir td, bool is_choice)
|
inline void Set(CYapfRailNodeT *parent, TileIndex tile, Trackdir td, bool is_choice)
|
||||||
{
|
{
|
||||||
|
@@ -88,6 +88,7 @@ enum TrainReservationLookAheadFlags {
|
|||||||
struct TrainReservationLookAhead {
|
struct TrainReservationLookAhead {
|
||||||
TileIndex reservation_end_tile; ///< Tile the reservation ends.
|
TileIndex reservation_end_tile; ///< Tile the reservation ends.
|
||||||
Trackdir reservation_end_trackdir; ///< The reserved trackdir on the end tile.
|
Trackdir reservation_end_trackdir; ///< The reserved trackdir on the end tile.
|
||||||
|
uint8_t zpos_refresh_remaining = 0; ///< Remaining position updates before next refresh of cached_zpos
|
||||||
int32_t current_position; ///< Current position of the train on the reservation
|
int32_t current_position; ///< Current position of the train on the reservation
|
||||||
int32_t reservation_end_position; ///< Position of the end of the reservation
|
int32_t reservation_end_position; ///< Position of the end of the reservation
|
||||||
int32_t lookahead_end_position; ///< Position of the end of the reservation within the lookahead distance
|
int32_t lookahead_end_position; ///< Position of the end of the reservation within the lookahead distance
|
||||||
@@ -99,7 +100,6 @@ struct TrainReservationLookAhead {
|
|||||||
ring_buffer<TrainReservationLookAheadItem> items;
|
ring_buffer<TrainReservationLookAheadItem> items;
|
||||||
ring_buffer<TrainReservationLookAheadCurve> curves;
|
ring_buffer<TrainReservationLookAheadCurve> curves;
|
||||||
int32_t cached_zpos = 0; ///< Cached z position as used in TrainDecelerationStats
|
int32_t cached_zpos = 0; ///< Cached z position as used in TrainDecelerationStats
|
||||||
uint8_t zpos_refresh_remaining = 0; ///< Remaining position updates before next refresh of cached_zpos
|
|
||||||
|
|
||||||
int32_t RealEndPosition() const
|
int32_t RealEndPosition() const
|
||||||
{
|
{
|
||||||
|
@@ -144,15 +144,15 @@ struct PlanLine {
|
|||||||
|
|
||||||
struct Plan : PlanPool::PoolItem<&_plan_pool> {
|
struct Plan : PlanPool::PoolItem<&_plan_pool> {
|
||||||
Owner owner;
|
Owner owner;
|
||||||
|
Colours colour;
|
||||||
|
Date creation_date;
|
||||||
PlanLineVector lines;
|
PlanLineVector lines;
|
||||||
PlanLine *temp_line;
|
PlanLine *temp_line;
|
||||||
|
std::string name;
|
||||||
TileIndex last_tile;
|
TileIndex last_tile;
|
||||||
bool visible;
|
bool visible;
|
||||||
bool visible_by_all;
|
bool visible_by_all;
|
||||||
bool show_lines;
|
bool show_lines;
|
||||||
Date creation_date;
|
|
||||||
std::string name;
|
|
||||||
Colours colour;
|
|
||||||
|
|
||||||
Plan(Owner owner = INVALID_OWNER)
|
Plan(Owner owner = INVALID_OWNER)
|
||||||
{
|
{
|
||||||
|
@@ -66,14 +66,14 @@ struct RoadStop : RoadStopPool::PoolItem<&_roadstop_pool> {
|
|||||||
void Rebuild(const RoadStop *rs, int side = -1);
|
void Rebuild(const RoadStop *rs, int side = -1);
|
||||||
};
|
};
|
||||||
|
|
||||||
TileIndex xy; ///< Position on the map
|
|
||||||
byte status; ///< Current status of the Stop, @see RoadStopSatusFlag. Access using *Bay and *Busy functions.
|
byte status; ///< Current status of the Stop, @see RoadStopSatusFlag. Access using *Bay and *Busy functions.
|
||||||
|
TileIndex xy; ///< Position on the map
|
||||||
struct RoadStop *next; ///< Next stop of the given type at this station
|
struct RoadStop *next; ///< Next stop of the given type at this station
|
||||||
|
|
||||||
/** Initializes a RoadStop */
|
/** Initializes a RoadStop */
|
||||||
inline RoadStop(TileIndex tile = INVALID_TILE) :
|
inline RoadStop(TileIndex tile = INVALID_TILE) :
|
||||||
xy(tile),
|
status((1 << RSSFB_BAY_COUNT) - 1),
|
||||||
status((1 << RSSFB_BAY_COUNT) - 1)
|
xy(tile)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
~RoadStop();
|
~RoadStop();
|
||||||
|
@@ -140,21 +140,19 @@ enum RoadVehicleFlags {
|
|||||||
* Buses, trucks and trams belong to this class.
|
* Buses, trucks and trams belong to this class.
|
||||||
*/
|
*/
|
||||||
struct RoadVehicle FINAL : public GroundVehicle<RoadVehicle, VEH_ROAD> {
|
struct RoadVehicle FINAL : public GroundVehicle<RoadVehicle, VEH_ROAD> {
|
||||||
std::unique_ptr<RoadVehPathCache> cached_path; ///< Cached path.
|
|
||||||
byte state; ///< @see RoadVehicleStates
|
byte state; ///< @see RoadVehicleStates
|
||||||
byte frame;
|
byte frame;
|
||||||
uint16_t blocked_ctr;
|
uint16_t blocked_ctr;
|
||||||
byte overtaking; ///< Set to #RVSB_DRIVE_SIDE when overtaking, otherwise 0.
|
byte overtaking; ///< Set to #RVSB_DRIVE_SIDE when overtaking, otherwise 0.
|
||||||
byte overtaking_ctr; ///< The length of the current overtake attempt.
|
byte overtaking_ctr; ///< The length of the current overtake attempt.
|
||||||
|
std::unique_ptr<RoadVehPathCache> cached_path; ///< Cached path.
|
||||||
|
RoadTypes compatible_roadtypes; ///< Roadtypes this consist is powered on.
|
||||||
uint16_t crashed_ctr; ///< Animation counter when the vehicle has crashed. @see RoadVehIsCrashed
|
uint16_t crashed_ctr; ///< Animation counter when the vehicle has crashed. @see RoadVehIsCrashed
|
||||||
byte reverse_ctr;
|
byte reverse_ctr;
|
||||||
|
byte critical_breakdown_count; ///< Counter for the number of critical breakdowns since last service
|
||||||
|
uint8_t rvflags; ///< Road vehicle flags
|
||||||
|
|
||||||
RoadType roadtype; ///< Roadtype of this vehicle.
|
RoadType roadtype; ///< Roadtype of this vehicle.
|
||||||
RoadTypes compatible_roadtypes; ///< Roadtypes this consist is powered on.
|
|
||||||
|
|
||||||
byte critical_breakdown_count; ///< Counter for the number of critical breakdowns since last service
|
|
||||||
|
|
||||||
uint8_t rvflags; ///< Road vehicle flags
|
|
||||||
|
|
||||||
/** We don't want GCC to zero our struct! It already is zeroed and has an index! */
|
/** We don't want GCC to zero our struct! It already is zeroed and has an index! */
|
||||||
RoadVehicle() : GroundVehicleBase() {}
|
RoadVehicle() : GroundVehicleBase() {}
|
||||||
|
@@ -115,14 +115,14 @@ struct SettingDescEnumEntry {
|
|||||||
/** Properties of config file settings. */
|
/** Properties of config file settings. */
|
||||||
struct SettingDesc {
|
struct SettingDesc {
|
||||||
SettingDesc(const SaveLoad &save, const char *name, SettingFlag flags, OnGuiCtrl *guiproc, bool startup, const char *patx_name) :
|
SettingDesc(const SaveLoad &save, const char *name, SettingFlag flags, OnGuiCtrl *guiproc, bool startup, const char *patx_name) :
|
||||||
name(name), flags(flags), guiproc(guiproc), startup(startup), save(save), patx_name(patx_name) {}
|
name(name), flags(flags), startup(startup), save(save), guiproc(guiproc), patx_name(patx_name) {}
|
||||||
virtual ~SettingDesc() = default;
|
virtual ~SettingDesc() = default;
|
||||||
|
|
||||||
const char *name; ///< Name of the setting. Used in configuration file and for console
|
const char *name; ///< Name of the setting. Used in configuration file and for console
|
||||||
SettingFlag flags; ///< Handles how a setting would show up in the GUI (text/currency, etc.)
|
SettingFlag flags; ///< Handles how a setting would show up in the GUI (text/currency, etc.)
|
||||||
OnGuiCtrl *guiproc; ///< Callback procedure for GUI operations
|
|
||||||
bool startup; ///< Setting has to be loaded directly at startup?
|
bool startup; ///< Setting has to be loaded directly at startup?
|
||||||
SaveLoad save; ///< Internal structure (going to savegame, parts to config)
|
SaveLoad save; ///< Internal structure (going to savegame, parts to config)
|
||||||
|
OnGuiCtrl *guiproc; ///< Callback procedure for GUI operations
|
||||||
|
|
||||||
const char *patx_name; ///< Name to save/load setting from in PATX chunk, if nullptr save/load from PATS chunk as normal
|
const char *patx_name; ///< Name to save/load setting from in PATX chunk, if nullptr save/load from PATS chunk as normal
|
||||||
|
|
||||||
|
@@ -483,6 +483,7 @@ DECLARE_ENUM_AS_BIT_SET(TraceRestrictProgramActionsUsedFlags)
|
|||||||
* Enumeration for TraceRestrictProgramInput::permitted_slot_operations
|
* Enumeration for TraceRestrictProgramInput::permitted_slot_operations
|
||||||
*/
|
*/
|
||||||
enum TraceRestrictProgramInputSlotPermissions : uint8_t {
|
enum TraceRestrictProgramInputSlotPermissions : uint8_t {
|
||||||
|
TRPISP_NONE = 0, ///< No permissions
|
||||||
TRPISP_ACQUIRE = 1 << 0, ///< Slot acquire and release (on reserve) are permitted
|
TRPISP_ACQUIRE = 1 << 0, ///< Slot acquire and release (on reserve) are permitted
|
||||||
TRPISP_RELEASE_BACK = 1 << 1, ///< Slot release (back) is permitted
|
TRPISP_RELEASE_BACK = 1 << 1, ///< Slot release (back) is permitted
|
||||||
TRPISP_RELEASE_FRONT = 1 << 2, ///< Slot release (front) is permitted
|
TRPISP_RELEASE_FRONT = 1 << 2, ///< Slot release (front) is permitted
|
||||||
@@ -497,6 +498,7 @@ DECLARE_ENUM_AS_BIT_SET(TraceRestrictProgramInputSlotPermissions)
|
|||||||
* Enumeration for TraceRestrictProgramInput::input_flags
|
* Enumeration for TraceRestrictProgramInput::input_flags
|
||||||
*/
|
*/
|
||||||
enum TraceRestrictProgramInputFlags : uint8_t {
|
enum TraceRestrictProgramInputFlags : uint8_t {
|
||||||
|
TRPIF_NONE = 0, ///< No flags set
|
||||||
TRPIF_PASSED_STOP = 1 << 0, ///< Train has passed stop
|
TRPIF_PASSED_STOP = 1 << 0, ///< Train has passed stop
|
||||||
};
|
};
|
||||||
DECLARE_ENUM_AS_BIT_SET(TraceRestrictProgramInputFlags)
|
DECLARE_ENUM_AS_BIT_SET(TraceRestrictProgramInputFlags)
|
||||||
@@ -522,16 +524,15 @@ struct TraceRestrictProgramInput {
|
|||||||
|
|
||||||
TileIndex tile; ///< Tile of restrict signal, for direction testing
|
TileIndex tile; ///< Tile of restrict signal, for direction testing
|
||||||
Trackdir trackdir; ///< Track direction on tile of restrict signal, for direction testing
|
Trackdir trackdir; ///< Track direction on tile of restrict signal, for direction testing
|
||||||
|
TraceRestrictProgramInputFlags input_flags; ///< Input flags
|
||||||
|
TraceRestrictProgramInputSlotPermissions permitted_slot_operations; ///< Permitted slot operations
|
||||||
PreviousSignalProc *previous_signal_callback; ///< Callback to retrieve tile and direction of previous signal, may be nullptr
|
PreviousSignalProc *previous_signal_callback; ///< Callback to retrieve tile and direction of previous signal, may be nullptr
|
||||||
const void *previous_signal_ptr; ///< Opaque pointer suitable to be passed to previous_signal_callback
|
const void *previous_signal_ptr; ///< Opaque pointer suitable to be passed to previous_signal_callback
|
||||||
TraceRestrictProgramInputSlotPermissions permitted_slot_operations; ///< Permitted slot operations
|
|
||||||
TraceRestrictProgramInputFlags input_flags; ///< Input flags
|
|
||||||
TraceRestrictSlotTemporaryState *slot_temporary_state = nullptr; ///< Slot temporary state, must be set when permitted_slot_operations includes TRPISP_ACQUIRE_TEMP_STATE
|
TraceRestrictSlotTemporaryState *slot_temporary_state = nullptr; ///< Slot temporary state, must be set when permitted_slot_operations includes TRPISP_ACQUIRE_TEMP_STATE
|
||||||
|
|
||||||
TraceRestrictProgramInput(TileIndex tile_, Trackdir trackdir_, PreviousSignalProc *previous_signal_callback_, const void *previous_signal_ptr_)
|
TraceRestrictProgramInput(TileIndex tile_, Trackdir trackdir_, PreviousSignalProc *previous_signal_callback_, const void *previous_signal_ptr_)
|
||||||
: tile(tile_), trackdir(trackdir_), previous_signal_callback(previous_signal_callback_), previous_signal_ptr(previous_signal_ptr_),
|
: tile(tile_), trackdir(trackdir_), input_flags(TRPIF_NONE), permitted_slot_operations(TRPISP_NONE),
|
||||||
permitted_slot_operations(static_cast<TraceRestrictProgramInputSlotPermissions>(0)),
|
previous_signal_callback(previous_signal_callback_), previous_signal_ptr(previous_signal_ptr_) { }
|
||||||
input_flags(static_cast<TraceRestrictProgramInputFlags>(0)) { }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -551,8 +552,8 @@ struct TraceRestrictProgramResult {
|
|||||||
* This is refcounted, see info at top of tracerestrict.cpp
|
* This is refcounted, see info at top of tracerestrict.cpp
|
||||||
*/
|
*/
|
||||||
struct TraceRestrictProgram : TraceRestrictProgramPool::PoolItem<&_tracerestrictprogram_pool> {
|
struct TraceRestrictProgram : TraceRestrictProgramPool::PoolItem<&_tracerestrictprogram_pool> {
|
||||||
std::vector<TraceRestrictItem> items;
|
|
||||||
uint32_t refcount;
|
uint32_t refcount;
|
||||||
|
std::vector<TraceRestrictItem> items;
|
||||||
TraceRestrictProgramActionsUsedFlags actions_used_flags;
|
TraceRestrictProgramActionsUsedFlags actions_used_flags;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -1153,12 +1154,11 @@ static const uint MAX_LENGTH_TRACE_RESTRICT_SLOT_NAME_CHARS = 128; ///< The maxi
|
|||||||
struct TraceRestrictSlot : TraceRestrictSlotPool::PoolItem<&_tracerestrictslot_pool> {
|
struct TraceRestrictSlot : TraceRestrictSlotPool::PoolItem<&_tracerestrictslot_pool> {
|
||||||
friend TraceRestrictSlotTemporaryState;
|
friend TraceRestrictSlotTemporaryState;
|
||||||
|
|
||||||
std::vector<VehicleID> occupants;
|
|
||||||
uint32_t max_occupancy = 1;
|
|
||||||
std::string name;
|
|
||||||
Owner owner;
|
Owner owner;
|
||||||
VehicleType vehicle_type;
|
VehicleType vehicle_type;
|
||||||
|
uint32_t max_occupancy = 1;
|
||||||
|
std::string name;
|
||||||
|
std::vector<VehicleID> occupants;
|
||||||
std::vector<SignalReference> progsig_dependants;
|
std::vector<SignalReference> progsig_dependants;
|
||||||
|
|
||||||
static void RebuildVehicleIndex();
|
static void RebuildVehicleIndex();
|
||||||
@@ -1202,10 +1202,9 @@ private:
|
|||||||
* Counter type
|
* Counter type
|
||||||
*/
|
*/
|
||||||
struct TraceRestrictCounter : TraceRestrictCounterPool::PoolItem<&_tracerestrictcounter_pool> {
|
struct TraceRestrictCounter : TraceRestrictCounterPool::PoolItem<&_tracerestrictcounter_pool> {
|
||||||
|
Owner owner;
|
||||||
int32_t value = 0;
|
int32_t value = 0;
|
||||||
std::string name;
|
std::string name;
|
||||||
Owner owner;
|
|
||||||
|
|
||||||
std::vector<SignalReference> progsig_dependants;
|
std::vector<SignalReference> progsig_dependants;
|
||||||
|
|
||||||
TraceRestrictCounter(CompanyID owner = INVALID_COMPANY)
|
TraceRestrictCounter(CompanyID owner = INVALID_COMPANY)
|
||||||
|
15
src/train.h
15
src/train.h
@@ -131,6 +131,9 @@ struct TrainCache {
|
|||||||
* 'Train' is either a loco or a wagon.
|
* 'Train' is either a loco or a wagon.
|
||||||
*/
|
*/
|
||||||
struct Train FINAL : public GroundVehicle<Train, VEH_TRAIN> {
|
struct Train FINAL : public GroundVehicle<Train, VEH_TRAIN> {
|
||||||
|
TrackBits track;
|
||||||
|
RailType railtype;
|
||||||
|
uint32_t flags;
|
||||||
TrainCache tcache;
|
TrainCache tcache;
|
||||||
|
|
||||||
/* Link between the two ends of a multiheaded engine */
|
/* Link between the two ends of a multiheaded engine */
|
||||||
@@ -138,16 +141,11 @@ struct Train FINAL : public GroundVehicle<Train, VEH_TRAIN> {
|
|||||||
|
|
||||||
std::unique_ptr<TrainReservationLookAhead> lookahead;
|
std::unique_ptr<TrainReservationLookAhead> lookahead;
|
||||||
|
|
||||||
uint32_t flags;
|
|
||||||
|
|
||||||
uint16_t crash_anim_pos; ///< Crash animation counter, also used for realistic braking train brake overheating
|
|
||||||
|
|
||||||
TrackBits track;
|
|
||||||
TrainForceProceeding force_proceed;
|
|
||||||
RailType railtype;
|
|
||||||
byte critical_breakdown_count; ///< Counter for the number of critical breakdowns since last service
|
|
||||||
RailTypes compatible_railtypes;
|
RailTypes compatible_railtypes;
|
||||||
|
|
||||||
|
TrainForceProceeding force_proceed;
|
||||||
|
byte critical_breakdown_count; ///< Counter for the number of critical breakdowns since last service
|
||||||
|
|
||||||
/** Ticks waiting in front of a signal, ticks being stuck or a counter for forced proceeding through signals. */
|
/** Ticks waiting in front of a signal, ticks being stuck or a counter for forced proceeding through signals. */
|
||||||
uint16_t wait_counter;
|
uint16_t wait_counter;
|
||||||
|
|
||||||
@@ -155,6 +153,7 @@ struct Train FINAL : public GroundVehicle<Train, VEH_TRAIN> {
|
|||||||
uint16_t tunnel_bridge_signal_num;
|
uint16_t tunnel_bridge_signal_num;
|
||||||
uint16_t speed_restriction;
|
uint16_t speed_restriction;
|
||||||
uint16_t signal_speed_restriction;
|
uint16_t signal_speed_restriction;
|
||||||
|
uint16_t crash_anim_pos; ///< Crash animation counter, also used for realistic braking train brake overheating
|
||||||
|
|
||||||
/** We don't want GCC to zero our struct! It already is zeroed and has an index! */
|
/** We don't want GCC to zero our struct! It already is zeroed and has an index! */
|
||||||
Train() : GroundVehicleBase() {}
|
Train() : GroundVehicleBase() {}
|
||||||
|
@@ -268,6 +268,12 @@ struct ClosestDepot {
|
|||||||
|
|
||||||
/** %Vehicle data structure. */
|
/** %Vehicle data structure. */
|
||||||
struct Vehicle : VehiclePool::PoolItem<&_vehicle_pool>, BaseVehicle, BaseConsist {
|
struct Vehicle : VehiclePool::PoolItem<&_vehicle_pool>, BaseVehicle, BaseConsist {
|
||||||
|
/* These are here for structure packing purposes */
|
||||||
|
|
||||||
|
CargoID cargo_type; ///< type of cargo this vehicle is carrying
|
||||||
|
EngineID engine_type; ///< The type of engine used for this vehicle.
|
||||||
|
TileIndex tile; ///< Current tile index
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vehicle *next; ///< pointer to the next vehicle in the chain
|
Vehicle *next; ///< pointer to the next vehicle in the chain
|
||||||
Vehicle *previous; ///< NOSAVE: pointer to the previous vehicle in the chain
|
Vehicle *previous; ///< NOSAVE: pointer to the previous vehicle in the chain
|
||||||
@@ -287,7 +293,12 @@ public:
|
|||||||
|
|
||||||
static void PreCleanPool();
|
static void PreCleanPool();
|
||||||
|
|
||||||
TileIndex tile; ///< Current tile index
|
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 profit_lifetime; ///< Profit lifetime << 8, low 8 bits are fract
|
||||||
|
Money value; ///< Value of the vehicle
|
||||||
|
|
||||||
|
CargoPayment *cargo_payment; ///< The cargo payment we're currently in
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Heading for this tile.
|
* Heading for this tile.
|
||||||
@@ -296,13 +307,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
TileIndex dest_tile;
|
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 profit_lifetime; ///< Profit lifetime << 8, low 8 bits are fract
|
|
||||||
Money value; ///< Value of the vehicle
|
|
||||||
|
|
||||||
CargoPayment *cargo_payment; ///< The cargo payment we're currently in
|
|
||||||
|
|
||||||
/* Used for timetabling. */
|
/* Used for timetabling. */
|
||||||
uint32_t 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.
|
||||||
|
|
||||||
@@ -318,6 +322,8 @@ public:
|
|||||||
byte breakdown_severity; ///< severity of the breakdown. Note that lower means more severe
|
byte breakdown_severity; ///< severity of the breakdown. Note that lower means more severe
|
||||||
byte breakdown_type; ///< Type of breakdown
|
byte breakdown_type; ///< Type of breakdown
|
||||||
byte breakdown_chance_factor; ///< Improved breakdowns: current multiplier for breakdown_chance * 128, used for head vehicle only
|
byte breakdown_chance_factor; ///< Improved breakdowns: current multiplier for breakdown_chance * 128, used for head vehicle only
|
||||||
|
Owner owner; ///< Which company owns the vehicle?
|
||||||
|
|
||||||
SpriteID colourmap; ///< NOSAVE: cached colour mapping
|
SpriteID colourmap; ///< NOSAVE: cached colour mapping
|
||||||
|
|
||||||
/* Related to age and service time */
|
/* Related to age and service time */
|
||||||
@@ -338,13 +344,13 @@ public:
|
|||||||
int32_t z_pos; ///< z coordinate.
|
int32_t z_pos; ///< z coordinate.
|
||||||
Direction direction; ///< facing
|
Direction direction; ///< facing
|
||||||
|
|
||||||
Owner owner; ///< Which company owns the vehicle?
|
|
||||||
/**
|
/**
|
||||||
* currently displayed sprite index
|
* currently displayed sprite index
|
||||||
* 0xfd == custom sprite, 0xfe == custom second head sprite
|
* 0xfd == custom sprite, 0xfe == custom second head sprite
|
||||||
* 0xff == reserved for another custom sprite
|
* 0xff == reserved for another custom sprite
|
||||||
*/
|
*/
|
||||||
byte spritenum;
|
byte spritenum;
|
||||||
|
UnitID unitnumber; ///< unit number, for display purposes only
|
||||||
VehicleSpriteSeq sprite_seq; ///< Vehicle appearance.
|
VehicleSpriteSeq sprite_seq; ///< Vehicle appearance.
|
||||||
Rect16 sprite_seq_bounds;
|
Rect16 sprite_seq_bounds;
|
||||||
byte x_extent; ///< x-extent of vehicle bounding box
|
byte x_extent; ///< x-extent of vehicle bounding box
|
||||||
@@ -354,39 +360,41 @@ public:
|
|||||||
int8_t y_bb_offs; ///< y 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 x_offs; ///< x offset for vehicle sprite
|
||||||
int8_t y_offs; ///< y offset for vehicle sprite
|
int8_t y_offs; ///< y offset for vehicle sprite
|
||||||
EngineID engine_type; ///< The type of engine used for this vehicle.
|
|
||||||
|
|
||||||
|
byte progress; ///< The percentage (if divided by 256) this vehicle already crossed the tile unit.
|
||||||
TextEffectID fill_percent_te_id; ///< a text-effect id to a loading indicator object
|
TextEffectID fill_percent_te_id; ///< a text-effect id to a loading indicator object
|
||||||
UnitID unitnumber; ///< unit number, for display purposes only
|
uint16_t load_unload_ticks; ///< Ticks to wait before starting next cycle.
|
||||||
|
|
||||||
uint16_t cur_speed; ///< current speed
|
uint16_t cur_speed; ///< current speed
|
||||||
byte subspeed; ///< fractional speed
|
byte subspeed; ///< fractional speed
|
||||||
byte acceleration; ///< used by train & aircraft
|
byte acceleration; ///< used by train & aircraft
|
||||||
|
|
||||||
uint32_t 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_t 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.
|
byte waiting_triggers; ///< Triggers to be yet matched before rerandomizing the random bits.
|
||||||
|
|
||||||
|
byte cargo_subtype; ///< Used for livery refits (NewGRF variations)
|
||||||
|
|
||||||
StationID last_station_visited; ///< The last station we stopped at.
|
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).
|
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_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).
|
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
|
VehicleCargoList cargo; ///< The cargo this vehicle is carrying
|
||||||
byte cargo_subtype; ///< Used for livery refits (NewGRF variations)
|
|
||||||
uint16_t cargo_cap; ///< total capacity
|
uint16_t cargo_cap; ///< total capacity
|
||||||
uint16_t refit_cap; ///< Capacity left over from before last refit.
|
uint16_t refit_cap; ///< Capacity left over from before last refit.
|
||||||
VehicleCargoList cargo; ///< The cargo this vehicle is carrying
|
|
||||||
uint16_t cargo_age_counter; ///< Ticks till cargo is aged next.
|
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).
|
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 day_counter; ///< Increased by one for each day
|
||||||
byte tick_counter; ///< Increased by one for each tick
|
byte tick_counter; ///< Increased by one for each tick
|
||||||
|
uint8_t order_occupancy_average; ///< NOSAVE: order occupancy average. 0 = invalid, 1 = n/a, 16-116 = 0-100%
|
||||||
uint16_t 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
|
byte vehstatus; ///< Status
|
||||||
|
byte subtype; ///< subtype (Filled with values from #AircraftSubType/#DisasterSubType/#EffectVehicleType/#GroundVehicleSubtypeFlags)
|
||||||
|
GroupID group_id; ///< Index of group Pool array
|
||||||
|
|
||||||
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)
|
Order current_order; ///< The current order (+ status, like: loading)
|
||||||
|
|
||||||
union {
|
union {
|
||||||
@@ -394,9 +402,6 @@ public:
|
|||||||
Order *old_orders; ///< Only used during conversion of old save games
|
Order *old_orders; ///< Only used during conversion of old save games
|
||||||
};
|
};
|
||||||
|
|
||||||
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
|
Direction cur_image_valid_dir; ///< NOSAVE: direction for which cur_image does not need to be regenerated on the next tick
|
||||||
|
|
||||||
NewGRFCache grf_cache; ///< Cache of often used calculated NewGRF values
|
NewGRFCache grf_cache; ///< Cache of often used calculated NewGRF values
|
||||||
|
Reference in New Issue
Block a user