mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-23 04:04:09 +01:00
Codechange: Use EnumBitSet for EngineMiscFlags.
This commit is contained in:
committed by
Peter Nelson
parent
5664b1e2f6
commit
6c4ddb242a
@@ -150,7 +150,7 @@ void Train::ConsistChanged(ConsistChangeFlags allowed_changes)
|
||||
const Engine *e_u = u->GetEngine();
|
||||
const RailVehicleInfo *rvi_u = &e_u->u.rail;
|
||||
|
||||
if (!HasBit(e_u->info.misc_flags, EF_RAIL_TILTS)) train_can_tilt = false;
|
||||
if (!e_u->info.misc_flags.Test(EngineMiscFlag::RailTilts)) train_can_tilt = false;
|
||||
min_curve_speed_mod = std::min(min_curve_speed_mod, u->GetCurveSpeedModifier());
|
||||
|
||||
/* Cache wagon override sprite group. nullptr is returned if there is none */
|
||||
@@ -439,7 +439,7 @@ void Train::UpdateAcceleration()
|
||||
|
||||
int Train::GetCursorImageOffset() const
|
||||
{
|
||||
if (this->gcache.cached_veh_length != 8 && HasBit(this->flags, VRF_REVERSE_DIRECTION) && !HasBit(EngInfo(this->engine_type)->misc_flags, EF_RAIL_FLIPS)) {
|
||||
if (this->gcache.cached_veh_length != 8 && HasBit(this->flags, VRF_REVERSE_DIRECTION) && !EngInfo(this->engine_type)->misc_flags.Test(EngineMiscFlag::RailFlips)) {
|
||||
int reference_width = TRAININFO_DEFAULT_VEHICLE_WIDTH;
|
||||
|
||||
const Engine *e = this->GetEngine();
|
||||
@@ -469,7 +469,7 @@ int Train::GetDisplayImageWidth(Point *offset) const
|
||||
}
|
||||
|
||||
if (offset != nullptr) {
|
||||
if (HasBit(this->flags, VRF_REVERSE_DIRECTION) && !HasBit(EngInfo(this->engine_type)->misc_flags, EF_RAIL_FLIPS)) {
|
||||
if (HasBit(this->flags, VRF_REVERSE_DIRECTION) && !EngInfo(this->engine_type)->misc_flags.Test(EngineMiscFlag::RailFlips)) {
|
||||
offset->x = ScaleSpriteTrad(((int)this->gcache.cached_veh_length - (int)VEHICLE_LENGTH / 2) * reference_width / (int)VEHICLE_LENGTH);
|
||||
} else {
|
||||
offset->x = ScaleSpriteTrad(reference_width) / 2;
|
||||
@@ -1474,7 +1474,7 @@ void Train::UpdateDeltaXY()
|
||||
this->y_bb_offs = 0;
|
||||
|
||||
/* Set if flipped and engine is NOT flagged with custom flip handling. */
|
||||
int flipped = HasBit(this->flags, VRF_REVERSE_DIRECTION) && !HasBit(EngInfo(this->engine_type)->misc_flags, EF_RAIL_FLIPS);
|
||||
int flipped = HasBit(this->flags, VRF_REVERSE_DIRECTION) && !EngInfo(this->engine_type)->misc_flags.Test(EngineMiscFlag::RailFlips);
|
||||
/* If flipped and vehicle length is odd, we need to adjust the bounding box offset slightly. */
|
||||
int flip_offs = flipped && (this->gcache.cached_veh_length & 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user