mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Use `x = y` instead of `x{y}` for value-type member initialisation. (#12501)
This is easier to read and less likely to look like an array definition.
This commit is contained in:
parent
672aa014d8
commit
3ad143c43a
|
@ -291,10 +291,10 @@ public:
|
|||
# include "video/video_driver.hpp"
|
||||
|
||||
class BootstrapEmscripten : public ContentCallback {
|
||||
bool downloading{false};
|
||||
uint total_files{0};
|
||||
uint total_bytes{0};
|
||||
uint downloaded_bytes{0};
|
||||
bool downloading = false;
|
||||
uint total_files = 0;
|
||||
uint total_bytes = 0;
|
||||
uint downloaded_bytes = 0;
|
||||
|
||||
public:
|
||||
BootstrapEmscripten()
|
||||
|
|
|
@ -45,23 +45,23 @@ private:
|
|||
int16_t y;
|
||||
};
|
||||
|
||||
uint16_t count{0}; ///< The amount of cargo in this packet.
|
||||
uint16_t periods_in_transit{0}; ///< Amount of cargo aging periods this packet has been in transit.
|
||||
uint16_t count = 0; ///< The amount of cargo in this packet.
|
||||
uint16_t periods_in_transit = 0; ///< Amount of cargo aging periods this packet has been in transit.
|
||||
|
||||
Money feeder_share{0}; ///< Value of feeder pickup to be paid for on delivery of cargo.
|
||||
Money feeder_share = 0; ///< Value of feeder pickup to be paid for on delivery of cargo.
|
||||
|
||||
TileIndex source_xy{INVALID_TILE}; ///< The origin of the cargo.
|
||||
TileIndex source_xy = INVALID_TILE; ///< The origin of the cargo.
|
||||
Vector travelled{0, 0}; ///< If cargo is in station: the vector from the unload tile to the source tile. If in vehicle: an intermediate value.
|
||||
|
||||
SourceID source_id{INVALID_SOURCE}; ///< Index of industry/town/HQ, INVALID_SOURCE if unknown/invalid.
|
||||
SourceType source_type{SourceType::Industry}; ///< Type of \c source_id.
|
||||
SourceID source_id = INVALID_SOURCE; ///< Index of industry/town/HQ, INVALID_SOURCE if unknown/invalid.
|
||||
SourceType source_type = SourceType::Industry; ///< Type of \c source_id.
|
||||
|
||||
#ifdef WITH_ASSERT
|
||||
bool in_vehicle{false}; ///< NOSAVE: Whether this cargo is in a vehicle or not.
|
||||
bool in_vehicle = false; ///< NOSAVE: Whether this cargo is in a vehicle or not.
|
||||
#endif /* WITH_ASSERT */
|
||||
|
||||
StationID first_station{INVALID_STATION}; ///< The station where the cargo came from first.
|
||||
StationID next_hop{INVALID_STATION}; ///< Station where the cargo wants to go next.
|
||||
StationID first_station = INVALID_STATION; ///< The station where the cargo came from first.
|
||||
StationID next_hop = INVALID_STATION; ///< Station where the cargo wants to go next.
|
||||
|
||||
/** The CargoList caches, thus needs to know about it. */
|
||||
template <class Tinst, class Tcont> friend class CargoList;
|
||||
|
|
|
@ -67,19 +67,19 @@ static const uint TOWN_PRODUCTION_DIVISOR = 256;
|
|||
/** Specification of a cargo type. */
|
||||
struct CargoSpec {
|
||||
CargoLabel label; ///< Unique label of the cargo type.
|
||||
uint8_t bitnum{INVALID_CARGO_BITNUM}; ///< Cargo bit number, is #INVALID_CARGO_BITNUM for a non-used spec.
|
||||
uint8_t bitnum = INVALID_CARGO_BITNUM; ///< Cargo bit number, is #INVALID_CARGO_BITNUM for a non-used spec.
|
||||
uint8_t legend_colour;
|
||||
uint8_t rating_colour;
|
||||
uint8_t weight; ///< Weight of a single unit of this cargo type in 1/16 ton (62.5 kg).
|
||||
uint16_t multiplier{0x100}; ///< Capacity multiplier for vehicles. (8 fractional bits)
|
||||
uint16_t multiplier = 0x100; ///< Capacity multiplier for vehicles. (8 fractional bits)
|
||||
uint16_t classes; ///< Classes of this cargo type. @see CargoClass
|
||||
int32_t initial_payment; ///< Initial payment rate before inflation is applied.
|
||||
uint8_t transit_periods[2];
|
||||
|
||||
bool is_freight; ///< Cargo type is considered to be freight (affects train freight multiplier).
|
||||
TownAcceptanceEffect town_acceptance_effect; ///< The effect that delivering this cargo type has on towns. Also affects destination of subsidies.
|
||||
TownProductionEffect town_production_effect{INVALID_TPE}; ///< The effect on town cargo production.
|
||||
uint16_t town_production_multiplier{TOWN_PRODUCTION_DIVISOR}; ///< Town production multipler, if commanded by TownProductionEffect.
|
||||
TownProductionEffect town_production_effect = INVALID_TPE; ///< The effect on town cargo production.
|
||||
uint16_t town_production_multiplier = TOWN_PRODUCTION_DIVISOR; ///< Town production multipler, if commanded by TownProductionEffect.
|
||||
uint8_t callback_mask; ///< Bitmask of cargo callbacks that have to be called
|
||||
|
||||
StringID name; ///< Name of this type of cargo.
|
||||
|
|
|
@ -136,7 +136,7 @@ struct TemporaryStorageArray {
|
|||
|
||||
StorageType storage{}; ///< Memory for the storage array
|
||||
StorageInitType init{}; ///< Storage has been assigned, if this equals 'init_key'.
|
||||
uint16_t init_key{1}; ///< Magic key to 'init'.
|
||||
uint16_t init_key = 1; ///< Magic key to 'init'.
|
||||
|
||||
/**
|
||||
* Stores some value at a given position.
|
||||
|
|
|
@ -210,20 +210,20 @@ struct GoodsEntry {
|
|||
StationCargoList cargo{}; ///< The cargo packets of cargo waiting in this station
|
||||
FlowStatMap flows{}; ///< Planned flows through this station.
|
||||
|
||||
uint max_waiting_cargo{0}; ///< Max cargo from this station waiting at any station.
|
||||
NodeID node{INVALID_NODE}; ///< ID of node in link graph referring to this goods entry.
|
||||
LinkGraphID link_graph{INVALID_LINK_GRAPH}; ///< Link graph this station belongs to.
|
||||
uint max_waiting_cargo = 0; ///< Max cargo from this station waiting at any station.
|
||||
NodeID node = INVALID_NODE; ///< ID of node in link graph referring to this goods entry.
|
||||
LinkGraphID link_graph = INVALID_LINK_GRAPH; ///< Link graph this station belongs to.
|
||||
|
||||
uint8_t status{0}; ///< Status of this cargo, see #GoodsEntryStatus.
|
||||
uint8_t status = 0; ///< Status of this cargo, see #GoodsEntryStatus.
|
||||
|
||||
/**
|
||||
* Number of rating-intervals (up to 255) since the last vehicle tried to load this cargo.
|
||||
* The unit used is STATION_RATING_TICKS.
|
||||
* This does not imply there was any cargo to load.
|
||||
*/
|
||||
uint8_t time_since_pickup{255};
|
||||
uint8_t time_since_pickup = 255;
|
||||
|
||||
uint8_t rating{INITIAL_STATION_RATING}; ///< %Station rating for this cargo.
|
||||
uint8_t rating = INITIAL_STATION_RATING; ///< %Station rating for this cargo.
|
||||
|
||||
/**
|
||||
* Maximum speed (up to 255) of the last vehicle that tried to load this cargo.
|
||||
|
@ -234,15 +234,15 @@ struct GoodsEntry {
|
|||
* - Ships: 0.5 * km-ish/h
|
||||
* - Aircraft: 8 * mph
|
||||
*/
|
||||
uint8_t last_speed{0};
|
||||
uint8_t last_speed = 0;
|
||||
|
||||
/**
|
||||
* Age in years (up to 255) of the last vehicle that tried to load this cargo.
|
||||
* This does not imply there was any cargo to load.
|
||||
*/
|
||||
uint8_t last_age{255};
|
||||
uint8_t last_age = 255;
|
||||
|
||||
uint8_t amount_fract{0}; ///< Fractional part of the amount in the cargo list
|
||||
uint8_t amount_fract = 0; ///< Fractional part of the amount in the cargo list
|
||||
|
||||
/**
|
||||
* Reports whether a vehicle has ever tried to load the cargo at this station.
|
||||
|
|
|
@ -44,10 +44,10 @@ protected:
|
|||
void ConstructWindow();
|
||||
|
||||
struct Line {
|
||||
int top{0}; ///< Top scroll position in visual lines.
|
||||
int bottom{0}; ///< Bottom scroll position in visual lines.
|
||||
std::string text{}; ///< Contents of the line.
|
||||
TextColour colour{TC_WHITE}; ///< Colour to render text line in.
|
||||
int top = 0; ///< Top scroll position in visual lines.
|
||||
int bottom = 0; ///< Bottom scroll position in visual lines.
|
||||
std::string text{}; ///< Contents of the line.
|
||||
TextColour colour = TC_WHITE; ///< Colour to render text line in.
|
||||
|
||||
Line(int top, std::string_view text) : top(top), bottom(top + 1), text(text) {}
|
||||
Line() {}
|
||||
|
@ -73,8 +73,8 @@ protected:
|
|||
std::vector<Hyperlink> links; ///< Clickable links in lines.
|
||||
std::vector<Hyperlink> link_anchors; ///< Anchor names of headings that can be linked to.
|
||||
std::vector<HistoryEntry> history; ///< Browsing history in this window.
|
||||
size_t history_pos{0}; ///< Position in browsing history (for forward movement).
|
||||
bool trusted{false}; ///< Whether the content is trusted (read: not from content like NewGRFs, etc).
|
||||
size_t history_pos = 0; ///< Position in browsing history (for forward movement).
|
||||
bool trusted = false; ///< Whether the content is trusted (read: not from content like NewGRFs, etc).
|
||||
|
||||
void LoadText(std::string_view buf);
|
||||
void FindHyperlinksInMarkdown(Line &line, size_t line_index);
|
||||
|
@ -97,8 +97,8 @@ protected:
|
|||
void NavigateHistory(int delta);
|
||||
|
||||
private:
|
||||
uint search_iterator{0}; ///< Iterator for the font check search.
|
||||
uint max_length{0}; ///< Maximum length of unwrapped text line.
|
||||
uint search_iterator = 0; ///< Iterator for the font check search.
|
||||
uint max_length = 0; ///< Maximum length of unwrapped text line.
|
||||
|
||||
uint ReflowContent();
|
||||
uint GetContentHeight();
|
||||
|
|
Loading…
Reference in New Issue