1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-15 13:33:36 +02:00

Abort game loading if corrupted mod is found and show explanation

This commit is contained in:
Ivan Savenko 2024-05-23 12:46:19 +00:00
parent 64ad57470c
commit c27dd04a1e

View File

@ -26,6 +26,7 @@
#include "mapObjectConstructors/AObjectTypeHandler.h"
#include "mapObjectConstructors/CObjectClassesHandler.h"
#include "modding/CModHandler.h"
#include "ExceptionsCommon.h"
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)
if (VLC->objtypeh->getHandlerFor(Obj::MONSTER, cre->getId().num)->getTemplates().empty())
{
assert(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);
}
});