mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
some UniversalId cleanup and enhancements
This commit is contained in:
parent
3e0c6ec732
commit
c6557e1ade
@ -61,8 +61,8 @@ namespace
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Spell, "Spell", ":./spell.png" },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Topic, "Topic", 0 },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Journal, "Journal", 0 },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_TopicInfo, "TopicInfo", 0 },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_JournalInfo, "JournalInfo", 0 },
|
||||
{ CSMWorld::UniversalId::Class_SubRecord, CSMWorld::UniversalId::Type_TopicInfo, "TopicInfo", 0 },
|
||||
{ CSMWorld::UniversalId::Class_SubRecord, CSMWorld::UniversalId::Type_JournalInfo, "JournalInfo", 0 },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Cell, "Cell", ":./cell.png" },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Cell_Missing, "Cell", ":./cell.png" },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Referenceable, "Referenceables", 0 },
|
||||
@ -90,7 +90,7 @@ namespace
|
||||
{ CSMWorld::UniversalId::Class_RefRecord, CSMWorld::UniversalId::Type_Static, "Static", ":./static.png" },
|
||||
{ CSMWorld::UniversalId::Class_RefRecord, CSMWorld::UniversalId::Type_Weapon, "Weapon", ":./weapon.png" },
|
||||
{ CSMWorld::UniversalId::Class_SubRecord, CSMWorld::UniversalId::Type_Reference, "Reference", 0 },
|
||||
{ CSMWorld::UniversalId::Class_SubRecord, CSMWorld::UniversalId::Type_Filter, "Filter", ":./filter.png" },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Filter, "Filter", ":./filter.png" },
|
||||
{ CSMWorld::UniversalId::Class_Collection, CSMWorld::UniversalId::Type_Scene, "Scene", 0 },
|
||||
|
||||
{ CSMWorld::UniversalId::Class_Collection, CSMWorld::UniversalId::Type_Preview, "Preview", 0 },
|
||||
@ -320,6 +320,28 @@ std::vector<CSMWorld::UniversalId::Type> CSMWorld::UniversalId::listReferenceabl
|
||||
return list;
|
||||
}
|
||||
|
||||
CSMWorld::UniversalId::Type CSMWorld::UniversalId::getParentType (Type type)
|
||||
{
|
||||
for (int i=0; sIdArg[i].mType; ++i)
|
||||
if (type==sIdArg[i].mType)
|
||||
{
|
||||
if (sIdArg[i].mClass==Class_RefRecord)
|
||||
return Type_Referenceables;
|
||||
|
||||
if (sIdArg[i].mClass==Class_SubRecord || sIdArg[i].mClass==Class_Record)
|
||||
{
|
||||
if (type==Type_Cell_Missing)
|
||||
return Type_Cells;
|
||||
|
||||
return static_cast<Type> (type-1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return Type_None;
|
||||
}
|
||||
|
||||
bool CSMWorld::operator== (const CSMWorld::UniversalId& left, const CSMWorld::UniversalId& right)
|
||||
{
|
||||
return left.isEqual (right);
|
||||
|
@ -32,6 +32,8 @@ namespace CSMWorld
|
||||
ArgumentType_Index
|
||||
};
|
||||
|
||||
/// \note A record list type must always be immediately followed by the matching
|
||||
/// record type, if this type is of class SubRecord or Record.
|
||||
enum Type
|
||||
{
|
||||
Type_None = 0,
|
||||
@ -86,8 +88,8 @@ namespace CSMWorld
|
||||
Type_References,
|
||||
Type_Reference,
|
||||
Type_RegionMap,
|
||||
Type_Filter,
|
||||
Type_Filters,
|
||||
Type_Filter,
|
||||
Type_Topics,
|
||||
Type_Topic,
|
||||
Type_Journals,
|
||||
@ -147,6 +149,11 @@ namespace CSMWorld
|
||||
///< Will return an empty string, if no icon is available.
|
||||
|
||||
static std::vector<Type> listReferenceableTypes();
|
||||
|
||||
/// If \a type is a SubRecord, RefRecord or Record type return the type of the table
|
||||
/// that contains records of type \a type.
|
||||
/// Otherwise return Type_None.
|
||||
static Type getParentType (Type type);
|
||||
};
|
||||
|
||||
bool operator== (const UniversalId& left, const UniversalId& right);
|
||||
|
Loading…
x
Reference in New Issue
Block a user