diff --git a/lib/CArtHandler.cpp b/lib/CArtHandler.cpp index e943b58c6..28baf2412 100644 --- a/lib/CArtHandler.cpp +++ b/lib/CArtHandler.cpp @@ -693,7 +693,7 @@ void CArtHandler::makeItCommanderArt(CArtifact * a, bool onlyCommander) a->possibleSlots[ArtBearer::HERO].clear(); a->possibleSlots[ArtBearer::CREATURE].clear(); } - for(auto & slot : ArtifactUtils::commanderSlots()) + for(const auto & slot : ArtifactUtils::commanderSlots()) a->possibleSlots[ArtBearer::COMMANDER].push_back(ArtifactPosition(slot)); } @@ -1080,7 +1080,7 @@ void CArtifactSet::serializeJsonArtifacts(JsonSerializeFormat & handler, const s void CArtifactSet::serializeJsonHero(JsonSerializeFormat & handler, CMap * map) { - for(auto & slot : ArtifactUtils::allWornSlots()) + for(const auto & slot : ArtifactUtils::allWornSlots()) { serializeJsonSlot(handler, slot, map); } diff --git a/lib/CGameInfoCallback.cpp b/lib/CGameInfoCallback.cpp index 0326ab30a..44de7bee3 100644 --- a/lib/CGameInfoCallback.cpp +++ b/lib/CGameInfoCallback.cpp @@ -16,6 +16,7 @@ #include "gameState/TavernHeroesPool.h" #include "gameState/QuestInfo.h" #include "mapObjects/CGHeroInstance.h" +#include "networkPacks/ArtifactLocation.h" #include "CGeneralTextHandler.h" #include "StartInfo.h" // for StartInfo #include "battle/BattleInfo.h" // for BattleInfo diff --git a/server/battles/BattleResultProcessor.cpp b/server/battles/BattleResultProcessor.cpp index 6d8cb6a79..4b3f60491 100644 --- a/server/battles/BattleResultProcessor.cpp +++ b/server/battles/BattleResultProcessor.cpp @@ -396,7 +396,7 @@ void BattleResultProcessor::endBattleConfirm(const CBattleInfoCallback & battle) for (auto armySlot : battle.battleGetArmyObject(loser)->stacks) { auto artifactsWorn = armySlot.second->artifactsWorn; - for(auto & artSlot : artifactsWorn) + for(const auto & artSlot : artifactsWorn) { MoveArtifact ma; ma.src = ArtifactLocation(finishingBattle->loserHero->id, artSlot.first); diff --git a/server/queries/MapQueries.cpp b/server/queries/MapQueries.cpp index b851646e4..74319bc26 100644 --- a/server/queries/MapQueries.cpp +++ b/server/queries/MapQueries.cpp @@ -17,20 +17,6 @@ #include "../../lib/networkPacks/PacksForServer.h" #include "../../lib/serializer/Cast.h" -struct GetEngagedHeroIds -{ - std::optional operator()(const ConstTransitivePtr & h) const - { - return h->id; - } - std::optional operator()(const ConstTransitivePtr & s) const - { - if(s->armyObj && s->armyObj->ID == Obj::HERO) - return s->armyObj->id; - return std::optional(); - } -}; - TimerPauseQuery::TimerPauseQuery(CGameHandler * owner, PlayerColor player): CQuery(owner) { diff --git a/test/game/CGameStateTest.cpp b/test/game/CGameStateTest.cpp index 02222e712..1c9334d1f 100644 --- a/test/game/CGameStateTest.cpp +++ b/test/game/CGameStateTest.cpp @@ -240,7 +240,7 @@ TEST_F(CGameStateTest, issue2765) gameCallback->sendAndApply(&na); PutArtifact pack; - pack.al = ArtifactLocation(defender, ArtifactPosition::MACH1); + pack.al = ArtifactLocation(defender->id, ArtifactPosition::MACH1); pack.art = a; gameCallback->sendAndApply(&pack); } @@ -334,7 +334,7 @@ TEST_F(CGameStateTest, battleResurrection) gameCallback->sendAndApply(&na); PutArtifact pack; - pack.al = ArtifactLocation(attacker, ArtifactPosition::SPELLBOOK); + pack.al = ArtifactLocation(attacker->id, ArtifactPosition::SPELLBOOK); pack.art = a; gameCallback->sendAndApply(&pack); }