1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-17 00:07:41 +02:00

- H3 creatures use subset of mod creature format (todo - unify code)

- creatures configs moved into confg/creatures files, similar to factions.
 - creatures ID's use same camelCase format as the rest of the game
This commit is contained in:
Ivan Savenko
2012-12-22 16:47:12 +00:00
parent 406d43dc27
commit 8824f5e2d5
35 changed files with 4086 additions and 3495 deletions

View File

@ -21,19 +21,30 @@
*
*/
class CArtHandler;
class CHeroHandler;
class CCreatureHandler;
class CSpellHandler;
class CBuildingHandler;
class CObjectHandler;
class CDefObjInfoHandler;
class CTownHandler;
class CGeneralTextHandler;
class ResourceLocator;
void CIdentifierStorage::checkIdentifier(std::string & ID)
{
if (boost::algorithm::ends_with(ID, "."))
tlog0 << "BIG WARNING: identifier " << ID << " seems to be broken!\n";
else
{
size_t pos = 0;
do
{
if (std::tolower(ID[pos]) != ID[pos] ) //Not in camelCase
{
tlog0 << "Warning: identifier " << ID << " is not in camelCase!\n";
ID[pos] = std::tolower(ID[pos]);// Try to fix the ID
}
pos = ID.find('.', pos);
}
while(pos++ != std::string::npos);
}
}
void CIdentifierStorage::requestIdentifier(std::string name, const boost::function<void(si32)> & callback)
{
checkIdentifier(name);
auto iter = registeredObjects.find(name);
if (iter != registeredObjects.end())
@ -44,6 +55,8 @@ void CIdentifierStorage::requestIdentifier(std::string name, const boost::functi
void CIdentifierStorage::registerObject(std::string name, si32 identifier)
{
checkIdentifier(name);
// do not allow to register same object twice
assert(registeredObjects.find(name) == registeredObjects.end());