diff --git a/src/Core/Resource/Script/Property/CFlagsProperty.cpp b/src/Core/Resource/Script/Property/CFlagsProperty.cpp index 9349f29a..bd60f973 100644 --- a/src/Core/Resource/Script/Property/CFlagsProperty.cpp +++ b/src/Core/Resource/Script/Property/CFlagsProperty.cpp @@ -5,7 +5,7 @@ void CFlagsProperty::Serialize(IArchive& rArc) { TSerializeableTypedProperty::Serialize(rArc); - CFlagsProperty* pArchetype = static_cast(mpArchetype); + auto* pArchetype = static_cast(mpArchetype); if (!pArchetype || !rArc.CanSkipParameters() || mBitFlags != pArchetype->mBitFlags) { @@ -20,26 +20,26 @@ void CFlagsProperty::PostInitialize() // Create AllFlags mask mAllFlags = 0; - for (int FlagIdx = 0; FlagIdx < mBitFlags.size(); FlagIdx++) - mAllFlags |= mBitFlags[FlagIdx].Mask; + for (const auto& flag : mBitFlags) + mAllFlags |= flag.Mask; } void CFlagsProperty::SerializeValue(void* pData, IArchive& rArc) const { - rArc.SerializePrimitive( (uint32&) ValueRef(pData), SH_HexDisplay ); + rArc.SerializePrimitive((uint32&)ValueRef(pData), SH_HexDisplay); } void CFlagsProperty::InitFromArchetype(IProperty* pOther) { TSerializeableTypedProperty::InitFromArchetype(pOther); - CFlagsProperty* pOtherFlags = static_cast(pOther); + auto* pOtherFlags = static_cast(pOther); mBitFlags = pOtherFlags->mBitFlags; mAllFlags = pOtherFlags->mAllFlags; } TString CFlagsProperty::ValueAsString(void* pData) const { - return TString::FromInt32( Value(pData), 0, 10 ); + return TString::FromInt32(Value(pData), 0, 10); } /** @@ -48,6 +48,8 @@ TString CFlagsProperty::ValueAsString(void* pData) const */ uint32 CFlagsProperty::HasValidValue(void* pPropertyData) { - if (!mAllFlags) return 0; + if (!mAllFlags) + return 0; + return ValueRef(pPropertyData) & ~mAllFlags; }