1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Fix artifacts providing hero with banned spells

Tomes of X Spells and Spellbinder's Hat (and any other sources for such
bonuses from mods) will no longer provide spells that are banned on map.

Option is only active for random maps and for HotA h3m's. RoE-SoD .h3m's
work as before.

If needed, behavior can be changed in config
This commit is contained in:
Ivan Savenko
2025-07-26 19:41:39 +03:00
parent 7fcb0246fb
commit 1f9a1dbf37
10 changed files with 48 additions and 28 deletions

View File

@@ -15,6 +15,7 @@
#include "../entities/faction/CFaction.h"
#include "../entities/faction/CTownHandler.h"
#include "../filesystem/Filesystem.h"
#include "../json/JsonUtils.h"
#include "../mapObjectConstructors/AObjectTypeHandler.h"
#include "../mapObjectConstructors/CObjectClassesHandler.h"
#include "../mapObjects/ObjectTemplate.h"
@@ -39,6 +40,10 @@ void MapIdentifiersH3M::loadMapping(const JsonNode & mapping)
if (!mapping["supported"].Bool())
throw std::runtime_error("Unsupported map format!");
formatSettings.Struct(); // change type
if (!mapping["settings"].isNull())
JsonUtils::inherit(formatSettings, mapping["settings"]);
for (auto entryFaction : mapping["buildings"].Struct())
{
FactionID factionID (*LIBRARY->identifiers()->getIdentifier(entryFaction.second.getModScope(), "faction", entryFaction.first));