[saco] Implement/match CMenuPool destructor

* Implement/match `CMenu::Hide()`
This commit is contained in:
RD42 2024-07-16 23:19:34 +08:00
parent 4c0831a806
commit 37642d51d4
5 changed files with 23 additions and 0 deletions

View File

@ -25,3 +25,8 @@ CMenu::CMenu(float fX, float fY, BYTE byteColumns, float fCol1Width, float fCol2
m_dwPanel = 0;
}
void CMenu::Hide()
{
ScriptCommand(&remove_panel, m_dwPanel);
}

View File

@ -40,4 +40,5 @@ public:
CMenu(float fX, float fY, BYTE byteColumns, float fCol1Width, float fCol2Width, MENU_INT *MenuInteraction);
void Hide();
};

View File

@ -81,6 +81,7 @@ const SCRIPT_COMMAND text_clear_all = { 0x00be, "" };
const SCRIPT_COMMAND create_radar_marker_icon = { 0x0570, "fffiv" };
const SCRIPT_COMMAND remove_panel = { 0x08DA, "i" };
const SCRIPT_COMMAND restore_camera_to_user_defined = { 0x925, "" };
const SCRIPT_COMMAND set_camera_position_to = { 0x936, "ffffffii" };

View File

@ -16,6 +16,21 @@ CMenuPool::CMenuPool()
//----------------------------------------------------
CMenuPool::~CMenuPool()
{
if (m_byteCurrentMenu != MAX_MENUS) m_pMenus[m_byteCurrentMenu]->Hide();
for (BYTE byteMenuID = 0; byteMenuID < MAX_MENUS; byteMenuID++)
{
if (m_pMenus[byteMenuID])
{
delete m_pMenus[byteMenuID];
m_pMenus[byteMenuID] = NULL;
}
}
}
//----------------------------------------------------
CMenu* CMenuPool::New(BYTE byteMenuID, float fX, float fY, BYTE byteColumns, float fCol1Width, float fCol2Width, MENU_INT *MenuInteraction)
{
SAFE_DELETE(m_pMenus[byteMenuID]);

View File

@ -14,6 +14,7 @@ private:
public:
CMenuPool();
~CMenuPool();
CMenu* New(BYTE byteMenuID, float fX, float fY, BYTE byteColumns, float fCol1Width, float fCol2Width, MENU_INT *MenuInteraction);