Codechange: Store Colours in Colours type. (#11625)

This reduces casts, some magic numbers, and introduces a bit of type-safety.
This commit is contained in:
2024-01-21 13:23:04 +00:00
committed by GitHub
parent 0841978304
commit c0ab436077
21 changed files with 50 additions and 41 deletions

View File

@@ -2463,7 +2463,7 @@ bool AfterLoadGame()
if (IsSavegameVersionBefore(SLV_148)) {
for (Object *o : Object::Iterate()) {
Owner owner = GetTileOwner(o->location.tile);
o->colour = (owner == OWNER_NONE) ? Random() & 0xF : Company::Get(owner)->livery->colour1;
o->colour = (owner == OWNER_NONE) ? static_cast<Colours>(GB(Random(), 0, 4)) : Company::Get(owner)->livery->colour1;
}
}