mirror of
https://github.com/edubart/otclient.git
synced 2025-12-20 15:37:11 +01:00
restore some game functionallity
* i'm gradually restoring game functionality with the new modules design, though still a lot to do * you can reload all scripts and modules using Ctrl+R shortcut while playing (finally! this is the reason of all this rework) * a bunch of fixes, but new regression too :P * fix performance issue that could lead freezes in the client in older machines * completely new game module with new design * fix crashs in map render * remove uigame.cpp (now every game input is via lua) * enable DEBUG macro by default, with it you are able to view any possible lua leak while running
This commit is contained in:
@@ -206,7 +206,7 @@ void UIWidget::removeChild(UIWidgetPtr child)
|
||||
|
||||
g_ui.onWidgetDisappear(child);
|
||||
} else
|
||||
logError("Attempt to remove an unknown child from a UIWidget");
|
||||
logError("attempt to remove an unknown child from a UIWidget");
|
||||
}
|
||||
|
||||
|
||||
@@ -637,11 +637,12 @@ void UIWidget::destroy()
|
||||
|
||||
// remove itself from parent
|
||||
if(UIWidgetPtr parent = getParent()) {
|
||||
if(parent->hasChild(asUIWidget()))
|
||||
parent->removeChild(asUIWidget());
|
||||
assert(parent->hasChild(asUIWidget()));
|
||||
parent->removeChild(asUIWidget());
|
||||
}
|
||||
|
||||
destroyChildren();
|
||||
m_focusedChild = nullptr;
|
||||
|
||||
callLuaField("onDestroy");
|
||||
|
||||
@@ -649,12 +650,13 @@ void UIWidget::destroy()
|
||||
|
||||
#ifdef DEBUG
|
||||
auto self = asUIWidget();
|
||||
g_lua.collectGarbage();
|
||||
if(self != g_ui.getRootWidget()) {
|
||||
g_eventDispatcher.scheduleEvent([self] {
|
||||
g_lua.collectGarbage();
|
||||
if(self->getUseCount() != 1)
|
||||
logWarning("widget '", self->getId(), "' destroyed but still have ", self->getUseCount()-1, " reference(s) left");
|
||||
}, 100);
|
||||
}, 500);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user