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

@@ -186,7 +186,7 @@ public:
*/
inline static uint Scale(uint val, TimerGameCalendar::Date target_age, TimerGameCalendar::Date orig_age)
{
return val > 0 ? std::max(1U, val * target_age / orig_age) : 0;
return val > 0 ? std::max(1U, val * static_cast<int32_t>(target_age) / static_cast<int32_t>(orig_age)) : 0;
}
/** Bare constructor, only for save/load. */
@@ -249,7 +249,7 @@ public:
*/
inline uint Monthly(uint base) const
{
return base * 30 / (TimerGameCalendar::date - this->last_compression + 1);
return base * 30 / static_cast<int32_t>(TimerGameCalendar::date - this->last_compression + 1);
}
NodeID AddNode(const Station *st);