From 52840afb24d4e73b1baf2eea678bf27ed99ee686 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Mon, 20 May 2024 11:00:35 +0000 Subject: [PATCH] Try to detect corrupted mod earlier --- lib/CCreatureHandler.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/CCreatureHandler.cpp b/lib/CCreatureHandler.cpp index 0e6293449..63ae1394e 100644 --- a/lib/CCreatureHandler.cpp +++ b/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;