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

Set position for CreaturePurchaseCard

This will make it pick up on right clicks. It was 0 before, so it wasn't
doing it.
This commit is contained in:
Agoston Szepessy 2022-09-18 16:00:54 -07:00
parent 7ba271edf1
commit dfdaf57803
2 changed files with 16 additions and 1 deletions

View File

@ -17,6 +17,7 @@
#include "QuickRecruitmentWindow.h"
#include "../gui/CGuiHandler.h"
#include "../../lib/CCreatureHandler.h"
#include "CCreatureWindow.h"
void CreaturePurchaseCard::initButtons()
{
@ -82,14 +83,26 @@ void CreaturePurchaseCard::sliderMoved(int to)
parent->updateAllSliders();
}
void CreaturePurchaseCard::clickRight(tribool down, bool previousState)
{
if (down)
GH.pushIntT<CStackWindow>(creatureOnTheCard, true);
}
CreaturePurchaseCard::CreaturePurchaseCard(const std::vector<CreatureID> & creaturesID, Point position, int creaturesMaxAmount, QuickRecruitmentWindow * parents)
: upgradesID(creaturesID),
: CIntObject(RCLICK),
upgradesID(creaturesID),
parent(parents),
maxAmount(creaturesMaxAmount)
{
creatureOnTheCard = upgradesID.back().toCreature();
moveTo(Point(position.x, position.y));
initView();
// Card's position needs to be set to the animation's width/height
// otherwise the clicks won't register
pos.w = picture->pos.w;
pos.h = picture->pos.h;
}
void CreaturePurchaseCard::initView()

View File

@ -25,6 +25,8 @@ public:
QuickRecruitmentWindow * parent;
int maxAmount;
void sliderMoved(int to);
void clickRight(tribool down, bool previousState) override;
CreaturePurchaseCard(const std::vector<CreatureID> & creaturesID, Point position, int creaturesMaxAmount, QuickRecruitmentWindow * parents);
private:
void initView();