浏览代码

Fix build, fix element disabling

Ivan Savenko 1 年之前
父节点
当前提交
c6943e0ab0
共有 3 个文件被更改,包括 6 次插入7 次删除
  1. 2 4
      client/gui/CGuiHandler.cpp
  2. 3 1
      client/gui/CIntObject.cpp
  3. 1 2
      client/gui/CIntObject.h

+ 2 - 4
client/gui/CGuiHandler.cpp

@@ -40,7 +40,6 @@ CGuiHandler GH;
 static thread_local bool inGuiThread = false;
 
 ObjectConstruction::ObjectConstruction(CIntObject *obj)
-:myObj(obj)
 {
 	GH.createdObj.push_front(obj);
 	GH.captureChildren = true;
@@ -48,10 +47,9 @@ ObjectConstruction::ObjectConstruction(CIntObject *obj)
 
 ObjectConstruction::~ObjectConstruction()
 {
-	assert(GH.createdObj.size());
-	assert(GH.createdObj.front() == myObj);
+	assert(!GH.createdObj.empty());
 	GH.createdObj.pop_front();
-	GH.captureChildren = GH.createdObj.size();
+	GH.captureChildren = !GH.createdObj.empty();
 }
 
 void CGuiHandler::init()

+ 3 - 1
client/gui/CIntObject.cpp

@@ -106,6 +106,8 @@ void CIntObject::disable()
 {
 	if(isActive())
 		deactivate();
+
+	recActions = NO_ACTIONS;
 }
 
 void CIntObject::enable()
@@ -116,7 +118,7 @@ void CIntObject::enable()
 		redraw();
 	}
 
-	recActions = 255;
+	recActions = ALL_ACTIONS;
 }
 
 void CIntObject::setEnabled(bool on)

+ 1 - 2
client/gui/CIntObject.h

@@ -73,7 +73,7 @@ public:
 	void addUsedEvents(ui16 newActions);
 	void removeUsedEvents(ui16 newActions);
 
-	enum {ACTIVATE=1, DEACTIVATE=2, UPDATE=4, SHOWALL=8, SHARE_POS=16, ALL_ACTIONS=31};
+	enum {NO_ACTIONS = 0, ACTIVATE=1, DEACTIVATE=2, UPDATE=4, SHOWALL=8, SHARE_POS=16, ALL_ACTIONS=31};
 	ui8 recActions; //which calls we allow to receive from parent
 
 	/// deactivates if needed, blocks all automatic activity, allows only disposal
@@ -214,7 +214,6 @@ class EmptyStatusBar : public IStatusBar
 
 class ObjectConstruction
 {
-	CIntObject *myObj;
 public:
 	ObjectConstruction(CIntObject *obj);
 	~ObjectConstruction();