浏览代码

Adding object construction macro with parameter

- Adding macro "OBJECT_CONSTRUCTION_CAPTURING" that take as parameter
action flag.
- Fixed minor errors
FeniksFire 8 年之前
父节点
当前提交
f2b7c85811

+ 2 - 1
client/CreatureCostBox.h

@@ -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;
 };

+ 1 - 0
client/gui/CGuiHandler.h

@@ -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)

+ 1 - 1
client/windows/CCastleInterface.cpp

@@ -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;

+ 1 - 1
client/windows/CCastleInterface.h

@@ -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);
 

+ 2 - 1
client/windows/QuickRecruitmentWindow.cpp

@@ -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();

+ 1 - 0
client/windows/QuickRecruitmentWindow.h

@@ -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;