From b83a40db87f79d6e43a7237076dc2909d25b009b Mon Sep 17 00:00:00 2001 From: Andrii Danylchenko Date: Tue, 4 Oct 2022 21:30:18 +0300 Subject: [PATCH] #1054 - fix crash and UI --- client/CMakeLists.txt | 4 ++-- client/windows/CCreatureWindow.cpp | 2 +- client/windows/CreaturePurchaseCard.cpp | 11 +++++------ client/windows/CreaturePurchaseCard.h | 2 -- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 869772e0b..b0a9f614a 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -203,8 +203,8 @@ if(WIN32) if(MSVC) add_custom_command(TARGET vcmiclient POST_BUILD WORKING_DIRECTORY "$" - COMMAND ${CMAKE_COMMAND} -E rename AI/fuzzylite.dll fuzzylite.dll - COMMAND ${CMAKE_COMMAND} -E rename AI/tbb.dll tbb.dll + COMMAND ${CMAKE_COMMAND} -E copy AI/fuzzylite.dll fuzzylite.dll + COMMAND ${CMAKE_COMMAND} -E copy AI/tbb.dll tbb.dll ) endif() elseif(APPLE_IOS) diff --git a/client/windows/CCreatureWindow.cpp b/client/windows/CCreatureWindow.cpp index 6023b58d9..9ddefbca6 100644 --- a/client/windows/CCreatureWindow.cpp +++ b/client/windows/CCreatureWindow.cpp @@ -737,7 +737,7 @@ void CStackWindow::init() OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE); if(!info->stackNode) - info->stackNode = new CStackInstance(info->creature, 1);// FIXME: free data + info->stackNode = new CStackInstance(info->creature, 1, true);// FIXME: free data selectedIcon = nullptr; selectedSkill = -1; diff --git a/client/windows/CreaturePurchaseCard.cpp b/client/windows/CreaturePurchaseCard.cpp index 7944709fe..d04d54241 100644 --- a/client/windows/CreaturePurchaseCard.cpp +++ b/client/windows/CreaturePurchaseCard.cpp @@ -47,8 +47,8 @@ void CreaturePurchaseCard::switchCreatureLevel() auto index = vstd::find_pos(upgradesID, creatureOnTheCard->idNumber); auto nextCreatureId = vstd::circularAt(upgradesID, ++index); creatureOnTheCard = nextCreatureId.toCreature(); - creatureClickArea = std::make_shared(Point(pos.x + CCreatureClickArea::CREATURE_X_POS, pos.y + CCreatureClickArea::CREATURE_Y_POS), picture, creatureOnTheCard); picture = std::make_shared(parent->pos.x, parent->pos.y, creatureOnTheCard); + creatureClickArea = std::make_shared(Point(parent->pos.x, parent->pos.y), picture, creatureOnTheCard); parent->updateAllSliders(); cost->set(creatureOnTheCard->cost * slider->getValue()); } @@ -98,12 +98,11 @@ void CreaturePurchaseCard::initView() { picture = std::make_shared(pos.x, pos.y, creatureOnTheCard); background = std::make_shared("QuickRecruitmentWindow/CreaturePurchaseCard.png", pos.x-4, pos.y-50); - initButtons(); - - creatureClickArea = std::make_shared(Point(pos.x + CCreatureClickArea::CREATURE_X_POS, pos.y + CCreatureClickArea::CREATURE_Y_POS), picture, creatureOnTheCard); + creatureClickArea = std::make_shared(Point(pos.x, pos.y), picture, creatureOnTheCard); initAmountInfo(); initSlider(); + initButtons(); // order important! buttons need slider! initCostBox(); } @@ -111,8 +110,8 @@ CreaturePurchaseCard::CCreatureClickArea::CCreatureClickArea(const Point & posit : CIntObject(RCLICK), creatureOnTheCard(creatureOnTheCard) { - pos.x = position.x; - pos.y = position.y; + pos.x += position.x; + pos.y += position.y; pos.w = CREATURE_WIDTH; pos.h = CREATURE_HEIGHT; } diff --git a/client/windows/CreaturePurchaseCard.h b/client/windows/CreaturePurchaseCard.h index 00e08a663..77fa16e8c 100644 --- a/client/windows/CreaturePurchaseCard.h +++ b/client/windows/CreaturePurchaseCard.h @@ -56,8 +56,6 @@ private: // used to set positions were obtained; commit messages don't document it static constexpr int CREATURE_WIDTH = 110; static constexpr int CREATURE_HEIGHT = 132; - static constexpr int CREATURE_X_POS = 15; - static constexpr int CREATURE_Y_POS = 44; }; std::shared_ptr maxButton, minButton, creatureSwitcher;