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,
|
||||
|
@ -116,6 +117,7 @@ private:
|
|||
const char* sValue;
|
||||
MsgParamType type;
|
||||
};
|
||||
|
||||
MsgDataEntry *m_ParseVault;
|
||||
int m_ParseVaultSize;
|
||||
void NextParam(); // make sure a new parameter can be added
|
||||
|
@ -130,7 +132,7 @@ private:
|
|||
int m_ParsePos; // is args. num. - 1
|
||||
float* m_Timer;
|
||||
|
||||
ClEvent* getValidEvent(ClEvent* a );
|
||||
ClEvent* getValidEvent(ClEvent* a);
|
||||
|
||||
int m_CurrentMsgType;
|
||||
public:
|
||||
|
@ -150,10 +152,8 @@ public:
|
|||
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];
|
||||
}
|
||||
};
|
||||
|
@ -186,8 +198,7 @@ public:
|
|||
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,8 +40,8 @@
|
|||
// class LogEventsMngr
|
||||
// *****************************************************
|
||||
|
||||
class LogEventsMngr {
|
||||
|
||||
class LogEventsMngr
|
||||
{
|
||||
char logString[256];
|
||||
char logArgs[MAX_LOGARGS][128];
|
||||
int logArgc;
|
||||
|
@ -53,7 +53,6 @@ public:
|
|||
class CLogCmp;
|
||||
class iterator;
|
||||
class CLogEvent;
|
||||
|
||||
friend class CLogEvent;
|
||||
friend class CLogCmp;
|
||||
friend class iterator;
|
||||
|
@ -69,97 +68,101 @@ public:
|
|||
int result;
|
||||
bool in;
|
||||
CLogCmp *next;
|
||||
CLogCmp( const char* s, bool r, int p, CLogCmp *n, LogEventsMngr* mg ) : text(s) {
|
||||
|
||||
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:
|
||||
|
||||
public:
|
||||
int compareCondition(const char* string);
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
CLogCmp *logcmplist;
|
||||
|
||||
public:
|
||||
|
||||
class CLogEvent {
|
||||
class CLogEvent
|
||||
{
|
||||
friend class LogEventsMngr;
|
||||
friend class iterator;
|
||||
struct LogCondEle {
|
||||
|
||||
struct LogCondEle
|
||||
{
|
||||
CLogCmp *cmp;
|
||||
LogCondEle *next;
|
||||
LogCondEle(CLogCmp *c, LogCondEle *n): cmp(c) , next(n) { }
|
||||
LogCondEle(CLogCmp *c, LogCondEle *n): cmp(c), next(n) { }
|
||||
};
|
||||
struct LogCond {
|
||||
|
||||
struct LogCond
|
||||
{
|
||||
int argnum;
|
||||
LogCondEle *list;
|
||||
LogCond *next;
|
||||
LogCond( int a , LogCondEle* ee , LogCond* n ) : argnum(a) , list(ee), next(n) {}
|
||||
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(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 );
|
||||
void registerFilter(char* filter);
|
||||
inline int getFunction() { return func; }
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
CLogEvent *logevents[MAX_LOGARGS+1];
|
||||
CLogEvent *getValidLogEvent( CLogEvent * a );
|
||||
CLogEvent *getValidLogEvent(CLogEvent * a);
|
||||
CLogCmp* registerCondition(char* filter);
|
||||
void clearConditions();
|
||||
|
||||
public:
|
||||
|
||||
LogEventsMngr();
|
||||
~LogEventsMngr();
|
||||
|
||||
// Interface
|
||||
|
||||
|
||||
CLogEvent* registerLogEvent( CPluginMngr::CPlugin* plugin, int func, int pos );
|
||||
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 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 ]; }
|
||||
inline const char* getLogArg(int i) { return (i < 0 || i >= logArgc) ? "" : logArgs[i]; }
|
||||
void clearLogEvents();
|
||||
|
||||
|
||||
class iterator {
|
||||
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 );
|
||||
|
||||
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); }
|
||||
inline bool operator!=(const iterator& c) const { return !operator == (c); }
|
||||
CLogEvent& operator*() { return *a; }
|
||||
operator bool ( ) const { return a ? true : false; }
|
||||
operator bool () const { return a ? true : false; }
|
||||
};
|
||||
inline iterator begin() { return iterator(getValidLogEvent(logevents[ logArgc ]),this); }
|
||||
inline iterator end() { return iterator(0,this); }
|
||||
|
||||
inline iterator begin() { return iterator(getValidLogEvent(logevents[logArgc]), this); }
|
||||
inline iterator end() { return iterator(0, this); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif //LOGEVENTS_H
|
||||
|
|
|
@ -45,15 +45,17 @@ class MenuMngr
|
|||
MenuIdEle* next;
|
||||
int id;
|
||||
static int uniqueid;
|
||||
MenuIdEle( const char* n, AMX* a, MenuIdEle* m ) : name( n ) , amx(a) , next( m ) {
|
||||
|
||||
MenuIdEle(const char* n, AMX* a, MenuIdEle* m) : name(n), amx(a), next(m)
|
||||
{
|
||||
id = ++uniqueid;
|
||||
}
|
||||
|
||||
~MenuIdEle() { --uniqueid; }
|
||||
} *headid;
|
||||
|
||||
public:
|
||||
class iterator;
|
||||
|
||||
private:
|
||||
|
||||
class MenuCommand
|
||||
|
@ -66,27 +68,26 @@ private:
|
|||
int keys;
|
||||
int function;
|
||||
MenuCommand* next;
|
||||
MenuCommand( CPluginMngr::CPlugin *a, int mi, int k, int f );
|
||||
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)); }
|
||||
inline bool matchCommand(int m, int k) { return ((m == menuid) && (keys & k)); }
|
||||
} *headcmd;
|
||||
|
||||
public:
|
||||
|
||||
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
|
||||
|
|
|
@ -37,27 +37,28 @@
|
|||
// *****************************************************
|
||||
// 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
|
||||
// *****************************************************
|
||||
|
@ -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; }
|
||||
|
@ -149,27 +154,29 @@ class Grenades
|
|||
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 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,7 +190,8 @@ public:
|
|||
|
||||
class XVars
|
||||
{
|
||||
struct XVarEle {
|
||||
struct XVarEle
|
||||
{
|
||||
AMX* amx;
|
||||
cell* value;
|
||||
};
|
||||
|
@ -191,22 +199,27 @@ class XVars
|
|||
XVarEle* head;
|
||||
int size;
|
||||
int num;
|
||||
|
||||
int realloc_array( int nsize );
|
||||
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;
|
||||
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 ){
|
||||
|
||||
inline int setValue(int a, cell v)
|
||||
{
|
||||
if (a >= 0 && a < num)
|
||||
{
|
||||
*(head[a].value) = v;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
@ -214,34 +227,41 @@ public:
|
|||
// *****************************************************
|
||||
// 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 {
|
||||
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) {
|
||||
|
||||
TeamEle(const char* n, int& i) : name(n), id(i), next(0)
|
||||
{
|
||||
tid = uid++;
|
||||
};
|
||||
~TeamEle(){ --uid; }
|
||||
}
|
||||
|
||||
~TeamEle() { --uid; }
|
||||
} *head;
|
||||
|
||||
int newTeam;
|
||||
|
@ -249,15 +269,10 @@ class TeamIds
|
|||
public:
|
||||
TeamIds();
|
||||
~TeamIds();
|
||||
void registerTeam( const char* n ,int s );
|
||||
int findTeamId( const char* n);
|
||||
int findTeamIdCase( const char* n);
|
||||
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,7 +36,8 @@
|
|||
#ifndef CMODULE_H
|
||||
#define CMODULE_H
|
||||
|
||||
enum MODULE_STATUS {
|
||||
enum MODULE_STATUS
|
||||
{
|
||||
MODULE_NONE, // No module loaded
|
||||
MODULE_QUERY, // Query failed
|
||||
MODULE_BADLOAD, // Bad file or the module writer messed something up ;]
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -91,8 +91,7 @@ private:
|
|||
if (right.m_bFree)
|
||||
return left.isFree();
|
||||
|
||||
return !left.isFree() &&
|
||||
(right.m_pAmx ? left.getPlugin()->getAMX() == right.m_pAmx : true) &&
|
||||
return !left.isFree() && (right.m_pAmx ? left.getPlugin()->getAMX() == right.m_pAmx : true) &&
|
||||
left.getTaskId() == right.m_iId;
|
||||
}
|
||||
};
|
||||
|
@ -117,6 +116,4 @@ public:
|
|||
void clear();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif //CTASK_H
|
||||
|
|
|
@ -47,12 +47,12 @@ class Vault
|
|||
String value;
|
||||
int number;
|
||||
Obj *next;
|
||||
Obj( const char* k, const char* v);
|
||||
Obj(const char* k, const char* v);
|
||||
} *head;
|
||||
|
||||
String path;
|
||||
|
||||
Obj** find( const char* n );
|
||||
Obj** find(const char* n);
|
||||
|
||||
public:
|
||||
|
||||
|
@ -61,22 +61,22 @@ public:
|
|||
|
||||
// Interface
|
||||
|
||||
bool exists( const char* k );
|
||||
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 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 {
|
||||
class iterator
|
||||
{
|
||||
Obj * a;
|
||||
public:
|
||||
iterator(Obj*aa) : a(aa) {}
|
||||
iterator& operator++() { if ( a ) a = a->next; return *this; }
|
||||
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; }
|
||||
|
@ -87,7 +87,4 @@ public:
|
|||
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,7 +42,8 @@ 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),
|
||||
|
@ -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__
|
||||
|
||||
|
|
|
@ -1,3 +1,34 @@
|
|||
/* 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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user