mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 14:37:29 +08:00
36 lines
666 B
C++
36 lines
666 B
C++
|
|
#include "../main.h"
|
|
|
|
CLabelPool::CLabelPool()
|
|
{
|
|
for(WORD wLabelID = 0; wLabelID < MAX_LABELS; wLabelID++)
|
|
{
|
|
memset(&m_Labels[wLabelID], 0, sizeof(LABEL));
|
|
m_bLabelSlotState[wLabelID] = FALSE;
|
|
}
|
|
}
|
|
|
|
CLabelPool::~CLabelPool()
|
|
{
|
|
for(WORD wLabelID = 0; wLabelID < MAX_LABELS; wLabelID++)
|
|
{
|
|
if(m_bLabelSlotState[wLabelID])
|
|
{
|
|
Delete(wLabelID);
|
|
}
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|