Fix false positive cache check error on MinGW/GCC 10 builds

Due to incorrect default operator== on structs with C arrays.

See: #709
See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94924
pull/710/head
Jonathan G Rennison 3 months ago
parent 5f34407ce1
commit 28c115fc33

@ -31,12 +31,12 @@ 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, 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. std::array<uint32_t, RAILTYPE_END> rail{}; ///< 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.
/** Get total sum of all owned track bits. */ /** Get total sum of all owned track bits. */
uint32_t GetRailTotal() const uint32_t GetRailTotal() const

@ -2456,7 +2456,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 (uint32_t pieces : c->infrastructure.rail) rail_pieces += pieces;
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);
@ -2464,7 +2464,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 (uint32_t pieces : c->infrastructure.road) road_pieces += pieces;
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);

@ -101,7 +101,7 @@ CompanyManagerFace ConvertFromOldCompanyManagerFace(uint32_t face)
void AfterLoadCompanyStats() void AfterLoadCompanyStats()
{ {
/* Reset infrastructure statistics to zero. */ /* Reset infrastructure statistics to zero. */
for (Company *c : Company::Iterate()) MemSetT(&c->infrastructure, 0); for (Company *c : Company::Iterate()) c->infrastructure = {};
/* Collect airport count. */ /* Collect airport count. */
for (const Station *st : Station::Iterate()) { for (const Station *st : Station::Iterate()) {

Loading…
Cancel
Save