cleaned-up versions of header files
This commit is contained in:
parent
fc955009da
commit
e67457440d
|
@ -34,7 +34,8 @@
|
|||
|
||||
#define MAX_AMX_REG_MSG MAX_REG_MSGS+16
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
CS_DEATHMSG = MAX_REG_MSGS,
|
||||
// CS_ROUNDEND,
|
||||
// CS_ROUNDSTART,
|
||||
|
@ -67,7 +68,7 @@ public:
|
|||
|
||||
class ClEvent
|
||||
{
|
||||
friend class EventsMngr; // events manager may access our private members
|
||||
friend class EventsMngr; // events manager may access our private members
|
||||
|
||||
int m_Func; // function to be executed
|
||||
CPluginMngr::CPlugin *m_Plugin; // the plugin this ClEvent class is assigned to
|
||||
|
@ -100,7 +101,7 @@ public:
|
|||
|
||||
public:
|
||||
// constructors & destructors
|
||||
ClEvent(CPluginMngr::CPlugin* plugin, int func, int flags);
|
||||
ClEvent(CPluginMngr::CPlugin* plugin, int func, int flags);
|
||||
~ClEvent();
|
||||
|
||||
inline CPluginMngr::CPlugin* getPlugin();
|
||||
|
@ -116,21 +117,22 @@ private:
|
|||
const char* sValue;
|
||||
MsgParamType type;
|
||||
};
|
||||
|
||||
MsgDataEntry *m_ParseVault;
|
||||
int m_ParseVaultSize;
|
||||
void NextParam(); // make sure a new parameter can be added
|
||||
void NextParam(); // make sure a new parameter can be added
|
||||
|
||||
typedef CList<ClEvent> ClEventVec;
|
||||
typedef ClEventVec::iterator ClEventVecIter;
|
||||
|
||||
ClEventVec m_Events[MAX_AMX_REG_MSG];
|
||||
ClEventVec *m_ParseFun; // current Event vector
|
||||
ClEventVec *m_ParseFun; // current Event vector
|
||||
|
||||
bool m_ParseNotDone;
|
||||
int m_ParsePos; // is args. num. - 1
|
||||
float* m_Timer;
|
||||
|
||||
ClEvent* getValidEvent(ClEvent* a );
|
||||
ClEvent* getValidEvent(ClEvent* a);
|
||||
|
||||
int m_CurrentMsgType;
|
||||
public:
|
||||
|
@ -145,15 +147,13 @@ public:
|
|||
void parseValue(float fValue);
|
||||
void parseValue(const char *sz);
|
||||
void executeEvents();
|
||||
int getArgNum() const; //{ return (parsePos+1); }
|
||||
int getArgNum() const; //{ return (parsePos+1); }
|
||||
const char* getArgString(int a) const;
|
||||
int getArgInteger(int a) const;
|
||||
float getArgFloat(int a) const;
|
||||
void clearEvents(void);
|
||||
static int getEventId( const char* msg );
|
||||
static int getEventId(const char* msg);
|
||||
int getCurrentMsgType();
|
||||
};
|
||||
|
||||
#endif // #ifdef __CEVENTS_H__
|
||||
|
||||
|
||||
#endif //__CEVENTS_H__
|
||||
|
|
|
@ -41,18 +41,15 @@ class File
|
|||
FILE* fp;
|
||||
|
||||
public:
|
||||
File( const char* n, const char* m );
|
||||
~File( );
|
||||
operator bool ( ) const;
|
||||
friend File& operator<<( File& f, const String& n );
|
||||
friend File& operator<<( File& f, const char* n );
|
||||
friend File& operator<<( File& f, const char& c );
|
||||
friend File& operator<<( File& f, int n );
|
||||
friend File& operator>>( File& f, String& n );
|
||||
friend File& operator>>( File& f, char* n );
|
||||
int getline( char* buf, int sz );
|
||||
File& skipWs( );
|
||||
File(const char* n, const char* m);
|
||||
~File();
|
||||
operator bool () const;
|
||||
friend File& operator<<(File& f, const String& n);
|
||||
friend File& operator<<(File& f, const char* n);
|
||||
friend File& operator<<(File& f, const char& c);
|
||||
friend File& operator<<(File& f, int n);
|
||||
friend File& operator>>(File& f, String& n);
|
||||
friend File& operator>>(File& f, char* n);
|
||||
int getline(char* buf, int sz);
|
||||
File& skipWs();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -88,31 +88,38 @@ class CForward
|
|||
const char *m_FuncName;
|
||||
ForwardExecType m_ExecType;
|
||||
int m_NumParams;
|
||||
|
||||
struct AMXForward
|
||||
{
|
||||
CPluginMngr::CPlugin *pPlugin;
|
||||
int func;
|
||||
};
|
||||
|
||||
typedef CVector<AMXForward> AMXForwardList;
|
||||
AMXForwardList m_Funcs;
|
||||
ForwardParam m_ParamTypes[FORWARD_MAX_PARAMS];
|
||||
|
||||
public:
|
||||
CForward(const char *name, ForwardExecType et, int numParams, const ForwardParam * paramTypes);
|
||||
CForward()
|
||||
{ } // leaves everything unitialized'
|
||||
cell execute(cell *params, ForwardPreparedArray *preparedArrays);
|
||||
|
||||
int getParamsNum() const
|
||||
{
|
||||
return m_NumParams;
|
||||
}
|
||||
|
||||
int getFuncsNum() const
|
||||
{
|
||||
return m_Funcs.size();
|
||||
}
|
||||
|
||||
ForwardParam getParamType(int paramId) const
|
||||
{
|
||||
if (paramId < 0 || paramId >= m_NumParams)
|
||||
return FP_DONE;
|
||||
|
||||
return m_ParamTypes[paramId];
|
||||
}
|
||||
};
|
||||
|
@ -126,6 +133,7 @@ class CSPForward
|
|||
AMX *m_Amx;
|
||||
int m_Func;
|
||||
bool m_HasFunc;
|
||||
|
||||
public:
|
||||
bool isFree;
|
||||
public:
|
||||
|
@ -134,18 +142,22 @@ public:
|
|||
void Set(int func, AMX *amx, int numParams, const ForwardParam * paramTypes);
|
||||
|
||||
cell execute(cell *params, ForwardPreparedArray *preparedArrays);
|
||||
|
||||
int getParamsNum() const
|
||||
{
|
||||
return m_NumParams;
|
||||
}
|
||||
|
||||
int getFuncsNum() const
|
||||
{
|
||||
return (m_HasFunc) ? 1 : 0;
|
||||
}
|
||||
|
||||
ForwardParam getParamType(int paramId) const
|
||||
{
|
||||
if (paramId < 0 || paramId >= m_NumParams)
|
||||
return FP_DONE;
|
||||
|
||||
return m_ParamTypes[paramId];
|
||||
}
|
||||
};
|
||||
|
@ -154,14 +166,14 @@ class CForwardMngr
|
|||
{
|
||||
typedef CVector<CForward*> ForwardVec;
|
||||
typedef CVector<CSPForward*> SPForwardVec;
|
||||
typedef CQueue<int> FreeSPVec; // Free SP Forwards
|
||||
typedef CQueue<int> FreeSPVec; // Free SP Forwards
|
||||
|
||||
ForwardVec m_Forwards;
|
||||
|
||||
SPForwardVec m_SPForwards;
|
||||
FreeSPVec m_FreeSPForwards; // so we don't have to free memory
|
||||
|
||||
ForwardPreparedArray m_TmpArrays[FORWARD_MAX_PARAMS]; // used by prepareArray
|
||||
ForwardPreparedArray m_TmpArrays[FORWARD_MAX_PARAMS]; // used by prepareArray
|
||||
int m_TmpArraysNum;
|
||||
public:
|
||||
|
||||
|
@ -180,14 +192,13 @@ public:
|
|||
void unregisterSPForward(int id);
|
||||
// execute forward
|
||||
cell executeForwards(int id, cell *params);
|
||||
void clear(); // delete all forwards
|
||||
void clear(); // delete all forwards
|
||||
bool isIdValid(int id) const; // check whether forward id is valid
|
||||
bool isSPForward(int id) const; // check whether forward is single plugin
|
||||
int getParamsNum(int id) const; // get num of params of a forward
|
||||
int getFuncsNum(int id) const; // get num of found functions of a forward
|
||||
ForwardParam getParamType(int id, int paramId) const;
|
||||
cell prepareArray(void *ptr, unsigned int size, ForwardArrayElemType type,
|
||||
bool copyBack); // prepare array
|
||||
cell prepareArray(void *ptr, unsigned int size, ForwardArrayElemType type, bool copyBack); // prepare array
|
||||
};
|
||||
|
||||
// (un)register forward
|
||||
|
@ -202,5 +213,5 @@ cell executeForwards(int id, ...);
|
|||
cell prepareCellArray(cell *ptr, unsigned int size, bool copyBack = false);
|
||||
cell prepareCharArray(char *ptr, unsigned int size, bool copyBack = false);
|
||||
|
||||
#endif
|
||||
#endif //FORWARD_H
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ class CLangMngr
|
|||
{
|
||||
return strcmp(left.m_LanguageName, right)==0 ? true : false;
|
||||
}
|
||||
|
||||
// Get language name
|
||||
const char *GetName() { return m_LanguageName; }
|
||||
// Save to file
|
||||
|
@ -91,8 +92,8 @@ class CLangMngr
|
|||
int Entries() { return m_LookUpTable.size(); }
|
||||
// Make a hash from a string; convert to lowercase first if needed
|
||||
static uint32_t MakeHash(const char *src, bool makeLower = false);
|
||||
protected:
|
||||
|
||||
protected:
|
||||
// An entry in the language
|
||||
class LangEntry
|
||||
{
|
||||
|
@ -145,7 +146,7 @@ class CLangMngr
|
|||
// Merge definitions into a language
|
||||
void MergeDefinitions(const char *lang, CQueue <sKeyDef*> &tmpVec);
|
||||
// strip lowercase; make lower if needed
|
||||
static size_t strip(char *str, char *newstr, bool makelower=false);
|
||||
static size_t strip(char *str, char *newstr, bool makelower = false);
|
||||
|
||||
typedef CVector<CLang*> LangVec;
|
||||
typedef CVector<CLang*>::iterator LangVecIter;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
// *****************************************************
|
||||
// class CList
|
||||
// *****************************************************
|
||||
|
||||
// Linked list
|
||||
template <typename T, typename F = char* >
|
||||
class CList
|
||||
|
@ -162,6 +163,7 @@ public:
|
|||
{
|
||||
iterator tmp(*this);
|
||||
m_CurPos = m_CurPos->next;
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
@ -176,6 +178,7 @@ public:
|
|||
{
|
||||
return m_pList->remove(*this);
|
||||
}
|
||||
|
||||
iterator put(T *obj)
|
||||
{
|
||||
return m_pList->put(obj, *this);
|
||||
|
@ -187,6 +190,7 @@ public:
|
|||
m_pHead = NULL;
|
||||
m_pTail = NULL;
|
||||
}
|
||||
|
||||
~CList<T,F>()
|
||||
{
|
||||
clear();
|
||||
|
@ -198,12 +202,15 @@ public:
|
|||
iterator remove(iterator &where)
|
||||
{
|
||||
iterator tmp(where.GetNext());
|
||||
|
||||
if (where.m_CurPos == m_pHead)
|
||||
m_pHead = where.m_CurPos->GetNext();
|
||||
if (where.m_CurPos == m_pTail)
|
||||
m_pTail = where.m_CurPos->GetPrev();
|
||||
|
||||
delete where.m_CurPos;
|
||||
where = tmp;
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
@ -212,36 +219,36 @@ public:
|
|||
iterator put_back(T *pObj)
|
||||
{
|
||||
CElement *pTmp = new CElement(pObj);
|
||||
|
||||
if (!m_pHead)
|
||||
{
|
||||
m_pHead = pTmp;
|
||||
m_pTail = pTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
pTmp->SetNext(NULL);
|
||||
pTmp->SetPrev(m_pTail);
|
||||
m_pTail->SetNext(pTmp);
|
||||
m_pTail = pTmp;
|
||||
}
|
||||
|
||||
return iterator(this, pTmp);
|
||||
}
|
||||
|
||||
iterator put_front(T *pObj)
|
||||
{
|
||||
CElement *pTmp = new CElement(pObj);
|
||||
|
||||
if (!m_pHead)
|
||||
{
|
||||
m_pHead = pTmp;
|
||||
m_pTail = pTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
pTmp->SetNext(m_pHead);
|
||||
pTmp->SetPrev(NULL);
|
||||
m_pHead->SetPrev(pTmp);
|
||||
m_pHead = pTmp;
|
||||
}
|
||||
|
||||
return iterator(this, pTmp);
|
||||
}
|
||||
|
||||
|
@ -257,6 +264,7 @@ public:
|
|||
iterator put(T *pObj, iterator &where)
|
||||
{
|
||||
CElement *pTmp = new CElement(pObj);
|
||||
|
||||
if (where.m_CurPos->GetNext())
|
||||
where.m_CurPos->GetNext()->SetPrev(pTmp);
|
||||
else // where = tail
|
||||
|
@ -266,6 +274,7 @@ public:
|
|||
pTmp->SetNext(where.m_CurPos->GetNext());
|
||||
|
||||
where.m_CurPos->SetNext(pTmp);
|
||||
|
||||
return ++where;
|
||||
}
|
||||
|
||||
|
@ -289,6 +298,7 @@ public:
|
|||
break;
|
||||
++iter;
|
||||
}
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
||||
|
@ -300,14 +310,16 @@ public:
|
|||
int size()
|
||||
{
|
||||
iterator iter = begin();
|
||||
int i=0;
|
||||
int i = 0;
|
||||
|
||||
while (iter)
|
||||
{
|
||||
++i;
|
||||
++iter;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif //CLIST_H
|
||||
|
|
|
@ -40,126 +40,129 @@
|
|||
// class LogEventsMngr
|
||||
// *****************************************************
|
||||
|
||||
class LogEventsMngr {
|
||||
|
||||
char logString[256];
|
||||
char logArgs[MAX_LOGARGS][128];
|
||||
int logArgc;
|
||||
int logCounter;
|
||||
int logCurrent;
|
||||
bool arelogevents;
|
||||
class LogEventsMngr
|
||||
{
|
||||
char logString[256];
|
||||
char logArgs[MAX_LOGARGS][128];
|
||||
int logArgc;
|
||||
int logCounter;
|
||||
int logCurrent;
|
||||
bool arelogevents;
|
||||
|
||||
public:
|
||||
class CLogCmp;
|
||||
class iterator;
|
||||
class CLogEvent;
|
||||
|
||||
friend class CLogEvent;
|
||||
friend class CLogCmp;
|
||||
friend class iterator;
|
||||
|
||||
class CLogCmp
|
||||
{
|
||||
friend class LogEventsMngr;
|
||||
class CLogCmp;
|
||||
class iterator;
|
||||
class CLogEvent;
|
||||
friend class CLogEvent;
|
||||
LogEventsMngr* parent;
|
||||
String text;
|
||||
int logid;
|
||||
int pos;
|
||||
int result;
|
||||
bool in;
|
||||
CLogCmp *next;
|
||||
CLogCmp( const char* s, bool r, int p, CLogCmp *n, LogEventsMngr* mg ) : text(s) {
|
||||
logid = result = 0;
|
||||
pos = p;
|
||||
parent = mg;
|
||||
in = r;
|
||||
next = n;
|
||||
}
|
||||
public:
|
||||
|
||||
int compareCondition(const char* string);
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
CLogCmp *logcmplist;
|
||||
|
||||
public:
|
||||
|
||||
class CLogEvent {
|
||||
friend class LogEventsMngr;
|
||||
friend class CLogCmp;
|
||||
friend class iterator;
|
||||
struct LogCondEle {
|
||||
CLogCmp *cmp;
|
||||
LogCondEle *next;
|
||||
LogCondEle(CLogCmp *c, LogCondEle *n): cmp(c) , next(n) { }
|
||||
|
||||
class CLogCmp
|
||||
{
|
||||
friend class LogEventsMngr;
|
||||
friend class CLogEvent;
|
||||
LogEventsMngr* parent;
|
||||
String text;
|
||||
int logid;
|
||||
int pos;
|
||||
int result;
|
||||
bool in;
|
||||
CLogCmp *next;
|
||||
|
||||
CLogCmp(const char* s, bool r, int p, CLogCmp *n, LogEventsMngr* mg) : text(s)
|
||||
{
|
||||
logid = result = 0;
|
||||
pos = p;
|
||||
parent = mg;
|
||||
in = r;
|
||||
next = n;
|
||||
}
|
||||
|
||||
public:
|
||||
int compareCondition(const char* string);
|
||||
};
|
||||
struct LogCond {
|
||||
int argnum;
|
||||
LogCondEle *list;
|
||||
LogCond *next;
|
||||
LogCond( int a , LogCondEle* ee , LogCond* n ) : argnum(a) , list(ee), next(n) {}
|
||||
~LogCond();
|
||||
};
|
||||
CPluginMngr::CPlugin *plugin;
|
||||
int func;
|
||||
LogCond *filters;
|
||||
LogEventsMngr* parent;
|
||||
CLogEvent *next;
|
||||
CLogEvent(CPluginMngr::CPlugin *p,int f, LogEventsMngr* ppp) : plugin(p),func(f), filters(0),parent(ppp) ,next(0) { }
|
||||
~CLogEvent();
|
||||
public:
|
||||
inline CPluginMngr::CPlugin *getPlugin() { return plugin; }
|
||||
void registerFilter( char* filter );
|
||||
inline int getFunction() { return func; }
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
CLogEvent *logevents[MAX_LOGARGS+1];
|
||||
CLogEvent *getValidLogEvent( CLogEvent * a );
|
||||
CLogCmp* registerCondition(char* filter);
|
||||
void clearConditions();
|
||||
|
||||
CLogCmp *logcmplist;
|
||||
public:
|
||||
|
||||
LogEventsMngr();
|
||||
~LogEventsMngr();
|
||||
class CLogEvent
|
||||
{
|
||||
friend class LogEventsMngr;
|
||||
friend class iterator;
|
||||
|
||||
struct LogCondEle
|
||||
{
|
||||
CLogCmp *cmp;
|
||||
LogCondEle *next;
|
||||
LogCondEle(CLogCmp *c, LogCondEle *n): cmp(c), next(n) { }
|
||||
};
|
||||
|
||||
struct LogCond
|
||||
{
|
||||
int argnum;
|
||||
LogCondEle *list;
|
||||
LogCond *next;
|
||||
LogCond(int a, LogCondEle* ee, LogCond* n) : argnum(a), list(ee), next(n) {}
|
||||
~LogCond();
|
||||
};
|
||||
|
||||
CPluginMngr::CPlugin *plugin;
|
||||
int func;
|
||||
LogCond *filters;
|
||||
LogEventsMngr* parent;
|
||||
CLogEvent *next;
|
||||
CLogEvent(CPluginMngr::CPlugin *p,int f, LogEventsMngr* ppp) : plugin(p), func(f), filters(0), parent(ppp), next(0) { }
|
||||
~CLogEvent();
|
||||
public:
|
||||
inline CPluginMngr::CPlugin *getPlugin() { return plugin; }
|
||||
void registerFilter(char* filter);
|
||||
inline int getFunction() { return func; }
|
||||
};
|
||||
|
||||
private:
|
||||
CLogEvent *logevents[MAX_LOGARGS+1];
|
||||
CLogEvent *getValidLogEvent(CLogEvent * a);
|
||||
CLogCmp* registerCondition(char* filter);
|
||||
void clearConditions();
|
||||
public:
|
||||
LogEventsMngr();
|
||||
~LogEventsMngr();
|
||||
|
||||
// Interface
|
||||
CLogEvent* registerLogEvent(CPluginMngr::CPlugin* plugin, int func, int pos);
|
||||
inline bool logEventsExist() { return arelogevents; }
|
||||
void setLogString(char* frmt, va_list& vaptr);
|
||||
void setLogString(char* frmt, ...);
|
||||
void parseLogString();
|
||||
void executeLogEvents();
|
||||
inline const char* getLogString() { return logString; }
|
||||
inline int getLogArgNum() { return logArgc; }
|
||||
inline const char* getLogArg(int i) { return (i < 0 || i >= logArgc) ? "" : logArgs[i]; }
|
||||
void clearLogEvents();
|
||||
|
||||
class iterator
|
||||
{
|
||||
CLogEvent* a;
|
||||
LogEventsMngr* b;
|
||||
|
||||
CLogEvent* registerLogEvent( CPluginMngr::CPlugin* plugin, int func, int pos );
|
||||
inline bool logEventsExist() { return arelogevents; }
|
||||
void setLogString( char* frmt, va_list& vaptr );
|
||||
void setLogString( char* frmt , ... );
|
||||
void parseLogString( );
|
||||
void executeLogEvents();
|
||||
inline const char* getLogString() { return logString; }
|
||||
inline int getLogArgNum() { return logArgc; }
|
||||
inline const char* getLogArg( int i ) { return ( i < 0 || i >= logArgc ) ? "" : logArgs[ i ]; }
|
||||
void clearLogEvents();
|
||||
public:
|
||||
inline iterator(CLogEvent*aa,LogEventsMngr* bb) : a(aa), b(bb) {}
|
||||
|
||||
inline iterator& operator++()
|
||||
{
|
||||
a = b->getValidLogEvent(a->next);
|
||||
return *this;
|
||||
}
|
||||
|
||||
class iterator {
|
||||
CLogEvent* a;
|
||||
LogEventsMngr* b;
|
||||
public:
|
||||
inline iterator(CLogEvent*aa,LogEventsMngr* bb) : a(aa), b(bb) {}
|
||||
inline iterator& operator++() {
|
||||
a = b->getValidLogEvent( a->next );
|
||||
return *this;
|
||||
}
|
||||
inline bool operator==(const iterator& c) const { return a == c.a; }
|
||||
inline bool operator!=(const iterator& c) const { return !operator==(c); }
|
||||
CLogEvent& operator*() { return *a; }
|
||||
operator bool ( ) const { return a ? true : false; }
|
||||
};
|
||||
inline iterator begin() { return iterator(getValidLogEvent(logevents[ logArgc ]),this); }
|
||||
inline iterator end() { return iterator(0,this); }
|
||||
inline bool operator==(const iterator& c) const { return a == c.a; }
|
||||
inline bool operator!=(const iterator& c) const { return !operator == (c); }
|
||||
CLogEvent& operator*() { return *a; }
|
||||
operator bool () const { return a ? true : false; }
|
||||
};
|
||||
|
||||
inline iterator begin() { return iterator(getValidLogEvent(logevents[logArgc]), this); }
|
||||
inline iterator end() { return iterator(0, this); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif //LOGEVENTS_H
|
||||
|
|
|
@ -38,55 +38,56 @@
|
|||
|
||||
class MenuMngr
|
||||
{
|
||||
struct MenuIdEle
|
||||
{
|
||||
String name;
|
||||
AMX* amx;
|
||||
MenuIdEle* next;
|
||||
int id;
|
||||
static int uniqueid;
|
||||
MenuIdEle( const char* n, AMX* a, MenuIdEle* m ) : name( n ) , amx(a) , next( m ) {
|
||||
id = ++uniqueid;
|
||||
}
|
||||
~MenuIdEle() { --uniqueid; }
|
||||
} *headid;
|
||||
struct MenuIdEle
|
||||
{
|
||||
String name;
|
||||
AMX* amx;
|
||||
MenuIdEle* next;
|
||||
int id;
|
||||
static int uniqueid;
|
||||
|
||||
MenuIdEle(const char* n, AMX* a, MenuIdEle* m) : name(n), amx(a), next(m)
|
||||
{
|
||||
id = ++uniqueid;
|
||||
}
|
||||
|
||||
~MenuIdEle() { --uniqueid; }
|
||||
} *headid;
|
||||
|
||||
public:
|
||||
class iterator;
|
||||
|
||||
class iterator;
|
||||
private:
|
||||
|
||||
class MenuCommand
|
||||
{
|
||||
friend class iterator;
|
||||
friend class MenuMngr;
|
||||
class MenuCommand
|
||||
{
|
||||
friend class iterator;
|
||||
friend class MenuMngr;
|
||||
|
||||
CPluginMngr::CPlugin *plugin;
|
||||
int menuid;
|
||||
int keys;
|
||||
int function;
|
||||
MenuCommand* next;
|
||||
MenuCommand( CPluginMngr::CPlugin *a, int mi, int k, int f );
|
||||
public:
|
||||
inline int getFunction() { return function; }
|
||||
inline CPluginMngr::CPlugin* getPlugin() { return plugin; }
|
||||
inline bool matchCommand( int m, int k ) { return ((m == menuid) && (keys & k)); }
|
||||
} *headcmd;
|
||||
CPluginMngr::CPlugin *plugin;
|
||||
int menuid;
|
||||
int keys;
|
||||
int function;
|
||||
MenuCommand* next;
|
||||
MenuCommand(CPluginMngr::CPlugin *a, int mi, int k, int f);
|
||||
public:
|
||||
inline int getFunction() { return function; }
|
||||
inline CPluginMngr::CPlugin* getPlugin() { return plugin; }
|
||||
inline bool matchCommand(int m, int k) { return ((m == menuid) && (keys & k)); }
|
||||
} *headcmd;
|
||||
|
||||
public:
|
||||
|
||||
MenuMngr() { headid = 0; headcmd = 0; }
|
||||
MenuMngr() { headid = 0; headcmd = 0; }
|
||||
~MenuMngr();
|
||||
|
||||
// Interface
|
||||
|
||||
|
||||
int findMenuId(const char* name, AMX* a = 0);
|
||||
int registerMenuId(const char* n, AMX* a );
|
||||
int registerMenuId(const char* n, AMX* a);
|
||||
void registerMenuCmd(CPluginMngr::CPlugin *a, int mi, int k, int f);
|
||||
void clear();
|
||||
|
||||
class iterator {
|
||||
class iterator
|
||||
{
|
||||
MenuCommand* a;
|
||||
public:
|
||||
iterator(MenuCommand*aa) : a(aa) {}
|
||||
|
@ -96,8 +97,9 @@ public:
|
|||
operator bool () const { return a ? true : false; }
|
||||
MenuCommand& operator*() { return *a; }
|
||||
};
|
||||
|
||||
inline iterator begin() const { return iterator(headcmd); }
|
||||
inline iterator end() const { return iterator(0); }
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif //MENUS_H
|
||||
|
|
173
amxmodx/CMisc.h
173
amxmodx/CMisc.h
|
@ -37,34 +37,35 @@
|
|||
// *****************************************************
|
||||
// class CCVar
|
||||
// *****************************************************
|
||||
|
||||
class CCVar
|
||||
{
|
||||
cvar_t cvar;
|
||||
String name;
|
||||
String plugin;
|
||||
|
||||
public:
|
||||
CCVar( const char* pname, const char* pplugin,
|
||||
int pflags, float pvalue ) : name(pname) , plugin(pplugin ) {
|
||||
CCVar(const char* pname, const char* pplugin, int pflags, float pvalue) : name(pname), plugin(pplugin)
|
||||
{
|
||||
cvar.name = (char*)name.c_str();
|
||||
cvar.flags = pflags;
|
||||
cvar.string = "";
|
||||
cvar.value = pvalue;
|
||||
}
|
||||
|
||||
inline cvar_t* getCvar() { return &cvar; }
|
||||
inline const char* getPluginName() { return plugin.c_str(); }
|
||||
inline const char* getName() { return name.c_str(); }
|
||||
inline bool operator == ( const char* string ) { return (strcmp(name.c_str(),string)==0); }
|
||||
inline bool operator == (const char* string) { return (strcmp(name.c_str(),string)==0); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
// *****************************************************
|
||||
// class CPlayer
|
||||
// *****************************************************
|
||||
|
||||
struct ClientCvarQuery_Info
|
||||
{
|
||||
bool querying; // Are we actually waiting for a response at the moment?
|
||||
bool querying; // Are we actually waiting for a response at the moment?
|
||||
String cvarName;
|
||||
int resultFwd;
|
||||
|
||||
|
@ -89,7 +90,8 @@ public:
|
|||
float time;
|
||||
float playtime;
|
||||
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
int ammo;
|
||||
int clip;
|
||||
} weapons[MAX_WEAPONS];
|
||||
|
@ -117,17 +119,20 @@ public:
|
|||
|
||||
CQueue<ClientCvarQuery_Info*> cvarQueryQueue;
|
||||
|
||||
void Init( edict_t* e , int i );
|
||||
void Init(edict_t* e, int i);
|
||||
void Disconnect();
|
||||
void PutInServer();
|
||||
bool Connect(const char* connectname,const char* ipaddress);
|
||||
|
||||
inline bool IsBot(){
|
||||
return ((pEdict->v.flags & FL_FAKECLIENT)?true:false);
|
||||
bool Connect(const char* connectname, const char* ipaddress);
|
||||
|
||||
inline bool IsBot()
|
||||
{
|
||||
return ((pEdict->v.flags & FL_FAKECLIENT) ? true : false);
|
||||
}
|
||||
|
||||
inline bool IsAlive(){
|
||||
return ((pEdict->v.deadflag==DEAD_NO)&&(pEdict->v.health>0));
|
||||
inline bool IsAlive()
|
||||
{
|
||||
return ((pEdict->v.deadflag == DEAD_NO) && (pEdict->v.health > 0));
|
||||
}
|
||||
|
||||
inline void Authorize() { authorized = true; }
|
||||
|
@ -140,36 +145,38 @@ public:
|
|||
|
||||
class Grenades
|
||||
{
|
||||
struct Obj
|
||||
{
|
||||
CPlayer* player;
|
||||
edict_t* grenade;
|
||||
float time;
|
||||
int type;
|
||||
Obj* next;
|
||||
} *head;
|
||||
|
||||
struct Obj
|
||||
{
|
||||
CPlayer* player;
|
||||
edict_t* grenade;
|
||||
float time;
|
||||
int type;
|
||||
Obj* next;
|
||||
} *head;
|
||||
|
||||
public:
|
||||
Grenades() { head = 0; }
|
||||
~Grenades() { clear(); }
|
||||
void put( edict_t* grenade, float time, int type, CPlayer* player );
|
||||
bool find( edict_t* enemy, CPlayer** p, int& type );
|
||||
void clear();
|
||||
Grenades() { head = 0; }
|
||||
~Grenades() { clear(); }
|
||||
void put(edict_t* grenade, float time, int type, CPlayer* player);
|
||||
bool find(edict_t* enemy, CPlayer** p, int& type);
|
||||
void clear();
|
||||
};
|
||||
|
||||
// *****************************************************
|
||||
// class ForceObject
|
||||
// *****************************************************
|
||||
class ForceObject {
|
||||
|
||||
class ForceObject
|
||||
{
|
||||
String filename;
|
||||
FORCE_TYPE type;
|
||||
Vector mins;
|
||||
Vector maxs;
|
||||
AMX* amx;
|
||||
public:
|
||||
ForceObject(const char* n, FORCE_TYPE c,Vector& mi, Vector& ma, AMX* a) :
|
||||
filename(n) , type(c), mins(mi), maxs(ma), amx(a) {}
|
||||
ForceObject(const char* n, FORCE_TYPE c, Vector& mi, Vector& ma, AMX* a) :
|
||||
filename(n), type(c), mins(mi), maxs(ma), amx(a) {}
|
||||
|
||||
inline const char* getFilename() { return filename.c_str(); }
|
||||
inline AMX* getAMX() { return amx; }
|
||||
Vector& getMin() { return mins; }
|
||||
|
@ -183,81 +190,89 @@ public:
|
|||
|
||||
class XVars
|
||||
{
|
||||
struct XVarEle {
|
||||
AMX* amx;
|
||||
cell* value;
|
||||
};
|
||||
struct XVarEle
|
||||
{
|
||||
AMX* amx;
|
||||
cell* value;
|
||||
};
|
||||
|
||||
XVarEle* head;
|
||||
int size;
|
||||
int num;
|
||||
|
||||
int realloc_array( int nsize );
|
||||
XVarEle* head;
|
||||
int size;
|
||||
int num;
|
||||
int realloc_array(int nsize);
|
||||
|
||||
public:
|
||||
XVars() { num = 0; size = 0; head = 0; }
|
||||
~XVars() { clear(); }
|
||||
void clear();
|
||||
int put( AMX* a, cell* v );
|
||||
inline cell getValue( int a ) {
|
||||
return ( a >= 0 && a < num ) ? *(head[a].value) : 0;
|
||||
}
|
||||
inline int setValue( int a, cell v ) {
|
||||
if ( a >= 0 && a < num ){
|
||||
*(head[a].value) = v;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
XVars() { num = 0; size = 0; head = 0; }
|
||||
~XVars() { clear(); }
|
||||
void clear();
|
||||
int put(AMX* a, cell* v);
|
||||
|
||||
inline cell getValue(int a)
|
||||
{
|
||||
return (a >= 0 && a < num) ? *(head[a].value) : 0;
|
||||
}
|
||||
|
||||
inline int setValue(int a, cell v)
|
||||
{
|
||||
if (a >= 0 && a < num)
|
||||
{
|
||||
*(head[a].value) = v;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
// *****************************************************
|
||||
// class CScript
|
||||
// *****************************************************
|
||||
|
||||
class CScript
|
||||
{
|
||||
String filename;
|
||||
AMX* amx;
|
||||
void* code;
|
||||
public:
|
||||
CScript(AMX* aa, void* cc,const char* ff):filename(ff),amx(aa),code(cc){}
|
||||
CScript(AMX* aa, void* cc, const char* ff) : filename(ff), amx(aa), code(cc) { }
|
||||
|
||||
inline AMX* getAMX() { return amx; }
|
||||
inline const char* getName() { return filename.c_str(); }
|
||||
inline bool operator==( void* a ) { return (amx == (AMX*)a); }
|
||||
inline bool operator==(void* a) { return (amx == (AMX*)a); }
|
||||
inline void* getCode() { return code; }
|
||||
};
|
||||
|
||||
// *****************************************************
|
||||
// class TeamIds
|
||||
// *****************************************************
|
||||
|
||||
class TeamIds
|
||||
{
|
||||
struct TeamEle {
|
||||
String name;
|
||||
int id;
|
||||
char tid;
|
||||
static char uid;
|
||||
TeamEle* next;
|
||||
TeamEle(const char* n, int& i) : name(n) , id(i) , next(0) {
|
||||
tid = uid++;
|
||||
};
|
||||
~TeamEle(){ --uid; }
|
||||
} *head;
|
||||
struct TeamEle
|
||||
{
|
||||
String name;
|
||||
int id;
|
||||
char tid;
|
||||
static char uid;
|
||||
TeamEle* next;
|
||||
|
||||
int newTeam;
|
||||
TeamEle(const char* n, int& i) : name(n), id(i), next(0)
|
||||
{
|
||||
tid = uid++;
|
||||
}
|
||||
|
||||
~TeamEle() { --uid; }
|
||||
} *head;
|
||||
|
||||
int newTeam;
|
||||
|
||||
public:
|
||||
TeamIds();
|
||||
~TeamIds();
|
||||
void registerTeam( const char* n ,int s );
|
||||
int findTeamId( const char* n);
|
||||
int findTeamIdCase( const char* n);
|
||||
inline bool isNewTeam() { return newTeam ? true : false; }
|
||||
TeamIds();
|
||||
~TeamIds();
|
||||
void registerTeam(const char* n, int s);
|
||||
int findTeamId(const char* n);
|
||||
int findTeamIdCase(const char* n);
|
||||
inline bool isNewTeam() { return newTeam ? true : false; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif //CMISC_H
|
||||
|
|
|
@ -36,19 +36,20 @@
|
|||
#ifndef CMODULE_H
|
||||
#define CMODULE_H
|
||||
|
||||
enum MODULE_STATUS {
|
||||
MODULE_NONE, // No module loaded
|
||||
MODULE_QUERY, // Query failed
|
||||
MODULE_BADLOAD, // Bad file or the module writer messed something up ;]
|
||||
MODULE_LOADED, // Loaded
|
||||
MODULE_NOINFO, // No info
|
||||
MODULE_NOQUERY, // No query function present
|
||||
MODULE_NOATTACH, // No attach function present
|
||||
MODULE_OLD, // Old interface
|
||||
MODULE_NEWER, // newer interface
|
||||
MODULE_INTERROR, // Internal error
|
||||
MODULE_FUNCNOTPRESENT, // Function not present
|
||||
MODULE_NOT64BIT // Not 64 bit compatible
|
||||
enum MODULE_STATUS
|
||||
{
|
||||
MODULE_NONE, // No module loaded
|
||||
MODULE_QUERY, // Query failed
|
||||
MODULE_BADLOAD, // Bad file or the module writer messed something up ;]
|
||||
MODULE_LOADED, // Loaded
|
||||
MODULE_NOINFO, // No info
|
||||
MODULE_NOQUERY, // No query function present
|
||||
MODULE_NOATTACH, // No attach function present
|
||||
MODULE_OLD, // Old interface
|
||||
MODULE_NEWER, // newer interface
|
||||
MODULE_INTERROR, // Internal error
|
||||
MODULE_FUNCNOTPRESENT, // Function not present
|
||||
MODULE_NOT64BIT // Not 64 bit compatible
|
||||
};
|
||||
|
||||
struct amxx_module_info_s
|
||||
|
@ -60,7 +61,6 @@ struct amxx_module_info_s
|
|||
const char *logtag; //added in version 2
|
||||
};
|
||||
|
||||
|
||||
#define AMXX_OK 0 /* no error */
|
||||
#define AMXX_IFVERS 1 /* interface version */
|
||||
#define AMXX_PARAM 2 /* Invalid parameter */
|
||||
|
@ -84,12 +84,15 @@ public:
|
|||
~CModule();
|
||||
|
||||
// Interface
|
||||
|
||||
bool attachModule();
|
||||
bool queryModule();
|
||||
bool detachModule();
|
||||
|
||||
#ifndef FAKEMETA
|
||||
bool attachMetamod(const char *mmfile, PLUG_LOADTIME now);
|
||||
#endif
|
||||
|
||||
const char* getStatus() const;
|
||||
inline const char* getType() const { return m_Amxx ? "amxx" : (m_Metamod ? "amx&mm" : "amx"); }
|
||||
inline const char* getAuthor() const { return m_InfoNew.author; }
|
||||
|
@ -97,7 +100,7 @@ public:
|
|||
inline const char* getName() const { return m_InfoNew.name; }
|
||||
inline const amxx_module_info_s* getInfoNew() const { return &m_InfoNew; } // new
|
||||
inline int getStatusValue() { return m_Status; }
|
||||
inline bool operator==( const char* fname ) { return !strcmp( m_Filename.c_str() , fname ); }
|
||||
inline bool operator==(const char* fname) { return !strcmp(m_Filename.c_str(), fname); }
|
||||
inline bool isReloadable() { return ((m_Status == MODULE_LOADED) && (m_InfoNew.reload != 0)); }
|
||||
inline bool isAmxx() const { return m_Amxx; }
|
||||
inline const char *getMissingFunc() const { return m_MissingFunc; }
|
||||
|
@ -108,7 +111,4 @@ public:
|
|||
CList<AMX_NATIVE_INFO*> m_Natives;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif //CMODULE_H
|
||||
|
|
|
@ -36,7 +36,8 @@
|
|||
// class CPluginMngr
|
||||
// *****************************************************
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
ps_bad_load,
|
||||
ps_error,
|
||||
ps_locked,
|
||||
|
@ -47,7 +48,6 @@ enum {
|
|||
|
||||
class CPluginMngr
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
class iterator;
|
||||
|
@ -70,12 +70,10 @@ public:
|
|||
int status;
|
||||
CPlugin* next;
|
||||
int id;
|
||||
CPlugin(int i , const char* p,const char* n, char* e, int d);
|
||||
~CPlugin( );
|
||||
CPlugin(int i, const char* p, const char* n, char* e, int d);
|
||||
~CPlugin();
|
||||
bool m_Debug;
|
||||
|
||||
public:
|
||||
|
||||
inline const char* getName() { return name.c_str();}
|
||||
inline const char* getVersion() { return version.c_str();}
|
||||
inline const char* getTitle() { return title.c_str();}
|
||||
|
@ -85,19 +83,19 @@ public:
|
|||
inline int getId() const { return id; }
|
||||
inline AMX* getAMX() { return &amx; }
|
||||
inline const AMX* getAMX() const { return &amx; }
|
||||
inline void setTitle( const char* n ) { title.assign(n); }
|
||||
inline void setAuthor( const char* n ) { author.assign(n); }
|
||||
inline void setVersion( const char* n ) { version.assign(n); }
|
||||
inline void setError( const char* n ) { errorMsg.assign(n); }
|
||||
inline void setTitle(const char* n) { title.assign(n); }
|
||||
inline void setAuthor(const char* n) { author.assign(n); }
|
||||
inline void setVersion(const char* n) { version.assign(n); }
|
||||
inline void setError(const char* n) { errorMsg.assign(n); }
|
||||
inline bool isValid() const { return (status >= ps_paused); }
|
||||
inline bool isPaused() const { return ( (status == ps_paused) || (status == ps_stopped) ); }
|
||||
inline bool isPaused() const { return ((status == ps_paused) || (status == ps_stopped)); }
|
||||
inline bool isExecutable(int id) const { return (isValid() && !isPaused()); }
|
||||
void Finalize();
|
||||
void pausePlugin();
|
||||
void unpausePlugin();
|
||||
void pauseFunction( int id );
|
||||
void unpauseFunction( int id );
|
||||
void setStatus( int a );
|
||||
void pauseFunction(int id);
|
||||
void unpauseFunction(int id);
|
||||
void setStatus(int a);
|
||||
const char* getStatus() const;
|
||||
inline bool isDebug() const { return m_Debug; }
|
||||
};
|
||||
|
@ -105,8 +103,6 @@ public:
|
|||
private:
|
||||
CPlugin *head;
|
||||
int pCounter;
|
||||
|
||||
|
||||
public:
|
||||
CPluginMngr() { head = 0; pCounter = 0; pNatives = NULL; m_Finalized=false;}
|
||||
~CPluginMngr() { clear(); }
|
||||
|
@ -117,8 +113,8 @@ public:
|
|||
// Interface
|
||||
|
||||
CPlugin* loadPlugin(const char* path, const char* name, char* error, int debug);
|
||||
void unloadPlugin( CPlugin** a );
|
||||
int loadPluginsFromFile( const char* filename );
|
||||
void unloadPlugin(CPlugin** a);
|
||||
int loadPluginsFromFile(const char* filename);
|
||||
CPlugin* findPluginFast(AMX *amx);
|
||||
CPlugin* findPlugin(AMX *amx);
|
||||
CPlugin* findPlugin(int index);
|
||||
|
@ -127,7 +123,8 @@ public:
|
|||
void Finalize();
|
||||
void clear();
|
||||
|
||||
class iterator {
|
||||
class iterator
|
||||
{
|
||||
CPlugin *a;
|
||||
public:
|
||||
iterator(CPlugin*aa) : a(aa) {}
|
||||
|
@ -137,10 +134,9 @@ public:
|
|||
operator bool () const { return a ? true : false; }
|
||||
CPlugin& operator*() { return *a; }
|
||||
};
|
||||
|
||||
inline iterator begin() const { return iterator(head); }
|
||||
inline iterator end() const { return iterator(0); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif //PLUGIN_H
|
||||
|
|
|
@ -43,27 +43,32 @@ public:
|
|||
T item;
|
||||
CStackItem *prev;
|
||||
};
|
||||
|
||||
public:
|
||||
CStack()
|
||||
{
|
||||
mSize = 0;
|
||||
mStack = NULL;
|
||||
}
|
||||
|
||||
~CStack()
|
||||
{
|
||||
CStackItem *p, *t;
|
||||
p = mStack;
|
||||
|
||||
while (p)
|
||||
{
|
||||
t = p->prev;
|
||||
delete p;
|
||||
p = t;
|
||||
}
|
||||
|
||||
mStack = NULL;
|
||||
}
|
||||
|
||||
bool empty()
|
||||
{
|
||||
return (mSize==0);
|
||||
return (mSize == 0);
|
||||
}
|
||||
|
||||
void push(const T & v)
|
||||
|
@ -98,4 +103,3 @@ private:
|
|||
};
|
||||
|
||||
#endif //_INCLUDE_CQUEUE_H
|
||||
|
||||
|
|
|
@ -54,19 +54,19 @@ private:
|
|||
// execution
|
||||
float m_fNextExecTime;
|
||||
public:
|
||||
void set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat, float fCurrentTime);
|
||||
void clear();
|
||||
bool isFree() const;
|
||||
void set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat, float fCurrentTime);
|
||||
void clear();
|
||||
bool isFree() const;
|
||||
|
||||
CPluginMngr::CPlugin *getPlugin() const;
|
||||
int getTaskId() const;
|
||||
CPluginMngr::CPlugin *getPlugin() const;
|
||||
int getTaskId() const;
|
||||
|
||||
void executeIfRequired(float fCurrentTime, float fTimeLimit, float fTimeLeft); // also removes the task if needed
|
||||
void executeIfRequired(float fCurrentTime, float fTimeLimit, float fTimeLeft); // also removes the task if needed
|
||||
|
||||
void changeBase(float fNewBase);
|
||||
void resetNextExecTime(float fCurrentTime);
|
||||
void changeBase(float fNewBase);
|
||||
void resetNextExecTime(float fCurrentTime);
|
||||
|
||||
bool shouldRepeat();
|
||||
bool shouldRepeat();
|
||||
|
||||
CTask();
|
||||
~CTask();
|
||||
|
@ -91,9 +91,8 @@ private:
|
|||
if (right.m_bFree)
|
||||
return left.isFree();
|
||||
|
||||
return !left.isFree() &&
|
||||
(right.m_pAmx ? left.getPlugin()->getAMX() == right.m_pAmx : true) &&
|
||||
left.getTaskId() == right.m_iId;
|
||||
return !left.isFree() && (right.m_pAmx ? left.getPlugin()->getAMX() == right.m_pAmx : true) &&
|
||||
left.getTaskId() == right.m_iId;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -110,13 +109,11 @@ public:
|
|||
|
||||
void registerTimers(float *pCurrentTime, float *pTimeLimit, float *pTimeLeft); // The timers will always point to the right value
|
||||
void registerTask(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat);
|
||||
int removeTasks(int iId, AMX *pAmx); // remove all tasks that match the id and amx
|
||||
int changeTasks(int iId, AMX *pAmx, float fNewBase); // change all tasks that match the id and amx
|
||||
int removeTasks(int iId, AMX *pAmx); // remove all tasks that match the id and amx
|
||||
int changeTasks(int iId, AMX *pAmx, float fNewBase); // change all tasks that match the id and amx
|
||||
bool taskExists(int iId, AMX *pAmx);
|
||||
void startFrame();
|
||||
void clear();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif //CTASK_H
|
||||
|
|
|
@ -41,53 +41,50 @@
|
|||
|
||||
class Vault
|
||||
{
|
||||
struct Obj
|
||||
{
|
||||
String key;
|
||||
String value;
|
||||
int number;
|
||||
Obj *next;
|
||||
Obj( const char* k, const char* v);
|
||||
} *head;
|
||||
struct Obj
|
||||
{
|
||||
String key;
|
||||
String value;
|
||||
int number;
|
||||
Obj *next;
|
||||
Obj(const char* k, const char* v);
|
||||
} *head;
|
||||
|
||||
String path;
|
||||
String path;
|
||||
|
||||
Obj** find( const char* n );
|
||||
Obj** find(const char* n);
|
||||
|
||||
public:
|
||||
|
||||
Vault() {head=0;}
|
||||
~Vault() { clear();}
|
||||
Vault() {head=0;}
|
||||
~Vault() { clear();}
|
||||
|
||||
// Interface
|
||||
|
||||
bool exists( const char* k );
|
||||
void put(const char* k, const char* v);
|
||||
void remove( const char* k );
|
||||
const char* get( const char* n );
|
||||
int get_number( const char* n );
|
||||
void setSource( const char* n );
|
||||
bool loadVault( );
|
||||
bool saveVault( );
|
||||
void clear();
|
||||
bool exists(const char* k);
|
||||
void put(const char* k, const char* v);
|
||||
void remove(const char* k);
|
||||
const char* get(const char* n);
|
||||
int get_number(const char* n);
|
||||
void setSource(const char* n);
|
||||
bool loadVault();
|
||||
bool saveVault();
|
||||
void clear();
|
||||
|
||||
class iterator
|
||||
{
|
||||
Obj * a;
|
||||
public:
|
||||
iterator(Obj* aa) : a(aa) {}
|
||||
iterator& operator++() { if (a) a = a->next; return *this; }
|
||||
bool operator==(const iterator& b) const { return a == b.a; }
|
||||
bool operator!=(const iterator& b) const { return !operator==(b); }
|
||||
String& key() const { return a->key; }
|
||||
String& value() const { return a->value; }
|
||||
};
|
||||
|
||||
class iterator {
|
||||
Obj * a;
|
||||
public:
|
||||
iterator(Obj*aa) : a(aa) {}
|
||||
iterator& operator++() { if ( a ) a = a->next; return *this; }
|
||||
bool operator==(const iterator& b) const { return a == b.a; }
|
||||
bool operator!=(const iterator& b) const { return !operator==(b); }
|
||||
String& key() const { return a->key; }
|
||||
String& value() const { return a->value; }
|
||||
};
|
||||
|
||||
inline iterator begin() const { return iterator(head); }
|
||||
inline iterator end() const { return iterator(0); }
|
||||
inline iterator begin() const { return iterator(head); }
|
||||
inline iterator end() const { return iterator(0); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif //VAULT_CUSTOM_H
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
#define __FAKEMETA_H__
|
||||
|
||||
#ifndef FAKEMETA
|
||||
int UnloadMetamodPlugin(void *handle);
|
||||
int LoadMetamodPlugin(const char *path, void **handle, PLUG_LOADTIME now);
|
||||
int UnloadMetamodPlugin(void *handle);
|
||||
int LoadMetamodPlugin(const char *path, void **handle, PLUG_LOADTIME now);
|
||||
#else
|
||||
// Fake metamod api for modules
|
||||
|
||||
|
@ -42,11 +42,12 @@ int LoadMetamodPlugin(const char *path, void **handle, PLUG_LOADTIME now);
|
|||
// from mplugin.h (metamod)
|
||||
// Flags to indicate current "load" state of plugin.
|
||||
// NOTE: order is important, as greater/less comparisons are made.
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
PL_EMPTY = 0, // empty slot
|
||||
PL_VALID, // has valid info in it
|
||||
PL_BADFILE, // nonexistent file (open failed),
|
||||
// or not a valid plugin file (query failed)
|
||||
// or not a valid plugin file (query failed)
|
||||
PL_OPENED, // dlopened and queried
|
||||
PL_FAILED, // opened, but failed to attach or unattach
|
||||
PL_RUNNING, // attached and running
|
||||
|
@ -55,11 +56,10 @@ typedef enum {
|
|||
|
||||
// from h_export.h (metamod)
|
||||
// Our GiveFnptrsToDll, called by engine.
|
||||
typedef void (WINAPI *GIVE_ENGINE_FUNCTIONS_FN) (enginefuncs_t
|
||||
*pengfuncsFromEngine, globalvars_t *pGlobals);
|
||||
|
||||
typedef void (WINAPI *GIVE_ENGINE_FUNCTIONS_FN) (enginefuncs_t *pengfuncsFromEngine, globalvars_t *pGlobals);
|
||||
|
||||
// *** CFakeMeta
|
||||
|
||||
class CFakeMeta
|
||||
{
|
||||
private:
|
||||
|
@ -100,7 +100,6 @@ public:
|
|||
inline void SetStatus(PLUG_STATUS newStatus)
|
||||
{ m_Status = newStatus; }
|
||||
|
||||
|
||||
inline plugin_info_t * GetInfo()
|
||||
{ return m_Info; }
|
||||
inline const plugin_info_t * GetInfo() const
|
||||
|
@ -232,4 +231,3 @@ extern CFakeMeta g_FakeMeta;
|
|||
#endif //FAKEMETA
|
||||
|
||||
#endif // #ifndef __FAKEMETA_H__
|
||||
|
||||
|
|
|
@ -36,10 +36,10 @@
|
|||
|
||||
#undef DLLEXPORT
|
||||
#ifndef __linux__
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define DLLEXPORT
|
||||
#define WINAPI
|
||||
#define DLLEXPORT
|
||||
#define WINAPI
|
||||
#endif
|
||||
|
||||
#undef C_DLLEXPORT
|
||||
|
|
|
@ -1,14 +1,45 @@
|
|||
/* AMX Mod X
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
* originally developed by OLO
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_NEWMENUS_H
|
||||
#define _INCLUDE_NEWMENUS_H
|
||||
|
||||
#define MENU_EXIT -3
|
||||
#define MENU_BACK -2
|
||||
#define MENU_MORE -1
|
||||
#define MENU_EXIT -3
|
||||
#define MENU_BACK -2
|
||||
#define MENU_MORE -1
|
||||
#define ITEM_IGNORE 0
|
||||
#define ITEM_ENABLED 1
|
||||
#define ITEM_DISABLED 2
|
||||
|
||||
#define MENUITEMS 7
|
||||
#define MENUITEMS 7
|
||||
|
||||
typedef int (*MENUITEM_CALLBACK)(int, int, int);
|
||||
|
||||
|
@ -22,9 +53,9 @@ struct menuitem
|
|||
size_t id;
|
||||
};
|
||||
|
||||
typedef unsigned int menu_t;
|
||||
typedef unsigned int item_t;
|
||||
typedef unsigned int page_t;
|
||||
typedef unsigned int menu_t;
|
||||
typedef unsigned int item_t;
|
||||
typedef unsigned int page_t;
|
||||
|
||||
class Menu
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user