1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

fix test & fix build & suggested changes

This commit is contained in:
SoundSSGood 2023-10-24 17:32:09 +03:00
parent c2f658d638
commit 7e6ab5e87b
5 changed files with 6 additions and 19 deletions

View File

@ -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);
}

View File

@ -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

View File

@ -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);

View File

@ -17,20 +17,6 @@
#include "../../lib/networkPacks/PacksForServer.h"
#include "../../lib/serializer/Cast.h"
struct GetEngagedHeroIds
{
std::optional<ObjectInstanceID> operator()(const ConstTransitivePtr<CGHeroInstance> & h) const
{
return h->id;
}
std::optional<ObjectInstanceID> operator()(const ConstTransitivePtr<CStackInstance> & s) const
{
if(s->armyObj && s->armyObj->ID == Obj::HERO)
return s->armyObj->id;
return std::optional<ObjectInstanceID>();
}
};
TimerPauseQuery::TimerPauseQuery(CGameHandler * owner, PlayerColor player):
CQuery(owner)
{

View File

@ -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);
}