Codechange: Use EnumBitSet for RailTypes.
This commit is contained in:
committed by
Peter Nelson
parent
732109e444
commit
47d078c033
@@ -333,7 +333,7 @@ protected:
|
||||
/* rail transport is possible only on compatible rail types */
|
||||
if (IsRailTT()) {
|
||||
RailType rail_type = GetTileRailType(this->new_tile);
|
||||
if (!HasBit(this->railtypes, rail_type)) {
|
||||
if (!this->railtypes.Test(rail_type)) {
|
||||
/* incompatible rail type */
|
||||
this->err = EC_RAIL_ROAD_TYPE;
|
||||
return false;
|
||||
|
||||
@@ -22,12 +22,12 @@ public:
|
||||
void SetDestination(const Train *v, bool override_rail_type = false)
|
||||
{
|
||||
this->compatible_railtypes = v->compatible_railtypes;
|
||||
if (override_rail_type) this->compatible_railtypes |= GetRailTypeInfo(v->railtype)->compatible_railtypes;
|
||||
if (override_rail_type) this->compatible_railtypes.Set(GetRailTypeInfo(v->railtype)->compatible_railtypes);
|
||||
}
|
||||
|
||||
bool IsCompatibleRailType(RailType rt)
|
||||
{
|
||||
return HasBit(this->compatible_railtypes, rt);
|
||||
return this->compatible_railtypes.Test(rt);
|
||||
}
|
||||
|
||||
RailTypes GetCompatibleRailTypes() const
|
||||
|
||||
Reference in New Issue
Block a user