From 83ca09f48379a5eaad3b293ead40c8134402a283 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Tue, 21 Nov 2023 17:23:46 +0200 Subject: [PATCH] Fix loading of allowed heroes from h3m maps --- lib/mapping/MapFormatH3M.cpp | 7 +------ lib/mapping/MapReaderH3M.cpp | 2 ++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/mapping/MapFormatH3M.cpp b/lib/mapping/MapFormatH3M.cpp index 0edefb82c..8387885b0 100644 --- a/lib/mapping/MapFormatH3M.cpp +++ b/lib/mapping/MapFormatH3M.cpp @@ -678,8 +678,6 @@ void CMapLoaderH3M::readTeamInfo() void CMapLoaderH3M::readAllowedHeroes() { - mapHeader->allowedHeroes = VLC->heroh->getDefaultAllowed(); - if(features.levelHOTA0) reader->readBitmaskHeroesSized(mapHeader->allowedHeroes, false); else @@ -749,8 +747,6 @@ void CMapLoaderH3M::readMapOptions() void CMapLoaderH3M::readAllowedArtifacts() { - map->allowedArtifact = VLC->arth->getDefaultAllowed(); - if(features.levelAB) { if(features.levelHOTA0) @@ -1827,9 +1823,8 @@ CGObjectInstance * CMapLoaderH3M::readHero(const int3 & mapPosition, const Objec logGlobal->debug("Hero %s subID=%d has spells set twice (in map properties and on adventure map instance). Using the latter set...", object->getNameTextID(), object->subID); } - object->spells.insert(SpellID::PRESET); //placeholder "preset spells" - reader->readBitmaskSpells(object->spells, false); + object->spells.insert(SpellID::PRESET); //placeholder "preset spells" } } else if(features.levelAB) diff --git a/lib/mapping/MapReaderH3M.cpp b/lib/mapping/MapReaderH3M.cpp index e0ee0a83c..5626b53d5 100644 --- a/lib/mapping/MapReaderH3M.cpp +++ b/lib/mapping/MapReaderH3M.cpp @@ -325,6 +325,8 @@ void MapReaderH3M::readBitmaskSkills(std::set & dest, bool inver template void MapReaderH3M::readBitmask(std::set & dest, int bytesToRead, int objectsToRead, bool invert) { + dest.clear(); + for(int byte = 0; byte < bytesToRead; ++byte) { const ui8 mask = reader->readUInt8();