Codechange: make TimerGameCalendar Date and Year types strongly typed (#10761)

This commit is contained in:
Patric Stout
2023-08-12 20:14:21 +02:00
committed by GitHub
parent 0238a2b567
commit 299570b2c1
55 changed files with 390 additions and 203 deletions

View File

@@ -163,7 +163,7 @@ static uint32_t GetCountAndDistanceOfClosestInstance(byte param_setID, byte layo
switch (variable) {
case 0x80: return this->tile;
case 0x81: return GB(this->tile, 8, 8);
case 0x81: return GB(static_cast<uint32_t>(this->tile), 8, 8);
/* Pointer to the town the industry is associated with */
case 0x82: return this->industry->town->index;
@@ -247,7 +247,7 @@ static uint32_t GetCountAndDistanceOfClosestInstance(byte param_setID, byte layo
return this->industry->founder | (is_ai ? 0x10000 : 0) | (colours << 24);
}
case 0x46: return this->industry->construction_date; // Date when built - long format - (in days)
case 0x46: return static_cast<int32_t>(this->industry->construction_date); // Date when built - long format - (in days)
/* Override flags from GS */
case 0x47: return this->industry->ctlflags;
@@ -338,7 +338,7 @@ static uint32_t GetCountAndDistanceOfClosestInstance(byte param_setID, byte layo
if (!IsValidCargoID(cargo)) return 0;
auto it = this->industry->GetCargoAccepted(cargo);
if (it == std::end(this->industry->accepted)) return 0; // invalid cargo
if (variable == 0x6E) return it->last_accepted;
if (variable == 0x6E) return static_cast<int32_t>(it->last_accepted);
if (variable == 0x6F) return it->waiting;
NOT_REACHED();
}
@@ -348,7 +348,7 @@ static uint32_t GetCountAndDistanceOfClosestInstance(byte param_setID, byte layo
/* Industry structure access*/
case 0x80: return this->industry->location.tile;
case 0x81: return GB(this->industry->location.tile, 8, 8);
case 0x81: return GB(static_cast<uint32_t>(this->industry->location.tile), 8, 8);
/* Pointer to the town the industry is associated with */
case 0x82: return this->industry->town->index;
case 0x83: