mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Adding object construction macro with parameter
- Adding macro "OBJECT_CONSTRUCTION_CAPTURING" that take as parameter action flag. - Fixed minor errors
This commit is contained in:
parent
a4f701014b
commit
f2b7c85811
@ -14,9 +14,10 @@
|
||||
|
||||
class CreatureCostBox : public CIntObject
|
||||
{
|
||||
std::map<int, std::pair<CLabel *, CAnimImage * > > resources;
|
||||
public:
|
||||
void set(TResources res);
|
||||
CreatureCostBox(Rect position, std::string title);
|
||||
void createItems(TResources res);
|
||||
private:
|
||||
std::map<int, std::pair<CLabel *, CAnimImage * > > resources;
|
||||
};
|
||||
|
@ -140,6 +140,7 @@ struct SSetCaptureState
|
||||
};
|
||||
|
||||
#define OBJ_CONSTRUCTION SObjectConstruction obj__i(this)
|
||||
#define OBJECT_CONSTRUCTION_CAPTURING(actions) defActions = actions; SSetCaptureState obj__i1(true, actions); SObjectConstruction obj__i(this)
|
||||
#define OBJ_CONSTRUCTION_CAPTURING_ALL defActions = 255; SSetCaptureState obj__i1(true, 255); SObjectConstruction obj__i(this)
|
||||
#define BLOCK_CAPTURING SSetCaptureState obj__i(false, 0)
|
||||
#define BLOCK_CAPTURING_DONT_TOUCH_REC_ACTIONS SSetCaptureState obj__i(false, GH.defActionsDef)
|
||||
|
@ -996,7 +996,7 @@ void CCastleInterface::recreateIcons()
|
||||
|
||||
hall = new CTownInfo( 80, 413, town, true);
|
||||
fort = new CTownInfo(122, 413, town, false);
|
||||
fastArmyPurhase = std::make_shared<CButton>(Point(122, 413), "itmcl.def", CButton::tooltip("quick army purhase"), [&](){builds->enterToTheQuickRecruitmentWindow();});
|
||||
fastArmyPurhase = new CButton(Point(122, 413), "itmcl.def", CButton::tooltip("quick army purhase"), [&](){builds->enterToTheQuickRecruitmentWindow();});
|
||||
fastArmyPurhase->setImageOrder(town->fortLevel()-1,town->fortLevel()-1,town->fortLevel()-1,town->fortLevel()-1);
|
||||
for (auto & elem : creainfo)
|
||||
delete elem;
|
||||
|
@ -205,7 +205,7 @@ class CCastleInterface : public CWindowObject, public CWindowWithGarrison
|
||||
|
||||
CButton *exit;
|
||||
CButton *split;
|
||||
std::shared_ptr<CButton> fastArmyPurhase;
|
||||
CButton * fastArmyPurhase;
|
||||
|
||||
std::vector<CCreaInfo*> creainfo;//small icons of creatures (bottom-left corner);
|
||||
|
||||
|
@ -149,7 +149,8 @@ void QuickRecruitmentWindow::updateAllSliders()
|
||||
|
||||
QuickRecruitmentWindow::QuickRecruitmentWindow(const CGTownInstance * townd) : CWindowObject(PLAYER_COLORED | BORDERED), town(townd)
|
||||
{
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
||||
OBJECT_CONSTRUCTION_CAPTURING(ACTIVATE + DEACTIVATE + UPDATE + SHOWALL);
|
||||
|
||||
initWindow();
|
||||
setButtons();
|
||||
setCreaturePurhaseCards();
|
||||
|
@ -36,6 +36,7 @@ private:
|
||||
void maxAllCards(std::vector<std::shared_ptr<CreaturePurhaseCard>> cards);
|
||||
void maxAllSlidersAmount(std::vector<std::shared_ptr<CreaturePurhaseCard>> cards);
|
||||
void purhaseUnits();
|
||||
|
||||
const CGTownInstance * town;
|
||||
std::shared_ptr<CButton> maxButton, buyButton, cancelButton;
|
||||
std::shared_ptr<CreatureCostBox> totalCost;
|
||||
|
Loading…
Reference in New Issue
Block a user