mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2025-01-27 22:28:05 +03:00
cleaned-up version of ccmd.h
This commit is contained in:
parent
0dc2ba85e8
commit
fc955009da
@ -36,7 +36,8 @@
|
|||||||
// class CmdMngr
|
// class CmdMngr
|
||||||
// *****************************************************
|
// *****************************************************
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
CMD_ConsoleCommand,
|
CMD_ConsoleCommand,
|
||||||
CMD_ClientCommand,
|
CMD_ClientCommand,
|
||||||
CMD_ServerCommand
|
CMD_ServerCommand
|
||||||
@ -48,7 +49,8 @@ public:
|
|||||||
class Command;
|
class Command;
|
||||||
friend class Command;
|
friend class Command;
|
||||||
|
|
||||||
class Command {
|
class Command
|
||||||
|
{
|
||||||
friend class CmdMngr;
|
friend class CmdMngr;
|
||||||
CPluginMngr::CPlugin* plugin;
|
CPluginMngr::CPlugin* plugin;
|
||||||
CmdMngr* parent;
|
CmdMngr* parent;
|
||||||
@ -66,7 +68,6 @@ public:
|
|||||||
Command(CPluginMngr::CPlugin* pplugin, const char* pcmd, const char* pinfo, int pflags, int pfunc, bool pviewable, CmdMngr* pparent);
|
Command(CPluginMngr::CPlugin* pplugin, const char* pcmd, const char* pinfo, int pflags, int pfunc, bool pviewable, CmdMngr* pparent);
|
||||||
~Command();
|
~Command();
|
||||||
public:
|
public:
|
||||||
|
|
||||||
inline const char* getCommand() { return command.c_str(); }
|
inline const char* getCommand() { return command.c_str(); }
|
||||||
inline const char* getArgument() { return argument.c_str(); }
|
inline const char* getArgument() { return argument.c_str(); }
|
||||||
inline const char* getCmdInfo() { return info.c_str(); }
|
inline const char* getCmdInfo() { return info.c_str(); }
|
||||||
@ -81,15 +82,14 @@ public:
|
|||||||
inline long int getId() const { return (long int)id; }
|
inline long int getId() const { return (long int)id; }
|
||||||
const char* getCmdType() const;
|
const char* getCmdType() const;
|
||||||
void setCmdType(int a);
|
void setCmdType(int a);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
struct CmdPrefix;
|
struct CmdPrefix;
|
||||||
friend struct CmdPrefix;
|
friend struct CmdPrefix;
|
||||||
|
|
||||||
struct CmdLink {
|
struct CmdLink
|
||||||
|
{
|
||||||
Command* cmd;
|
Command* cmd;
|
||||||
CmdLink* next;
|
CmdLink* next;
|
||||||
CmdLink(Command* c): cmd(c), next(0) {}
|
CmdLink(Command* c): cmd(c), next(0) {}
|
||||||
@ -99,7 +99,8 @@ private:
|
|||||||
CmdLink* srvcmdlist;
|
CmdLink* srvcmdlist;
|
||||||
CmdLink* clcmdlist;
|
CmdLink* clcmdlist;
|
||||||
|
|
||||||
struct CmdPrefix {
|
struct CmdPrefix
|
||||||
|
{
|
||||||
String name;
|
String name;
|
||||||
CmdMngr* parent;
|
CmdMngr* parent;
|
||||||
CmdLink* list;
|
CmdLink* list;
|
||||||
@ -128,7 +129,8 @@ public:
|
|||||||
void clearBufforedInfo();
|
void clearBufforedInfo();
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
class iterator {
|
class iterator
|
||||||
|
{
|
||||||
CmdLink *a;
|
CmdLink *a;
|
||||||
public:
|
public:
|
||||||
iterator(CmdLink*aa = 0) : a(aa) {}
|
iterator(CmdLink*aa = 0) : a(aa) {}
|
||||||
@ -138,17 +140,19 @@ public:
|
|||||||
operator bool () const { return a ? true : false; }
|
operator bool () const { return a ? true : false; }
|
||||||
Command& operator*() { return *a->cmd; }
|
Command& operator*() { return *a->cmd; }
|
||||||
};
|
};
|
||||||
inline iterator clcmdprefixbegin(const char* nn){
|
|
||||||
|
inline iterator clcmdprefixbegin(const char* nn)
|
||||||
|
{
|
||||||
CmdPrefix* a = *findPrefix(nn);
|
CmdPrefix* a = *findPrefix(nn);
|
||||||
return iterator(a ? a->list : 0);
|
return iterator(a ? a->list : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline iterator clcmdbegin() const { return iterator(clcmdlist); }
|
inline iterator clcmdbegin() const { return iterator(clcmdlist); }
|
||||||
inline iterator srvcmdbegin() const { return iterator(srvcmdlist); }
|
inline iterator srvcmdbegin() const { return iterator(srvcmdlist); }
|
||||||
inline iterator begin(int type) const { return iterator(sortedlists[type]); }
|
inline iterator begin(int type) const { return iterator(sortedlists[type]); }
|
||||||
inline iterator end() const { return iterator(0); }
|
inline iterator end() const { return iterator(0); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int buf_cmdid;
|
int buf_cmdid;
|
||||||
int buf_cmdtype;
|
int buf_cmdtype;
|
||||||
int buf_cmdaccess;
|
int buf_cmdaccess;
|
||||||
@ -158,8 +162,7 @@ private:
|
|||||||
int buf_type;
|
int buf_type;
|
||||||
int buf_access;
|
int buf_access;
|
||||||
int buf_num;
|
int buf_num;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif //COMMANDS_H
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user