mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Regressions fixed
This commit is contained in:
parent
2cdf2b4083
commit
cb6fc4a385
@ -44,23 +44,21 @@ CArtifactsOfHeroBackpack::CArtifactsOfHeroBackpack()
|
||||
|
||||
void CArtifactsOfHeroBackpack::onSliderMoved(int newVal)
|
||||
{
|
||||
if(backpackListBox)
|
||||
backpackListBox->resize(getActiveSlotRowsNum());
|
||||
backpackPos += newVal;
|
||||
auto slot = ArtifactPosition::BACKPACK_START + backpackPos;
|
||||
for(auto artPlace : backpack)
|
||||
{
|
||||
setSlotData(artPlace, slot);
|
||||
slot = slot + 1;
|
||||
}
|
||||
redraw();
|
||||
updateBackpackSlots();
|
||||
}
|
||||
|
||||
void CArtifactsOfHeroBackpack::updateBackpackSlots()
|
||||
{
|
||||
if(backpackListBox)
|
||||
backpackListBox->resize(getActiveSlotRowsNum());
|
||||
CArtifactsOfHeroBase::updateBackpackSlots();
|
||||
auto slot = ArtifactPosition::BACKPACK_START + backpackPos;
|
||||
for(const auto & artPlace : backpack)
|
||||
{
|
||||
setSlotData(artPlace, slot);
|
||||
slot = slot + 1;
|
||||
}
|
||||
redraw();
|
||||
}
|
||||
|
||||
size_t CArtifactsOfHeroBackpack::getActiveSlotRowsNum()
|
||||
|
@ -89,18 +89,11 @@ void CAltarArtifacts::update()
|
||||
CMarketBase::update();
|
||||
CExperienceAltar::update();
|
||||
if(const auto art = hero->getArt(ArtifactPosition::TRANSITION_POS))
|
||||
{
|
||||
offerTradePanel->showcaseSlot->setID(art->getTypeId().num);
|
||||
offerTradePanel->highlightedSlot = offerTradePanel->showcaseSlot;
|
||||
offerQty = calcExpCost(art->getTypeId());
|
||||
}
|
||||
else
|
||||
{
|
||||
offerTradePanel->showcaseSlot->clear();
|
||||
offerTradePanel->highlightedSlot.reset();
|
||||
offerQty = 0;
|
||||
}
|
||||
updateShowcases();
|
||||
redraw();
|
||||
}
|
||||
|
||||
void CAltarArtifacts::makeDeal()
|
||||
@ -191,10 +184,10 @@ void CAltarArtifacts::putBackArtifacts()
|
||||
|
||||
CMarketBase::MarketShowcasesParams CAltarArtifacts::getShowcasesParams() const
|
||||
{
|
||||
if(offerTradePanel->isHighlighted())
|
||||
if(const auto art = hero->getArt(ArtifactPosition::TRANSITION_POS))
|
||||
return std::make_tuple(
|
||||
std::nullopt,
|
||||
ShowcaseParams {std::to_string(offerQty), CGI->artifacts()->getByIndex(offerTradePanel->getSelectedItemId())->getIconIndex()}
|
||||
ShowcaseParams {std::to_string(offerQty), CGI->artifacts()->getByIndex(art->getTypeId())->getIconIndex()}
|
||||
);
|
||||
return std::make_tuple(std::nullopt, std::nullopt);
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "../../../CCallback.h"
|
||||
|
||||
#include "../../../lib/CGeneralTextHandler.h"
|
||||
#include "../../../lib/mapObjects/CGHeroInstance.h"
|
||||
#include "../../../lib/mapObjects/CGMarket.h"
|
||||
#include "../../../lib/mapObjects/CGTownInstance.h"
|
||||
|
||||
@ -71,10 +72,17 @@ void CArtifactsBuying::deselect()
|
||||
|
||||
void CArtifactsBuying::makeDeal()
|
||||
{
|
||||
LOCPLINT->cb->trade(market, EMarketMode::RESOURCE_ARTIFACT, GameResID(bidTradePanel->getSelectedItemId()),
|
||||
ArtifactID(offerTradePanel->highlightedSlot->id), offerQty, hero);
|
||||
CMarketTraderText::makeDeal();
|
||||
deselect();
|
||||
if(ArtifactID(offerTradePanel->getSelectedItemId()).toArtifact()->canBePutAt(hero))
|
||||
{
|
||||
LOCPLINT->cb->trade(market, EMarketMode::RESOURCE_ARTIFACT, GameResID(bidTradePanel->getSelectedItemId()),
|
||||
ArtifactID(offerTradePanel->getSelectedItemId()), offerQty, hero);
|
||||
CMarketTraderText::makeDeal();
|
||||
deselect();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOCPLINT->showInfoDialog(CGI->generaltexth->translate("core.genrltxt.326"));
|
||||
}
|
||||
}
|
||||
|
||||
CMarketBase::MarketShowcasesParams CArtifactsBuying::getShowcasesParams() const
|
||||
|
Loading…
Reference in New Issue
Block a user