1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

Converted attributes to use c++17 functionality

This commit is contained in:
Ivan Savenko
2023-04-10 17:44:41 +03:00
parent 2150eabfc5
commit 63b197b78a
14 changed files with 15 additions and 47 deletions

View File

@ -1463,9 +1463,8 @@ void NewObject::applyGs(CGameState *gs)
testObject.pos = pos;
testObject.appearance = VLC->objtypeh->getHandlerFor(ID, subID)->getTemplates(ETerrainId::WATER).front();
const int3 previousXAxisTile = int3(pos.x - 1, pos.y, pos.z);
[[maybe_unused]] const int3 previousXAxisTile = int3(pos.x - 1, pos.y, pos.z);
assert(gs->isInTheMap(previousXAxisTile) && (testObject.visitablePos() == previousXAxisTile));
MAYBE_UNUSED(previousXAxisTile);
}
else
{
@ -1689,10 +1688,9 @@ void RebalanceStacks::applyGs(CGameState * gs)
if(srcCount == count) //moving whole stack
{
if(const CCreature *c = dst.army->getCreature(dst.slot)) //stack at dest -> merge
if([[maybe_unused]] const CCreature *c = dst.army->getCreature(dst.slot)) //stack at dest -> merge
{
assert(c == srcType);
MAYBE_UNUSED(c);
auto alHere = ArtifactLocation (src.getStack(), ArtifactPosition::CREATURE_SLOT);
auto alDest = ArtifactLocation (dst.getStack(), ArtifactPosition::CREATURE_SLOT);
auto * artHere = alHere.getArt();
@ -1744,10 +1742,9 @@ void RebalanceStacks::applyGs(CGameState * gs)
}
else
{
if(const CCreature *c = dst.army->getCreature(dst.slot)) //stack at dest -> rebalance
if([[maybe_unused]] const CCreature *c = dst.army->getCreature(dst.slot)) //stack at dest -> rebalance
{
assert(c == srcType);
MAYBE_UNUSED(c);
if (stackExp)
{
ui64 totalExp = srcCount * src.army->getStackExperience(src.slot) + dst.army->getStackCount(dst.slot) * dst.army->getStackExperience(dst.slot);
@ -1912,14 +1909,13 @@ void BulkMoveArtifacts::applyGs(CGameState * gs)
void AssembledArtifact::applyGs(CGameState *gs)
{
CArtifactSet * artSet = al.getHolderArtSet();
const CArtifactInstance *transformedArt = al.getArt();
[[maybe_unused]] const CArtifactInstance *transformedArt = al.getArt();
assert(transformedArt);
bool combineEquipped = !ArtifactUtils::isSlotBackpack(al.slot);
assert(vstd::contains_if(transformedArt->assemblyPossibilities(artSet, combineEquipped), [=](const CArtifact * art)->bool
{
return art->getId() == builtArt->getId();
}));
MAYBE_UNUSED(transformedArt);
auto * combinedArt = new CCombinedArtifactInstance(builtArt);
gs->map->addNewArtifactInstance(combinedArt);