mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Abort game loading if corrupted mod is found and show explanation
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
#include "mapObjectConstructors/AObjectTypeHandler.h"
|
#include "mapObjectConstructors/AObjectTypeHandler.h"
|
||||||
#include "mapObjectConstructors/CObjectClassesHandler.h"
|
#include "mapObjectConstructors/CObjectClassesHandler.h"
|
||||||
#include "modding/CModHandler.h"
|
#include "modding/CModHandler.h"
|
||||||
|
#include "ExceptionsCommon.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
@@ -670,9 +671,9 @@ CCreature * CCreatureHandler::loadFromJson(const std::string & scope, const Json
|
|||||||
// object does not have any templates - this is not usable object (e.g. pseudo-creature like Arrow Tower)
|
// object does not have any templates - this is not usable object (e.g. pseudo-creature like Arrow Tower)
|
||||||
if (VLC->objtypeh->getHandlerFor(Obj::MONSTER, cre->getId().num)->getTemplates().empty())
|
if (VLC->objtypeh->getHandlerFor(Obj::MONSTER, cre->getId().num)->getTemplates().empty())
|
||||||
{
|
{
|
||||||
assert(cre->special);
|
|
||||||
if (!cre->special)
|
if (!cre->special)
|
||||||
logMod->error("Creature %s does not have valid map object but is not marked as special!", cre->getJsonKey());
|
throw DataLoadingException("Mod " + scope + " is corrupted! Please disable or reinstall this mod. Reason: creature " + cre->getJsonKey() + " has no adventure map animation but is not marked as special!" );
|
||||||
|
|
||||||
VLC->objtypeh->removeSubObject(Obj::MONSTER, cre->getId().num);
|
VLC->objtypeh->removeSubObject(Obj::MONSTER, cre->getId().num);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user