[saco] Implement/match CLabelPool::Delete(...)

* Update CLabelPool constructor
This commit is contained in:
RD42 2024-10-21 22:23:45 +08:00
parent becf308a1c
commit 61936ebf93
2 changed files with 24 additions and 8 deletions

View File

@ -3,9 +3,22 @@
CLabelPool::CLabelPool()
{
for(WORD wLabel = 0; wLabel < MAX_LABELS; wLabel++)
for(WORD wLabelID = 0; wLabelID < MAX_LABELS; wLabelID++)
{
memset(&field_0[wLabel], 0, sizeof(struc_92));
field_E800[wLabel] = 0;
memset(&m_Labels[wLabelID], 0, sizeof(LABEL));
m_bLabelSlotState[wLabelID] = FALSE;
}
}
BOOL CLabelPool::Delete(WORD wLabelID)
{
if(wLabelID >= MAX_LABELS) return FALSE;
if(!m_bLabelSlotState[wLabelID]) return FALSE;
if(m_Labels[wLabelID].szText)
free(m_Labels[wLabelID].szText);
memset(&m_Labels[wLabelID], 0, sizeof(LABEL));
m_bLabelSlotState[wLabelID] = FALSE;
return TRUE;
}

View File

@ -1,17 +1,20 @@
#pragma once
struct struc_92
typedef struct _LABEL
{
char _gap[29];
};
char *szText;
char _gap4[25];
} LABEL;
class CLabelPool
{
private:
struc_92 field_0[MAX_LABELS];
int field_E800[MAX_LABELS];
LABEL m_Labels[MAX_LABELS];
BOOL m_bLabelSlotState[MAX_LABELS];
public:
CLabelPool();
BOOL Delete(WORD wLabelID);
};