mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Use std::array for company infrastructure arrays.
This commit is contained in:
parent
fe7bd3a266
commit
db56499c01
|
@ -30,9 +30,9 @@ struct CompanyEconomyEntry {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CompanyInfrastructure {
|
struct CompanyInfrastructure {
|
||||||
uint32_t road[ROADTYPE_END]; ///< Count of company owned track bits for each road type.
|
std::array<uint32_t, RAILTYPE_END> rail{}; ///< Count of company owned track bits for each rail type.
|
||||||
|
std::array<uint32_t, ROADTYPE_END> road{}; ///< Count of company owned track bits for each road type.
|
||||||
uint32_t signal; ///< Count of company owned signals.
|
uint32_t signal; ///< Count of company owned signals.
|
||||||
uint32_t rail[RAILTYPE_END]; ///< Count of company owned track bits for each rail type.
|
|
||||||
uint32_t water; ///< Count of company owned track bits for canals.
|
uint32_t water; ///< Count of company owned track bits for canals.
|
||||||
uint32_t station; ///< Count of company owned station tiles.
|
uint32_t station; ///< Count of company owned station tiles.
|
||||||
uint32_t airport; ///< Count of company owned airports.
|
uint32_t airport; ///< Count of company owned airports.
|
||||||
|
|
|
@ -2338,7 +2338,7 @@ struct CompanyWindow : Window
|
||||||
int y = r.top;
|
int y = r.top;
|
||||||
|
|
||||||
uint rail_pieces = c->infrastructure.signal;
|
uint rail_pieces = c->infrastructure.signal;
|
||||||
for (uint i = 0; i < lengthof(c->infrastructure.rail); i++) rail_pieces += c->infrastructure.rail[i];
|
for (uint i = 0; i < std::size(c->infrastructure.rail); i++) rail_pieces += c->infrastructure.rail[i];
|
||||||
if (rail_pieces != 0) {
|
if (rail_pieces != 0) {
|
||||||
SetDParam(0, rail_pieces);
|
SetDParam(0, rail_pieces);
|
||||||
DrawString(r.left, r.right, y, STR_COMPANY_VIEW_INFRASTRUCTURE_RAIL);
|
DrawString(r.left, r.right, y, STR_COMPANY_VIEW_INFRASTRUCTURE_RAIL);
|
||||||
|
@ -2346,7 +2346,7 @@ struct CompanyWindow : Window
|
||||||
}
|
}
|
||||||
|
|
||||||
uint road_pieces = 0;
|
uint road_pieces = 0;
|
||||||
for (uint i = 0; i < lengthof(c->infrastructure.road); i++) road_pieces += c->infrastructure.road[i];
|
for (uint i = 0; i < std::size(c->infrastructure.road); i++) road_pieces += c->infrastructure.road[i];
|
||||||
if (road_pieces != 0) {
|
if (road_pieces != 0) {
|
||||||
SetDParam(0, road_pieces);
|
SetDParam(0, road_pieces);
|
||||||
DrawString(r.left, r.right, y, STR_COMPANY_VIEW_INFRASTRUCTURE_ROAD);
|
DrawString(r.left, r.right, y, STR_COMPANY_VIEW_INFRASTRUCTURE_ROAD);
|
||||||
|
|
Loading…
Reference in New Issue