-
-
Notifications
You must be signed in to change notification settings - Fork 452
/
Copy pathCCommands.h
50 lines (37 loc) · 1.76 KB
/
CCommands.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: core/CCommands.h
* PURPOSE: Header file for dynamic command manager
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/
#pragma once
#include <core/CCommandsInterface.h>
#include <string>
#include "CSingleton.h"
class CCommands : public CCommandsInterface, public CSingleton<CCommands>
{
public:
CCommands();
~CCommands();
void Add(const char* szCommand, const char* szDescription, PFNCOMMANDHANDLER pfnHandler, bool bModCommand = false, bool bAllowScriptedBind = false);
unsigned int Count();
bool Exists(const char* szCommand);
bool Execute(const char* szCommandLine);
bool Execute(const char* command, const char* parametersIn, bool handleRemotely = false, bool isScriptedBind = false);
void Delete(const char* szCommand);
void DeleteAll();
void SetExecuteHandler(pfnExecuteCommandHandler pfnHandler) { m_pfnExecuteHandler = pfnHandler; }
pfnExecuteCommandHandler GetExecuteHandler() { return m_pfnExecuteHandler; }
tagCOMMANDENTRY* Get(const char* szCommand, bool bCheckIfMod = false, bool bModCommand = false);
std::list<COMMANDENTRY*>::iterator IterBegin() { return m_CommandList.begin(); }
std::list<COMMANDENTRY*>::iterator IterEnd() { return m_CommandList.end(); }
private:
void ExecuteHandler(PFNCOMMAND pfnHandler, const char* szParameters);
std::list<COMMANDENTRY*> m_CommandList;
CElapsedTime m_FpsLimitTimer;
pfnExecuteCommandHandler m_pfnExecuteHandler;
};