mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Use EnumBitSet.Any(). (#13512)
parent
86841ba1f0
commit
1ed685b5c1
|
@ -1300,7 +1300,7 @@ static ChangeInfoResult RailVehicleChangeInfo(uint first, uint last, int prop, B
|
|||
|
||||
case 0x28: // Cargo classes allowed
|
||||
_gted[e->index].cargo_allowed = CargoClasses{buf.ReadWord()};
|
||||
_gted[e->index].UpdateRefittability(_gted[e->index].cargo_allowed != CargoClasses{});
|
||||
_gted[e->index].UpdateRefittability(_gted[e->index].cargo_allowed.Any());
|
||||
_gted[e->index].defaultcargo_grf = _cur.grffile;
|
||||
break;
|
||||
|
||||
|
@ -1497,7 +1497,7 @@ static ChangeInfoResult RoadVehicleChangeInfo(uint first, uint last, int prop, B
|
|||
|
||||
case 0x1D: // Cargo classes allowed
|
||||
_gted[e->index].cargo_allowed = CargoClasses{buf.ReadWord()};
|
||||
_gted[e->index].UpdateRefittability(_gted[e->index].cargo_allowed != CargoClasses{});
|
||||
_gted[e->index].UpdateRefittability(_gted[e->index].cargo_allowed.Any());
|
||||
_gted[e->index].defaultcargo_grf = _cur.grffile;
|
||||
break;
|
||||
|
||||
|
@ -1690,7 +1690,7 @@ static ChangeInfoResult ShipVehicleChangeInfo(uint first, uint last, int prop, B
|
|||
|
||||
case 0x18: // Cargo classes allowed
|
||||
_gted[e->index].cargo_allowed = CargoClasses{buf.ReadWord()};
|
||||
_gted[e->index].UpdateRefittability(_gted[e->index].cargo_allowed != CargoClasses{});
|
||||
_gted[e->index].UpdateRefittability(_gted[e->index].cargo_allowed.Any());
|
||||
_gted[e->index].defaultcargo_grf = _cur.grffile;
|
||||
break;
|
||||
|
||||
|
@ -1879,7 +1879,7 @@ static ChangeInfoResult AircraftVehicleChangeInfo(uint first, uint last, int pro
|
|||
|
||||
case 0x18: // Cargo classes allowed
|
||||
_gted[e->index].cargo_allowed = CargoClasses{buf.ReadWord()};
|
||||
_gted[e->index].UpdateRefittability(_gted[e->index].cargo_allowed != CargoClasses{});
|
||||
_gted[e->index].UpdateRefittability(_gted[e->index].cargo_allowed.Any());
|
||||
_gted[e->index].defaultcargo_grf = _cur.grffile;
|
||||
break;
|
||||
|
||||
|
@ -9123,7 +9123,7 @@ static void CalculateRefitMasks()
|
|||
_gted[engine].ctt_exclude_mask = original_known_cargoes;
|
||||
}
|
||||
}
|
||||
_gted[engine].UpdateRefittability(_gted[engine].cargo_allowed != CargoClasses{});
|
||||
_gted[engine].UpdateRefittability(_gted[engine].cargo_allowed.Any());
|
||||
|
||||
if (IsValidCargoType(ei->cargo_type)) ClrBit(_gted[engine].ctt_exclude_mask, ei->cargo_type);
|
||||
}
|
||||
|
@ -9138,7 +9138,7 @@ static void CalculateRefitMasks()
|
|||
* Note: After applying the translations, the vehicle may end up carrying no defined cargo. It becomes unavailable in that case. */
|
||||
only_defaultcargo = _gted[engine].refittability != GRFTempEngineData::NONEMPTY;
|
||||
|
||||
if (_gted[engine].cargo_allowed != CargoClasses{}) {
|
||||
if (_gted[engine].cargo_allowed.Any()) {
|
||||
/* Build up the list of cargo types from the set cargo classes. */
|
||||
for (const CargoSpec *cs : CargoSpec::Iterate()) {
|
||||
if (cs->classes.Any(_gted[engine].cargo_allowed) && cs->classes.All(_gted[engine].cargo_allowed_required)) SetBit(mask, cs->Index());
|
||||
|
|
|
@ -546,7 +546,7 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th
|
|||
}
|
||||
|
||||
/* Any other reason bit set? */
|
||||
if (end_segment_reason != EndSegmentReasons{}) {
|
||||
if (end_segment_reason.Any()) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -3202,7 +3202,7 @@ bool AfterLoadGame()
|
|||
if (c->settings.renew_keep_length) wagon_removal.Set(c->index);
|
||||
}
|
||||
for (Group *g : Group::Iterate()) {
|
||||
if (g->flags != GroupFlags{}) {
|
||||
if (g->flags.Any()) {
|
||||
/* Convert old replace_protection value to flag. */
|
||||
g->flags = GroupFlag::ReplaceProtection;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue