1
0
Fork 0

Codefix: Use bitset .None() or .Any() instead of comparing against an empty bitset. (#14327)

pull/14329/head
Peter Nelson 2025-06-04 07:31:44 +01:00 committed by GitHub
parent 8f10f9fb5a
commit 2e78c24ba3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 5 deletions

View File

@ -604,11 +604,11 @@ void ReadGRFSpriteOffsets(SpriteFile &file)
if (length > 0) {
uint8_t zoom = file.ReadByte();
length--;
if (colour != SpriteComponents{} && zoom == 0) { // ZoomLevel::Normal (normal zoom)
if (colour.Any() && zoom == 0) { // ZoomLevel::Normal (normal zoom)
SetBit(offset.control_flags, (colour != SpriteComponent::Palette) ? SCCF_ALLOW_ZOOM_MIN_1X_32BPP : SCCF_ALLOW_ZOOM_MIN_1X_PAL);
SetBit(offset.control_flags, (colour != SpriteComponent::Palette) ? SCCF_ALLOW_ZOOM_MIN_2X_32BPP : SCCF_ALLOW_ZOOM_MIN_2X_PAL);
}
if (colour != SpriteComponents{} && zoom == 2) { // ZoomLevel::In2x (2x zoomed in)
if (colour.Any() && zoom == 2) { // ZoomLevel::In2x (2x zoomed in)
SetBit(offset.control_flags, (colour != SpriteComponent::Palette) ? SCCF_ALLOW_ZOOM_MIN_2X_32BPP : SCCF_ALLOW_ZOOM_MIN_2X_PAL);
}
}

View File

@ -283,7 +283,7 @@ static ZoomLevels LoadSpriteV2(SpriteLoader::SpriteCollection &sprite, SpriteFil
uint8_t zoom = file.ReadByte();
bool is_wanted_colour_depth = (colour != SpriteComponents{} && (load_32bpp ? colour != SpriteComponent::Palette : colour == SpriteComponent::Palette));
bool is_wanted_colour_depth = (colour.Any() && (load_32bpp ? colour != SpriteComponent::Palette : colour == SpriteComponent::Palette));
bool is_wanted_zoom_lvl;
if (sprite_type != SpriteType::MapGen) {

View File

@ -229,7 +229,7 @@ RoadStop *Station::GetPrimaryRoadStop(const RoadVehicle *v) const
*/
void Station::AddFacility(StationFacility new_facility_bit, TileIndex facil_xy)
{
if (this->facilities == StationFacilities{}) {
if (this->facilities.None()) {
this->MoveSign(facil_xy);
this->random_bits = Random();
}

View File

@ -1454,7 +1454,7 @@ struct StationViewWindow : public Window {
this->SetWidgetLoweredState(WID_SV_CLOSE_AIRPORT, st->facilities.Test(StationFacility::Airport) && st->airport.blocks.Test(AirportBlock::AirportClosed));
extern const Station *_viewport_highlight_station;
this->SetWidgetDisabledState(WID_SV_CATCHMENT, st->facilities == StationFacilities{});
this->SetWidgetDisabledState(WID_SV_CATCHMENT, st->facilities.None());
this->SetWidgetLoweredState(WID_SV_CATCHMENT, _viewport_highlight_station == st);
this->DrawWidgets();