浏览代码

Abort game loading if corrupted mod is found and show explanation

Ivan Savenko 1 年之前
父节点
当前提交
c27dd04a1e
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      lib/CCreatureHandler.cpp

+ 3 - 2
lib/CCreatureHandler.cpp

@@ -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);
 		}
 	});