From 1175990724552e00306525fdf5e4787ba6de57b9 Mon Sep 17 00:00:00 2001 From: SoundSSGood <87084363+SoundSSGood@users.noreply.github.com> Date: Wed, 17 May 2023 17:05:09 +0300 Subject: [PATCH] fixup --- client/widgets/CArtifactsOfHeroAltar.cpp | 2 +- cmake_modules/VCMI_lib.cmake | 3 ++- lib/ArtifactUtils.cpp | 9 ++++----- lib/ArtifactUtils.h | 5 +++-- lib/CArtHandler.cpp | 2 +- mapeditor/inspector/inspector.cpp | 5 +++-- mapeditor/mapcontroller.cpp | 3 ++- 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/client/widgets/CArtifactsOfHeroAltar.cpp b/client/widgets/CArtifactsOfHeroAltar.cpp index 78ab25dbd..b7cfa150c 100644 --- a/client/widgets/CArtifactsOfHeroAltar.cpp +++ b/client/widgets/CArtifactsOfHeroAltar.cpp @@ -82,7 +82,7 @@ void CArtifactsOfHeroAltar::pickedArtMoveToAltar(const ArtifactPosition & slot) { if(ArtifactUtils::isSlotBackpack(slot) || ArtifactUtils::isSlotEquipment(slot) || slot == ArtifactPosition::TRANSITION_POS) { - assert(!curHero->getSlot(pickedArtFromSlot)->getArt()); + assert(curHero->getSlot(slot)->getArt()); LOCPLINT->cb->swapArtifacts(ArtifactLocation(curHero, slot), ArtifactLocation(curHero, pickedArtFromSlot)); pickedArtFromSlot = ArtifactPosition::PRE_FIRST; } diff --git a/cmake_modules/VCMI_lib.cmake b/cmake_modules/VCMI_lib.cmake index 0fb2c9d55..4ef58ce4c 100644 --- a/cmake_modules/VCMI_lib.cmake +++ b/cmake_modules/VCMI_lib.cmake @@ -184,7 +184,7 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE) ${MAIN_LIB_DIR}/vstd/StringUtils.cpp - ${MAIN_LIB_DIR}/ArtifactUtils.cpp + ${MAIN_LIB_DIR}/ArtifactUtils.cpp ${MAIN_LIB_DIR}/BasicTypes.cpp ${MAIN_LIB_DIR}/BattleFieldHandler.cpp ${MAIN_LIB_DIR}/CAndroidVMHelper.cpp @@ -470,6 +470,7 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE) ${MAIN_LIB_DIR}/spells/effects/Sacrifice.h ${MAIN_LIB_DIR}/AI_Base.h + ${MAIN_LIB_DIR}/ArtifactUtils.h ${MAIN_LIB_DIR}/BattleFieldHandler.h ${MAIN_LIB_DIR}/CAndroidVMHelper.h ${MAIN_LIB_DIR}/CArtHandler.h diff --git a/lib/ArtifactUtils.cpp b/lib/ArtifactUtils.cpp index 2811810ea..5f6c9fbff 100644 --- a/lib/ArtifactUtils.cpp +++ b/lib/ArtifactUtils.cpp @@ -1,5 +1,5 @@ /* - * CArtHandler.cpp, part of VCMI engine + * ArtifactUtils.cpp, part of VCMI engine * * Authors: listed in file AUTHORS in main folder * @@ -8,12 +8,11 @@ * */ -#include "StdInc.h" -#include "CArtHandler.h" - -#include "GameSettings.h" #include "ArtifactUtils.h" +#include "CArtHandler.h" +#include "GameSettings.h" + #include "mapping/CMap.h" VCMI_LIB_NAMESPACE_BEGIN diff --git a/lib/ArtifactUtils.h b/lib/ArtifactUtils.h index dedc07b74..487ce238a 100644 --- a/lib/ArtifactUtils.h +++ b/lib/ArtifactUtils.h @@ -1,5 +1,5 @@ /* - * CArtHandler.h, part of VCMI engine + * ArtifactUtils.h, part of VCMI engine * * Authors: listed in file AUTHORS in main folder * @@ -9,7 +9,8 @@ */ #pragma once -#include +#include "StdInc.h" + #include "GameConstants.h" VCMI_LIB_NAMESPACE_BEGIN diff --git a/lib/CArtHandler.cpp b/lib/CArtHandler.cpp index 1a9badeca..be1d83a53 100644 --- a/lib/CArtHandler.cpp +++ b/lib/CArtHandler.cpp @@ -933,7 +933,7 @@ void CCombinedArtifactInstance::addAsConstituent(CArtifactInstance * art, const void CCombinedArtifactInstance::removeFrom(ArtifactLocation al) { CArtifactInstance::removeFrom(al); - for(auto & part : constituentsInfo) + for (auto& part : constituentsInfo) { if(part.slot != ArtifactPosition::PRE_FIRST) part.slot = ArtifactPosition::PRE_FIRST; diff --git a/mapeditor/inspector/inspector.cpp b/mapeditor/inspector/inspector.cpp index ee9599a1b..4bfa8a0c7 100644 --- a/mapeditor/inspector/inspector.cpp +++ b/mapeditor/inspector/inspector.cpp @@ -9,6 +9,7 @@ */ #include "StdInc.h" #include "inspector.h" +#include "../lib/ArtifactUtils.h" #include "../lib/CArtHandler.h" #include "../lib/spells/CSpellHandler.h" #include "../lib/CHeroHandler.h" @@ -171,7 +172,7 @@ void Initializer::initialize(CGArtifact * o) out.push_back(spell->id); } } - auto a = CArtifactInstance::createScroll(*RandomGeneratorUtil::nextItem(out, CRandomGenerator::getDefault())); + auto a = ArtifactUtils::createScroll(*RandomGeneratorUtil::nextItem(out, CRandomGenerator::getDefault())); o->storedArtifact = a; } } @@ -528,7 +529,7 @@ void Inspector::setProperty(CGArtifact * o, const QString & key, const QVariant { if(spell->getJsonKey() == value.toString().toStdString()) { - o->storedArtifact = CArtifactInstance::createScroll(spell->getId()); + o->storedArtifact = ArtifactUtils::createScroll(spell->getId()); break; } } diff --git a/mapeditor/mapcontroller.cpp b/mapeditor/mapcontroller.cpp index e4faf8d5f..8d40b01e9 100644 --- a/mapeditor/mapcontroller.cpp +++ b/mapeditor/mapcontroller.cpp @@ -10,6 +10,7 @@ #include "mapcontroller.h" +#include "../lib/ArtifactUtils.h" #include "../lib/GameConstants.h" #include "../lib/mapping/CMapService.h" #include "../lib/mapping/CMap.h" @@ -185,7 +186,7 @@ void MapController::repairMap() out.push_back(spell->id); } } - auto a = CArtifactInstance::createScroll(*RandomGeneratorUtil::nextItem(out, CRandomGenerator::getDefault())); + auto a = ArtifactUtils::createScroll(*RandomGeneratorUtil::nextItem(out, CRandomGenerator::getDefault())); art->storedArtifact = a; } else