forked from mirror/openmw-tes3mp
multiple fixes to UniversalId constructor
This commit is contained in:
parent
0fb583e065
commit
9bc3945f40
1 changed files with 33 additions and 36 deletions
|
@ -55,26 +55,13 @@ 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)
|
|
||||||
if (type==sNoArg[i].mName)
|
|
||||||
{
|
|
||||||
mArgumentType = ArgumentType_None;
|
|
||||||
mType = sNoArg[i].mType;
|
|
||||||
mClass = sNoArg[i].mClass;
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
mArgumentType = ArgumentType_Id;
|
mArgumentType = ArgumentType_Id;
|
||||||
mType = sIdArg[i].mType;
|
mType = sIdArg[i].mType;
|
||||||
mClass = sIdArg[i].mClass;
|
mClass = sIdArg[i].mClass;
|
||||||
mId = universalId.substr (0, index);
|
mId = universalId.substr (index+2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +72,7 @@ CSMWorld::UniversalId::UniversalId (const std::string& universalId)
|
||||||
mType = sIndexArg[i].mType;
|
mType = sIndexArg[i].mType;
|
||||||
mClass = sIndexArg[i].mClass;
|
mClass = sIndexArg[i].mClass;
|
||||||
|
|
||||||
std::istringstream stream (universalId.substr (0, index));
|
std::istringstream stream (universalId.substr (index+2));
|
||||||
|
|
||||||
if (stream >> mIndex)
|
if (stream >> mIndex)
|
||||||
return;
|
return;
|
||||||
|
@ -93,6 +80,16 @@ CSMWorld::UniversalId::UniversalId (const std::string& universalId)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i=0; sNoArg[i].mName; ++i)
|
||||||
|
if (universalId==sNoArg[i].mName)
|
||||||
|
{
|
||||||
|
mArgumentType = ArgumentType_None;
|
||||||
|
mType = sNoArg[i].mType;
|
||||||
|
mClass = sNoArg[i].mClass;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw std::runtime_error ("invalid UniversalId: " + universalId);
|
throw std::runtime_error ("invalid UniversalId: " + universalId);
|
||||||
|
|
Loading…
Reference in a new issue