瀏覽代碼

Try to detect corrupted mod earlier

Ivan Savenko 1 年之前
父節點
當前提交
52840afb24
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      lib/CCreatureHandler.cpp

+ 6 - 1
lib/CCreatureHandler.cpp

@@ -648,7 +648,7 @@ CCreature * CCreatureHandler::loadFromJson(const std::string & scope, const Json
 	JsonNode advMapFile = node["graphics"]["map"];
 	JsonNode advMapMask = node["graphics"]["mapMask"];
 
-	VLC->identifiers()->requestIdentifier(scope, "object", "monster", [=](si32 index)
+	VLC->identifiers()->requestIdentifier(scope, "object", "monster", [cre, scope, advMapFile, advMapMask](si32 index)
 	{
 		JsonNode conf;
 		conf.setModScope(scope);
@@ -669,7 +669,12 @@ 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());
 			VLC->objtypeh->removeSubObject(Obj::MONSTER, cre->getId().num);
+		}
 	});
 
 	return cre;