mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 01:09:50 +00:00
Fix uninit/release
--HG-- branch : item_group
This commit is contained in:
parent
6af0fd168c
commit
f222d1736a
2 changed files with 14 additions and 1 deletions
|
@ -77,7 +77,7 @@ void CItemGroup::writeTo(xmlNodePtr node)
|
||||||
for(int i=0;i<removeBeforeEquip.size();i++)
|
for(int i=0;i<removeBeforeEquip.size();i++)
|
||||||
{
|
{
|
||||||
xmlNodePtr removeNode = xmlNewChild(groupNode, NULL, (const xmlChar*)"remove", NULL);
|
xmlNodePtr removeNode = xmlNewChild(groupNode, NULL, (const xmlChar*)"remove", NULL);
|
||||||
xmlSetProp(removeNode, (const xmlChar*)"slot", (const xmlChar*)removeBeforeEquip[i]);
|
xmlSetProp(removeNode, (const xmlChar*)"slot", (xmlChar*)SLOT_EQUIPMENT::toString(removeBeforeEquip[i]).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,6 +203,18 @@ void CItemGroupManager::linkInterface()
|
||||||
void CItemGroupManager::uninit()
|
void CItemGroupManager::uninit()
|
||||||
{
|
{
|
||||||
saveGroups();
|
saveGroups();
|
||||||
|
unlinkInterface();
|
||||||
|
_Groups.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CItemGroupManager::unlinkInterface()
|
||||||
|
{
|
||||||
|
// We need to unlink our menu to avoid crash on interface release
|
||||||
|
CWidgetManager* pWM = CWidgetManager::getInstance();
|
||||||
|
CGroupMenu *pGroupMenu = dynamic_cast<CGroupMenu*>(pWM->getElementFromId("ui:interface:item_menu_in_bag:item_group_menu"));
|
||||||
|
CGroupSubMenu *pGroupSubMenu = pGroupMenu->getRootMenu();
|
||||||
|
pGroupMenu->reset();
|
||||||
|
pGroupMenu->delGroup(pGroupSubMenu, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inspired from macro parsing
|
// Inspired from macro parsing
|
||||||
|
|
|
@ -78,6 +78,7 @@ public:
|
||||||
void saveGroups();
|
void saveGroups();
|
||||||
bool loadGroups();
|
bool loadGroups();
|
||||||
void linkInterface();
|
void linkInterface();
|
||||||
|
void unlinkInterface();
|
||||||
//Return NULL if no group was found
|
//Return NULL if no group was found
|
||||||
//Return false if no group was found
|
//Return false if no group was found
|
||||||
bool moveGroup(std::string name, INVENTORIES::TInventory dst);
|
bool moveGroup(std::string name, INVENTORIES::TInventory dst);
|
||||||
|
|
Loading…
Reference in a new issue