mirror of https://github.com/OpenTTD/OpenTTD
Codechange: (re)set multiple bitset flags in one call. (#14017)
parent
31e716449d
commit
2c59838acb
|
@ -909,7 +909,7 @@ static void FinaliseEngineArray()
|
|||
}
|
||||
|
||||
if (e->info.variant_id != EngineID::Invalid()) {
|
||||
Engine::Get(e->info.variant_id)->display_flags.Set(EngineDisplayFlag::HasVariants).Set(EngineDisplayFlag::IsFolded);
|
||||
Engine::Get(e->info.variant_id)->display_flags.Set({EngineDisplayFlag::HasVariants, EngineDisplayFlag::IsFolded});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ static ChangeInfoResult TownHouseChangeInfo(uint first, uint last, int prop, Byt
|
|||
housespec->random_colour[3] = COLOUR_GREEN;
|
||||
|
||||
/* House flags 40 and 80 are exceptions; these flags are never set automatically. */
|
||||
housespec->building_flags.Reset(BuildingFlag::IsChurch).Reset(BuildingFlag::IsStadium);
|
||||
housespec->building_flags.Reset({BuildingFlag::IsChurch, BuildingFlag::IsStadium});
|
||||
|
||||
/* Make sure that the third cargo type is valid in this
|
||||
* climate. This can cause problems when copying the properties
|
||||
|
|
|
@ -240,7 +240,7 @@ CommandCost CmdBuildObject(DoCommandFlags flags, TileIndex tile, ObjectType type
|
|||
if (!IsWaterTile(t)) {
|
||||
/* Normal water tiles don't have to be cleared. For all other tile types clear
|
||||
* the tile but leave the water. */
|
||||
cost.AddCost(Command<CMD_LANDSCAPE_CLEAR>::Do(DoCommandFlags{flags}.Reset(DoCommandFlag::NoWater).Reset(DoCommandFlag::Execute), t));
|
||||
cost.AddCost(Command<CMD_LANDSCAPE_CLEAR>::Do(DoCommandFlags{flags}.Reset({DoCommandFlag::NoWater, DoCommandFlag::Execute}), t));
|
||||
} else {
|
||||
/* Can't build on water owned by another company. */
|
||||
Owner o = GetTileOwner(t);
|
||||
|
|
|
@ -517,8 +517,7 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th
|
|||
end_segment_reason.Set(EndSegmentReason::SafeTile);
|
||||
} else if (HasSignalOnTrackdir(next.tile, ReverseTrackdir(next.td)) && GetSignalType(next.tile, TrackdirToTrack(next.td)) == SIGTYPE_PBS_ONEWAY) {
|
||||
/* Possible safe tile, but not so good as it's the back of a signal... */
|
||||
end_segment_reason.Set(EndSegmentReason::SafeTile);
|
||||
end_segment_reason.Set(EndSegmentReason::DeadEnd);
|
||||
end_segment_reason.Set({EndSegmentReason::SafeTile, EndSegmentReason::DeadEnd});
|
||||
extra_cost += Yapf().PfGetSettings().rail_lastred_exit_penalty;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,8 +144,8 @@ ScriptTileList_StationType::ScriptTileList_StationType(StationID station_id, Scr
|
|||
if ((station_type & ScriptStation::STATION_TRAIN) != 0) station_types.Set(::StationType::Rail);
|
||||
if ((station_type & ScriptStation::STATION_TRUCK_STOP) != 0) station_types.Set(::StationType::Truck);
|
||||
if ((station_type & ScriptStation::STATION_BUS_STOP) != 0) station_types.Set(::StationType::Bus);
|
||||
if ((station_type & ScriptStation::STATION_AIRPORT) != 0) station_types.Set(::StationType::Airport).Set(::StationType::Oilrig);
|
||||
if ((station_type & ScriptStation::STATION_DOCK) != 0) station_types.Set(::StationType::Dock).Set(::StationType::Oilrig);
|
||||
if ((station_type & ScriptStation::STATION_AIRPORT) != 0) station_types.Set({::StationType::Airport, ::StationType::Oilrig});
|
||||
if ((station_type & ScriptStation::STATION_DOCK) != 0) station_types.Set({::StationType::Dock, ::StationType::Oilrig});
|
||||
|
||||
TileArea ta(::TileXY(rect->left, rect->top), rect->Width(), rect->Height());
|
||||
for (TileIndex cur_tile : ta) {
|
||||
|
|
|
@ -2308,7 +2308,7 @@ CommandCost RemoveRoadWaypointStop(TileIndex tile, DoCommandFlags flags, int rep
|
|||
|
||||
/* if we deleted the whole waypoint, delete the road facility. */
|
||||
if (wp->road_waypoint_area.tile == INVALID_TILE) {
|
||||
wp->facilities.Reset(StationFacility::BusStop).Reset(StationFacility::TruckStop);
|
||||
wp->facilities.Reset({StationFacility::BusStop, StationFacility::TruckStop});
|
||||
SetWindowWidgetDirty(WC_STATION_VIEW, wp->index, WID_SV_ROADVEHS);
|
||||
wp->UpdateVirtCoord();
|
||||
DeleteStationIfEmpty(wp);
|
||||
|
|
|
@ -139,7 +139,7 @@ std::tuple<CommandCost, VehicleID, uint, uint16_t, CargoArray> CmdBuildVehicle(D
|
|||
/* If we are refitting we need to temporarily purchase the vehicle to be able to
|
||||
* test it. */
|
||||
DoCommandFlags subflags = flags;
|
||||
if (refitting && !flags.Test(DoCommandFlag::Execute)) subflags.Set(DoCommandFlag::Execute).Set(DoCommandFlag::AutoReplace);
|
||||
if (refitting && !flags.Test(DoCommandFlag::Execute)) subflags.Set({DoCommandFlag::Execute, DoCommandFlag::AutoReplace});
|
||||
|
||||
/* Vehicle construction needs random bits, so we have to save the random
|
||||
* seeds to prevent desyncs. */
|
||||
|
|
|
@ -1352,7 +1352,7 @@ static Rect ExpandRectWithViewportSignMargins(Rect r, ZoomLevel zoom)
|
|||
static void ViewportAddTownStrings(DrawPixelInfo *dpi, const std::vector<const Town *> &towns, bool small)
|
||||
{
|
||||
ViewportStringFlags flags{};
|
||||
if (small) flags.Set(ViewportStringFlag::Small).Set(ViewportStringFlag::Shadow);
|
||||
if (small) flags.Set({ViewportStringFlag::Small, ViewportStringFlag::Shadow});
|
||||
|
||||
StringID stringid = !small && _settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_POP : STR_TOWN_NAME;
|
||||
for (const Town *t : towns) {
|
||||
|
|
|
@ -409,7 +409,7 @@ CommandCost CmdBuildRoadWaypoint(DoCommandFlags flags, TileIndex start_tile, Axi
|
|||
}
|
||||
|
||||
wp->delete_ctr = 0;
|
||||
wp->facilities.Set(StationFacility::BusStop).Set(StationFacility::TruckStop);
|
||||
wp->facilities.Set({StationFacility::BusStop, StationFacility::TruckStop});
|
||||
wp->build_date = TimerGameCalendar::date;
|
||||
wp->string_id = STR_SV_STNAME_WAYPOINT;
|
||||
|
||||
|
|
|
@ -1837,7 +1837,7 @@ static void DecreaseWindowCounters()
|
|||
if (nwid->type == NWID_HSCROLLBAR || nwid->type == NWID_VSCROLLBAR) {
|
||||
NWidgetScrollbar *sb = static_cast<NWidgetScrollbar*>(nwid);
|
||||
if (sb->disp_flags.Any({NWidgetDisplayFlag::ScrollbarUp, NWidgetDisplayFlag::ScrollbarDown})) {
|
||||
sb->disp_flags.Reset(NWidgetDisplayFlag::ScrollbarUp).Reset(NWidgetDisplayFlag::ScrollbarDown);
|
||||
sb->disp_flags.Reset({NWidgetDisplayFlag::ScrollbarUp, NWidgetDisplayFlag::ScrollbarDown});
|
||||
w->mouse_capture_widget = -1;
|
||||
sb->SetDirty(w);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue