mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-20 04:41:32 +00:00
changed UniversalId to string conversion
This commit is contained in:
parent
9fe7ff9690
commit
832fc56d34
2 changed files with 40 additions and 35 deletions
|
@ -17,5 +17,5 @@ void CSMTools::MandatoryIdStage::perform (int stage, std::vector<std::string>& m
|
||||||
{
|
{
|
||||||
if (mIdCollection.searchId (mIds.at (stage))==-1 ||
|
if (mIdCollection.searchId (mIds.at (stage))==-1 ||
|
||||||
mIdCollection.getRecord (mIds.at (stage)).isDeleted())
|
mIdCollection.getRecord (mIds.at (stage)).isDeleted())
|
||||||
messages.push_back (mCollectionId.toString() + " Missing mandatory record: " + mIds.at (stage));
|
messages.push_back (mCollectionId.toString() + "|Missing mandatory record: " + mIds.at (stage));
|
||||||
}
|
}
|
|
@ -43,6 +43,8 @@ CSMWorld::UniversalId::UniversalId (const std::string& universalId)
|
||||||
{
|
{
|
||||||
std::string type = universalId.substr (0, index);
|
std::string type = universalId.substr (0, index);
|
||||||
|
|
||||||
|
if (index==std::string::npos)
|
||||||
|
{
|
||||||
for (int i=0; sNoArg[i].mName; ++i)
|
for (int i=0; sNoArg[i].mName; ++i)
|
||||||
if (type==sNoArg[i].mName)
|
if (type==sNoArg[i].mName)
|
||||||
{
|
{
|
||||||
|
@ -51,7 +53,9 @@ CSMWorld::UniversalId::UniversalId (const std::string& universalId)
|
||||||
mClass = sNoArg[i].mClass;
|
mClass = sNoArg[i].mClass;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
for (int i=0; sIdArg[i].mName; ++i)
|
for (int i=0; sIdArg[i].mName; ++i)
|
||||||
if (type==sIdArg[i].mName)
|
if (type==sIdArg[i].mName)
|
||||||
{
|
{
|
||||||
|
@ -77,6 +81,7 @@ CSMWorld::UniversalId::UniversalId (const std::string& universalId)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
throw std::runtime_error ("invalid UniversalId: " + universalId);
|
throw std::runtime_error ("invalid UniversalId: " + universalId);
|
||||||
}
|
}
|
||||||
|
@ -197,13 +202,13 @@ std::string CSMWorld::UniversalId::toString() const
|
||||||
{
|
{
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
|
|
||||||
stream << getTypeName() << ":";
|
stream << getTypeName();
|
||||||
|
|
||||||
switch (mArgumentType)
|
switch (mArgumentType)
|
||||||
{
|
{
|
||||||
case ArgumentType_None: break;
|
case ArgumentType_None: break;
|
||||||
case ArgumentType_Id: stream << " " << mId;
|
case ArgumentType_Id: stream << ": " << mId;
|
||||||
case ArgumentType_Index: stream << " " << mIndex;
|
case ArgumentType_Index: stream << ": " << mIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
return stream.str();
|
return stream.str();
|
||||||
|
|
Loading…
Reference in a new issue