mirror of
https://github.com/dashr9230/SA-MP.git
synced 2025-01-04 00:23:22 +08:00
[saco] Implement CCmdWindow::AddCmdProc
This commit is contained in:
parent
99b6dd3eda
commit
dc47e22f45
@ -14,3 +14,15 @@ void CCmdWindow::AddDefaultCmdProc(CMDPROC cmdDefault)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
|
||||||
|
void CCmdWindow::AddCmdProc(PCHAR szCmdName, CMDPROC cmdHandler)
|
||||||
|
{
|
||||||
|
if(m_iCmdCount < MAX_CMDS && (strlen(szCmdName) < MAX_CMD_STRLEN)) {
|
||||||
|
m_pCmds[m_iCmdCount] = cmdHandler;
|
||||||
|
strcpy(m_szCmdNames[m_iCmdCount],szCmdName);
|
||||||
|
m_iCmdCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------
|
||||||
|
|
||||||
|
@ -1,15 +1,21 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#define MAX_CMDS 144
|
||||||
|
#define MAX_CMD_STRLEN 32
|
||||||
|
|
||||||
typedef void (__cdecl *CMDPROC)(PCHAR);
|
typedef void (__cdecl *CMDPROC)(PCHAR);
|
||||||
|
|
||||||
class CCmdWindow // size: 6908
|
class CCmdWindow // size: 6908
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
char _gap0[6908];
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
CMDPROC m_pCmds[MAX_CMDS];
|
||||||
|
CHAR m_szCmdNames[MAX_CMDS][MAX_CMD_STRLEN+1];
|
||||||
|
int m_iCmdCount;
|
||||||
|
|
||||||
CMDPROC m_pDefaultCmd; // used when no command specifier was
|
CMDPROC m_pDefaultCmd; // used when no command specifier was
|
||||||
// used (ie. a normal chat message)
|
// used (ie. a normal chat message)
|
||||||
|
|
||||||
@ -17,4 +23,5 @@ public:
|
|||||||
CCmdWindow();
|
CCmdWindow();
|
||||||
|
|
||||||
void AddDefaultCmdProc(CMDPROC cmdDefault);
|
void AddDefaultCmdProc(CMDPROC cmdDefault);
|
||||||
|
void AddCmdProc(PCHAR szCmdName, CMDPROC cmdHandler);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user