Changed Echoes enum properties to choices

This commit is contained in:
Aruki
2018-10-12 21:19:12 -06:00
parent 1d724b69d9
commit 1ef86f0896
75 changed files with 194 additions and 158 deletions

View File

@@ -306,6 +306,33 @@ void SetPropertyName(u32 ID, const char* pkTypeName, const char* pkNewName)
}
}
/** Change the type name associated with a property ID */
void SetTypeName(u32 ID, const char* pkOldTypeName, const char* pkNewTypeName)
{
u32 OldTypeHash = CCRC32::StaticHashString(pkOldTypeName);
u32 NewTypeHash = CCRC32::StaticHashString(pkNewTypeName);
SNameKey OldKey( OldTypeHash, ID );
auto MapNode = gNameMap.extract(OldKey);
if (!MapNode.empty())
{
SNameKey& Key = MapNode.key();
SNameValue& Value = MapNode.mapped();
Key.TypeHash = NewTypeHash;
gHashToTypeName[NewTypeHash] = pkNewTypeName;
for (auto Iter = Value.PropertyList.begin(); Iter != Value.PropertyList.end(); Iter++)
{
IProperty* pProperty = *Iter;
pProperty->RecacheName();
}
gNameMap.insert( std::move(MapNode) );
gMapIsDirty = true;
}
}
/** Registers a property in the name map. Should be called on all properties that use the map */
void RegisterProperty(IProperty* pProperty)
{

View File

@@ -34,6 +34,9 @@ void RetrieveXMLsWithProperty(u32 ID, const char* pkTypeName, std::set<TString>&
/** Updates the name of a given property in the map */
void SetPropertyName(u32 ID, const char* pkTypeName, const char* pkNewName);
/** Change the type name associated with a property ID */
void SetTypeName(u32 ID, const char* pkOldTypeName, const char* pkNewTypeName);
/** Registers a property in the name map. Should be called on all properties that use the map */
void RegisterProperty(IProperty* pProperty);

View File

@@ -416,6 +416,11 @@ bool IProperty::HasAccurateName()
return mFlags.HasFlag( EPropertyFlag::HasCorrectPropertyName );
}
void IProperty::RecacheName()
{
mFlags.ClearFlag( EPropertyFlag::HasCachedNameCheck | EPropertyFlag::HasCorrectPropertyName );
}
/** IPropertyNew Accessors */
EGame IProperty::Game() const
{

View File

@@ -202,6 +202,7 @@ public:
void ClearDirtyFlag();
bool UsesNameMap();
bool HasAccurateName();
void RecacheName();
/** Accessors */
EGame Game() const;