1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Fix build, fix element disabling

This commit is contained in:
Ivan Savenko
2024-08-09 16:11:07 +00:00
parent 220c5cb1d7
commit c6943e0ab0
3 changed files with 6 additions and 7 deletions

View File

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

View File

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

View File

@@ -73,7 +73,7 @@ public:
void addUsedEvents(ui16 newActions); void addUsedEvents(ui16 newActions);
void removeUsedEvents(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 ui8 recActions; //which calls we allow to receive from parent
/// deactivates if needed, blocks all automatic activity, allows only disposal /// deactivates if needed, blocks all automatic activity, allows only disposal
@@ -214,7 +214,6 @@ class EmptyStatusBar : public IStatusBar
class ObjectConstruction class ObjectConstruction
{ {
CIntObject *myObj;
public: public:
ObjectConstruction(CIntObject *obj); ObjectConstruction(CIntObject *obj);
~ObjectConstruction(); ~ObjectConstruction();