1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Merge pull request #1056 from vcmi/fix-1054

#1054 - fix crash and UI
This commit is contained in:
Andrii Danylchenko 2022-10-05 09:02:14 +03:00 committed by GitHub
commit 14b21df939
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 11 deletions

View File

@ -203,8 +203,8 @@ if(WIN32)
if(MSVC) if(MSVC)
add_custom_command(TARGET vcmiclient POST_BUILD add_custom_command(TARGET vcmiclient POST_BUILD
WORKING_DIRECTORY "$<TARGET_FILE_DIR:vcmiclient>" WORKING_DIRECTORY "$<TARGET_FILE_DIR:vcmiclient>"
COMMAND ${CMAKE_COMMAND} -E rename AI/fuzzylite.dll fuzzylite.dll COMMAND ${CMAKE_COMMAND} -E copy AI/fuzzylite.dll fuzzylite.dll
COMMAND ${CMAKE_COMMAND} -E rename AI/tbb.dll tbb.dll COMMAND ${CMAKE_COMMAND} -E copy AI/tbb.dll tbb.dll
) )
endif() endif()
elseif(APPLE_IOS) elseif(APPLE_IOS)

View File

@ -737,7 +737,7 @@ void CStackWindow::init()
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE); OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
if(!info->stackNode) 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; selectedIcon = nullptr;
selectedSkill = -1; selectedSkill = -1;

View File

@ -47,8 +47,8 @@ void CreaturePurchaseCard::switchCreatureLevel()
auto index = vstd::find_pos(upgradesID, creatureOnTheCard->idNumber); auto index = vstd::find_pos(upgradesID, creatureOnTheCard->idNumber);
auto nextCreatureId = vstd::circularAt(upgradesID, ++index); auto nextCreatureId = vstd::circularAt(upgradesID, ++index);
creatureOnTheCard = nextCreatureId.toCreature(); creatureOnTheCard = nextCreatureId.toCreature();
creatureClickArea = std::make_shared<CCreatureClickArea>(Point(pos.x + CCreatureClickArea::CREATURE_X_POS, pos.y + CCreatureClickArea::CREATURE_Y_POS), picture, creatureOnTheCard);
picture = std::make_shared<CCreaturePic>(parent->pos.x, parent->pos.y, creatureOnTheCard); picture = std::make_shared<CCreaturePic>(parent->pos.x, parent->pos.y, creatureOnTheCard);
creatureClickArea = std::make_shared<CCreatureClickArea>(Point(parent->pos.x, parent->pos.y), picture, creatureOnTheCard);
parent->updateAllSliders(); parent->updateAllSliders();
cost->set(creatureOnTheCard->cost * slider->getValue()); cost->set(creatureOnTheCard->cost * slider->getValue());
} }
@ -98,12 +98,11 @@ void CreaturePurchaseCard::initView()
{ {
picture = std::make_shared<CCreaturePic>(pos.x, pos.y, creatureOnTheCard); picture = std::make_shared<CCreaturePic>(pos.x, pos.y, creatureOnTheCard);
background = std::make_shared<CPicture>("QuickRecruitmentWindow/CreaturePurchaseCard.png", pos.x-4, pos.y-50); background = std::make_shared<CPicture>("QuickRecruitmentWindow/CreaturePurchaseCard.png", pos.x-4, pos.y-50);
initButtons(); creatureClickArea = std::make_shared<CCreatureClickArea>(Point(pos.x, pos.y), picture, creatureOnTheCard);
creatureClickArea = std::make_shared<CCreatureClickArea>(Point(pos.x + CCreatureClickArea::CREATURE_X_POS, pos.y + CCreatureClickArea::CREATURE_Y_POS), picture, creatureOnTheCard);
initAmountInfo(); initAmountInfo();
initSlider(); initSlider();
initButtons(); // order important! buttons need slider!
initCostBox(); initCostBox();
} }
@ -111,8 +110,8 @@ CreaturePurchaseCard::CCreatureClickArea::CCreatureClickArea(const Point & posit
: CIntObject(RCLICK), : CIntObject(RCLICK),
creatureOnTheCard(creatureOnTheCard) creatureOnTheCard(creatureOnTheCard)
{ {
pos.x = position.x; pos.x += position.x;
pos.y = position.y; pos.y += position.y;
pos.w = CREATURE_WIDTH; pos.w = CREATURE_WIDTH;
pos.h = CREATURE_HEIGHT; pos.h = CREATURE_HEIGHT;
} }

View File

@ -56,8 +56,6 @@ private:
// used to set positions were obtained; commit messages don't document it // used to set positions were obtained; commit messages don't document it
static constexpr int CREATURE_WIDTH = 110; static constexpr int CREATURE_WIDTH = 110;
static constexpr int CREATURE_HEIGHT = 132; static constexpr int CREATURE_HEIGHT = 132;
static constexpr int CREATURE_X_POS = 15;
static constexpr int CREATURE_Y_POS = 44;
}; };
std::shared_ptr<CButton> maxButton, minButton, creatureSwitcher; std::shared_ptr<CButton> maxButton, minButton, creatureSwitcher;