forked from mirror/openmw-tes3mp
check if ID is already in use when creating new IDs
This commit is contained in:
parent
124a70906f
commit
5ec9d370cb
3 changed files with 23 additions and 3 deletions
|
@ -394,4 +394,22 @@ void CSMWorld::Data::loadFile (const boost::filesystem::path& path, bool base)
|
||||||
reader.skipRecord();
|
reader.skipRecord();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CSMWorld::Data::hasId (const std::string& id) const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
getGlobals().searchId (id)!=-1 ||
|
||||||
|
getGmsts().searchId (id)!=-1 ||
|
||||||
|
getSkills().searchId (id)!=-1 ||
|
||||||
|
getClasses().searchId (id)!=-1 ||
|
||||||
|
getFactions().searchId (id)!=-1 ||
|
||||||
|
getRaces().searchId (id)!=-1 ||
|
||||||
|
getSounds().searchId (id)!=-1 ||
|
||||||
|
getScripts().searchId (id)!=-1 ||
|
||||||
|
getRegions().searchId (id)!=-1 ||
|
||||||
|
getBirthsigns().searchId (id)!=-1 ||
|
||||||
|
getSpells().searchId (id)!=-1 ||
|
||||||
|
getCells().searchId (id)!=-1 ||
|
||||||
|
getReferenceables().searchId (id)!=-1;
|
||||||
|
}
|
||||||
|
|
|
@ -123,6 +123,8 @@ namespace CSMWorld
|
||||||
|
|
||||||
void loadFile (const boost::filesystem::path& path, bool base);
|
void loadFile (const boost::filesystem::path& path, bool base);
|
||||||
///< Merging content of a file into base or modified.
|
///< Merging content of a file into base or modified.
|
||||||
|
|
||||||
|
bool hasId (const std::string& id) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,9 +68,9 @@ std::string CSVWorld::GenericCreator::getErrors() const
|
||||||
{
|
{
|
||||||
errors = "Missing ID";
|
errors = "Missing ID";
|
||||||
}
|
}
|
||||||
else
|
else if (mData.hasId (id))
|
||||||
{
|
{
|
||||||
|
errors = "ID is already in use";
|
||||||
}
|
}
|
||||||
|
|
||||||
return errors;
|
return errors;
|
||||||
|
|
Loading…
Reference in a new issue