Fix #13513, ec492cb267: std::numeric_limits<CompanyMask> not working causes no vehicles to exist

std::numeric_limits<T>::max() returns 0 instead of an error when the type is unknown.
Solve it by implementing and using Set() and All() in BaseBitSet in same way as std::bitset.
This commit is contained in:
Rubidium
2025-02-09 21:49:15 +01:00
committed by rubidium42
parent 521b860394
commit 37c215f1fd
9 changed files with 55 additions and 30 deletions
+3 -3
View File
@@ -406,7 +406,7 @@ static bool FixTTOEngines()
/* Make sure for example monorail and maglev are available when they should be */
if (TimerGameCalendar::date >= e->intro_date && e->info.climates.Test(LandscapeType::Temperate)) {
e->flags.Set(EngineFlag::Available);
e->company_avail = std::numeric_limits<CompanyMask>::max();
e->company_avail.Set();
e->age = TimerGameCalendar::date > e->intro_date ? (TimerGameCalendar::date - e->intro_date).base() / 30 : 0;
}
} else {
@@ -431,7 +431,7 @@ static bool FixTTOEngines()
* if at least one of them was available. */
for (uint j = 0; j < lengthof(tto_to_ttd); j++) {
if (tto_to_ttd[j] == i && _old_engines[j].company_avail.Any()) {
e->company_avail = std::numeric_limits<CompanyMask>::max();
e->company_avail.Set();
e->flags.Set(EngineFlag::Available);
break;
}
@@ -441,7 +441,7 @@ static bool FixTTOEngines()
}
e->preview_company = INVALID_COMPANY;
e->preview_asked = std::numeric_limits<CompanyMask>::max();
e->preview_asked.Set();
e->preview_wait = 0;
e->name = std::string{};
}