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:
Peter Nelson
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

@@ -143,7 +143,7 @@ void StoryPageButtonData::SetVehicleType(VehicleType vehtype)
/** Get the button background colour. */
Colours StoryPageButtonData::GetColour() const
{
Colours colour = (Colours)GB(this->referenced_id, 0, 8);
Colours colour = static_cast<Colours>(GB(this->referenced_id, 0, 8));
if (!IsValidColours(colour)) return INVALID_COLOUR;
return colour;
}