cleaned-up versions of header files

This commit is contained in:
Borja Ferrer 2005-09-10 00:38:42 +00:00
parent fc955009da
commit e67457440d
16 changed files with 445 additions and 381 deletions

View File

@ -34,7 +34,8 @@
#define MAX_AMX_REG_MSG MAX_REG_MSGS+16 #define MAX_AMX_REG_MSG MAX_REG_MSGS+16
enum { enum
{
CS_DEATHMSG = MAX_REG_MSGS, CS_DEATHMSG = MAX_REG_MSGS,
// CS_ROUNDEND, // CS_ROUNDEND,
// CS_ROUNDSTART, // CS_ROUNDSTART,
@ -67,7 +68,7 @@ public:
class ClEvent 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 int m_Func; // function to be executed
CPluginMngr::CPlugin *m_Plugin; // the plugin this ClEvent class is assigned to CPluginMngr::CPlugin *m_Plugin; // the plugin this ClEvent class is assigned to
@ -100,7 +101,7 @@ public:
public: public:
// constructors & destructors // constructors & destructors
ClEvent(CPluginMngr::CPlugin* plugin, int func, int flags); ClEvent(CPluginMngr::CPlugin* plugin, int func, int flags);
~ClEvent(); ~ClEvent();
inline CPluginMngr::CPlugin* getPlugin(); inline CPluginMngr::CPlugin* getPlugin();
@ -116,21 +117,22 @@ private:
const char* sValue; const char* sValue;
MsgParamType type; MsgParamType type;
}; };
MsgDataEntry *m_ParseVault; MsgDataEntry *m_ParseVault;
int m_ParseVaultSize; 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 CList<ClEvent> ClEventVec;
typedef ClEventVec::iterator ClEventVecIter; typedef ClEventVec::iterator ClEventVecIter;
ClEventVec m_Events[MAX_AMX_REG_MSG]; ClEventVec m_Events[MAX_AMX_REG_MSG];
ClEventVec *m_ParseFun; // current Event vector ClEventVec *m_ParseFun; // current Event vector
bool m_ParseNotDone; bool m_ParseNotDone;
int m_ParsePos; // is args. num. - 1 int m_ParsePos; // is args. num. - 1
float* m_Timer; float* m_Timer;
ClEvent* getValidEvent(ClEvent* a ); ClEvent* getValidEvent(ClEvent* a);
int m_CurrentMsgType; int m_CurrentMsgType;
public: public:
@ -145,15 +147,13 @@ public:
void parseValue(float fValue); void parseValue(float fValue);
void parseValue(const char *sz); void parseValue(const char *sz);
void executeEvents(); void executeEvents();
int getArgNum() const; //{ return (parsePos+1); } int getArgNum() const; //{ return (parsePos+1); }
const char* getArgString(int a) const; const char* getArgString(int a) const;
int getArgInteger(int a) const; int getArgInteger(int a) const;
float getArgFloat(int a) const; float getArgFloat(int a) const;
void clearEvents(void); void clearEvents(void);
static int getEventId( const char* msg ); static int getEventId(const char* msg);
int getCurrentMsgType(); int getCurrentMsgType();
}; };
#endif // #ifdef __CEVENTS_H__ #endif //__CEVENTS_H__

View File

@ -41,18 +41,15 @@ class File
FILE* fp; FILE* fp;
public: public:
File( const char* n, const char* m ); File(const char* n, const char* m);
~File( ); ~File();
operator bool ( ) const; operator bool () const;
friend File& operator<<( File& f, const String& n ); friend File& operator<<(File& f, const String& n);
friend File& operator<<( File& f, const char* n ); friend File& operator<<(File& f, const char* n);
friend File& operator<<( File& f, const char& c ); friend File& operator<<(File& f, const char& c);
friend File& operator<<( File& f, int n ); friend File& operator<<(File& f, int n);
friend File& operator>>( File& f, String& n ); friend File& operator>>(File& f, String& n);
friend File& operator>>( File& f, char* n ); friend File& operator>>(File& f, char* n);
int getline( char* buf, int sz ); int getline(char* buf, int sz);
File& skipWs( ); File& skipWs();
}; };

View File

@ -88,31 +88,38 @@ class CForward
const char *m_FuncName; const char *m_FuncName;
ForwardExecType m_ExecType; ForwardExecType m_ExecType;
int m_NumParams; int m_NumParams;
struct AMXForward struct AMXForward
{ {
CPluginMngr::CPlugin *pPlugin; CPluginMngr::CPlugin *pPlugin;
int func; int func;
}; };
typedef CVector<AMXForward> AMXForwardList; typedef CVector<AMXForward> AMXForwardList;
AMXForwardList m_Funcs; AMXForwardList m_Funcs;
ForwardParam m_ParamTypes[FORWARD_MAX_PARAMS]; ForwardParam m_ParamTypes[FORWARD_MAX_PARAMS];
public: public:
CForward(const char *name, ForwardExecType et, int numParams, const ForwardParam * paramTypes); CForward(const char *name, ForwardExecType et, int numParams, const ForwardParam * paramTypes);
CForward() CForward()
{ } // leaves everything unitialized' { } // leaves everything unitialized'
cell execute(cell *params, ForwardPreparedArray *preparedArrays); cell execute(cell *params, ForwardPreparedArray *preparedArrays);
int getParamsNum() const int getParamsNum() const
{ {
return m_NumParams; return m_NumParams;
} }
int getFuncsNum() const int getFuncsNum() const
{ {
return m_Funcs.size(); return m_Funcs.size();
} }
ForwardParam getParamType(int paramId) const ForwardParam getParamType(int paramId) const
{ {
if (paramId < 0 || paramId >= m_NumParams) if (paramId < 0 || paramId >= m_NumParams)
return FP_DONE; return FP_DONE;
return m_ParamTypes[paramId]; return m_ParamTypes[paramId];
} }
}; };
@ -126,6 +133,7 @@ class CSPForward
AMX *m_Amx; AMX *m_Amx;
int m_Func; int m_Func;
bool m_HasFunc; bool m_HasFunc;
public: public:
bool isFree; bool isFree;
public: public:
@ -134,18 +142,22 @@ public:
void Set(int func, AMX *amx, int numParams, const ForwardParam * paramTypes); void Set(int func, AMX *amx, int numParams, const ForwardParam * paramTypes);
cell execute(cell *params, ForwardPreparedArray *preparedArrays); cell execute(cell *params, ForwardPreparedArray *preparedArrays);
int getParamsNum() const int getParamsNum() const
{ {
return m_NumParams; return m_NumParams;
} }
int getFuncsNum() const int getFuncsNum() const
{ {
return (m_HasFunc) ? 1 : 0; return (m_HasFunc) ? 1 : 0;
} }
ForwardParam getParamType(int paramId) const ForwardParam getParamType(int paramId) const
{ {
if (paramId < 0 || paramId >= m_NumParams) if (paramId < 0 || paramId >= m_NumParams)
return FP_DONE; return FP_DONE;
return m_ParamTypes[paramId]; return m_ParamTypes[paramId];
} }
}; };
@ -154,14 +166,14 @@ class CForwardMngr
{ {
typedef CVector<CForward*> ForwardVec; typedef CVector<CForward*> ForwardVec;
typedef CVector<CSPForward*> SPForwardVec; typedef CVector<CSPForward*> SPForwardVec;
typedef CQueue<int> FreeSPVec; // Free SP Forwards typedef CQueue<int> FreeSPVec; // Free SP Forwards
ForwardVec m_Forwards; ForwardVec m_Forwards;
SPForwardVec m_SPForwards; SPForwardVec m_SPForwards;
FreeSPVec m_FreeSPForwards; // so we don't have to free memory 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; int m_TmpArraysNum;
public: public:
@ -180,14 +192,13 @@ public:
void unregisterSPForward(int id); void unregisterSPForward(int id);
// execute forward // execute forward
cell executeForwards(int id, cell *params); 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 isIdValid(int id) const; // check whether forward id is valid
bool isSPForward(int id) const; // check whether forward is single plugin bool isSPForward(int id) const; // check whether forward is single plugin
int getParamsNum(int id) const; // get num of params of a forward 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 int getFuncsNum(int id) const; // get num of found functions of a forward
ForwardParam getParamType(int id, int paramId) const; ForwardParam getParamType(int id, int paramId) const;
cell prepareArray(void *ptr, unsigned int size, ForwardArrayElemType type, cell prepareArray(void *ptr, unsigned int size, ForwardArrayElemType type, bool copyBack); // prepare array
bool copyBack); // prepare array
}; };
// (un)register forward // (un)register forward
@ -202,5 +213,5 @@ cell executeForwards(int id, ...);
cell prepareCellArray(cell *ptr, unsigned int size, bool copyBack = false); cell prepareCellArray(cell *ptr, unsigned int size, bool copyBack = false);
cell prepareCharArray(char *ptr, unsigned int size, bool copyBack = false); cell prepareCharArray(char *ptr, unsigned int size, bool copyBack = false);
#endif #endif //FORWARD_H

View File

@ -79,6 +79,7 @@ class CLangMngr
{ {
return strcmp(left.m_LanguageName, right)==0 ? true : false; return strcmp(left.m_LanguageName, right)==0 ? true : false;
} }
// Get language name // Get language name
const char *GetName() { return m_LanguageName; } const char *GetName() { return m_LanguageName; }
// Save to file // Save to file
@ -91,8 +92,8 @@ class CLangMngr
int Entries() { return m_LookUpTable.size(); } int Entries() { return m_LookUpTable.size(); }
// Make a hash from a string; convert to lowercase first if needed // Make a hash from a string; convert to lowercase first if needed
static uint32_t MakeHash(const char *src, bool makeLower = false); static uint32_t MakeHash(const char *src, bool makeLower = false);
protected: protected:
// An entry in the language // An entry in the language
class LangEntry class LangEntry
{ {
@ -145,7 +146,7 @@ class CLangMngr
// Merge definitions into a language // Merge definitions into a language
void MergeDefinitions(const char *lang, CQueue <sKeyDef*> &tmpVec); void MergeDefinitions(const char *lang, CQueue <sKeyDef*> &tmpVec);
// strip lowercase; make lower if needed // 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*> LangVec;
typedef CVector<CLang*>::iterator LangVecIter; typedef CVector<CLang*>::iterator LangVecIter;

View File

@ -35,6 +35,7 @@
// ***************************************************** // *****************************************************
// class CList // class CList
// ***************************************************** // *****************************************************
// Linked list // Linked list
template <typename T, typename F = char* > template <typename T, typename F = char* >
class CList class CList
@ -162,6 +163,7 @@ public:
{ {
iterator tmp(*this); iterator tmp(*this);
m_CurPos = m_CurPos->next; m_CurPos = m_CurPos->next;
return tmp; return tmp;
} }
@ -176,6 +178,7 @@ public:
{ {
return m_pList->remove(*this); return m_pList->remove(*this);
} }
iterator put(T *obj) iterator put(T *obj)
{ {
return m_pList->put(obj, *this); return m_pList->put(obj, *this);
@ -187,6 +190,7 @@ public:
m_pHead = NULL; m_pHead = NULL;
m_pTail = NULL; m_pTail = NULL;
} }
~CList<T,F>() ~CList<T,F>()
{ {
clear(); clear();
@ -198,12 +202,15 @@ public:
iterator remove(iterator &where) iterator remove(iterator &where)
{ {
iterator tmp(where.GetNext()); iterator tmp(where.GetNext());
if (where.m_CurPos == m_pHead) if (where.m_CurPos == m_pHead)
m_pHead = where.m_CurPos->GetNext(); m_pHead = where.m_CurPos->GetNext();
if (where.m_CurPos == m_pTail) if (where.m_CurPos == m_pTail)
m_pTail = where.m_CurPos->GetPrev(); m_pTail = where.m_CurPos->GetPrev();
delete where.m_CurPos; delete where.m_CurPos;
where = tmp; where = tmp;
return tmp; return tmp;
} }
@ -212,36 +219,36 @@ public:
iterator put_back(T *pObj) iterator put_back(T *pObj)
{ {
CElement *pTmp = new CElement(pObj); CElement *pTmp = new CElement(pObj);
if (!m_pHead) if (!m_pHead)
{ {
m_pHead = pTmp; m_pHead = pTmp;
m_pTail = pTmp; m_pTail = pTmp;
} } else {
else
{
pTmp->SetNext(NULL); pTmp->SetNext(NULL);
pTmp->SetPrev(m_pTail); pTmp->SetPrev(m_pTail);
m_pTail->SetNext(pTmp); m_pTail->SetNext(pTmp);
m_pTail = pTmp; m_pTail = pTmp;
} }
return iterator(this, pTmp); return iterator(this, pTmp);
} }
iterator put_front(T *pObj) iterator put_front(T *pObj)
{ {
CElement *pTmp = new CElement(pObj); CElement *pTmp = new CElement(pObj);
if (!m_pHead) if (!m_pHead)
{ {
m_pHead = pTmp; m_pHead = pTmp;
m_pTail = pTmp; m_pTail = pTmp;
} } else {
else
{
pTmp->SetNext(m_pHead); pTmp->SetNext(m_pHead);
pTmp->SetPrev(NULL); pTmp->SetPrev(NULL);
m_pHead->SetPrev(pTmp); m_pHead->SetPrev(pTmp);
m_pHead = pTmp; m_pHead = pTmp;
} }
return iterator(this, pTmp); return iterator(this, pTmp);
} }
@ -257,6 +264,7 @@ public:
iterator put(T *pObj, iterator &where) iterator put(T *pObj, iterator &where)
{ {
CElement *pTmp = new CElement(pObj); CElement *pTmp = new CElement(pObj);
if (where.m_CurPos->GetNext()) if (where.m_CurPos->GetNext())
where.m_CurPos->GetNext()->SetPrev(pTmp); where.m_CurPos->GetNext()->SetPrev(pTmp);
else // where = tail else // where = tail
@ -266,6 +274,7 @@ public:
pTmp->SetNext(where.m_CurPos->GetNext()); pTmp->SetNext(where.m_CurPos->GetNext());
where.m_CurPos->SetNext(pTmp); where.m_CurPos->SetNext(pTmp);
return ++where; return ++where;
} }
@ -289,6 +298,7 @@ public:
break; break;
++iter; ++iter;
} }
return iter; return iter;
} }
@ -300,14 +310,16 @@ public:
int size() int size()
{ {
iterator iter = begin(); iterator iter = begin();
int i=0; int i = 0;
while (iter) while (iter)
{ {
++i; ++i;
++iter; ++iter;
} }
return i; return i;
} }
}; };
#endif
#endif //CLIST_H

View File

@ -40,126 +40,129 @@
// class LogEventsMngr // class LogEventsMngr
// ***************************************************** // *****************************************************
class LogEventsMngr { class LogEventsMngr
{
char logString[256]; char logString[256];
char logArgs[MAX_LOGARGS][128]; char logArgs[MAX_LOGARGS][128];
int logArgc; int logArgc;
int logCounter; int logCounter;
int logCurrent; int logCurrent;
bool arelogevents; bool arelogevents;
public: public:
class CLogCmp; class CLogCmp;
class iterator; class iterator;
class CLogEvent; class CLogEvent;
friend class CLogEvent;
friend class CLogCmp;
friend class iterator;
class CLogCmp
{
friend class LogEventsMngr;
friend class CLogEvent; friend class CLogEvent;
LogEventsMngr* parent; friend class CLogCmp;
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 iterator; friend class iterator;
struct LogCondEle {
CLogCmp *cmp; class CLogCmp
LogCondEle *next; {
LogCondEle(CLogCmp *c, LogCondEle *n): cmp(c) , next(n) { } 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: private:
CLogCmp *logcmplist;
CLogEvent *logevents[MAX_LOGARGS+1];
CLogEvent *getValidLogEvent( CLogEvent * a );
CLogCmp* registerCondition(char* filter);
void clearConditions();
public: public:
LogEventsMngr(); class CLogEvent
~LogEventsMngr(); {
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 // 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* registerLogEvent( CPluginMngr::CPlugin* plugin, int func, int pos ); {
inline bool logEventsExist() { return arelogevents; } CLogEvent* a;
void setLogString( char* frmt, va_list& vaptr ); LogEventsMngr* b;
void setLogString( char* frmt , ... );
void parseLogString( ); public:
void executeLogEvents(); inline iterator(CLogEvent*aa,LogEventsMngr* bb) : a(aa), b(bb) {}
inline const char* getLogString() { return logString; }
inline int getLogArgNum() { return logArgc; } inline iterator& operator++()
inline const char* getLogArg( int i ) { return ( i < 0 || i >= logArgc ) ? "" : logArgs[ i ]; } {
void clearLogEvents(); a = b->getValidLogEvent(a->next);
return *this;
}
class iterator {
CLogEvent* a; inline bool operator==(const iterator& c) const { return a == c.a; }
LogEventsMngr* b; inline bool operator!=(const iterator& c) const { return !operator == (c); }
public: CLogEvent& operator*() { return *a; }
inline iterator(CLogEvent*aa,LogEventsMngr* bb) : a(aa), b(bb) {} operator bool () const { return a ? true : false; }
inline iterator& operator++() { };
a = b->getValidLogEvent( a->next );
return *this; 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

View File

@ -38,55 +38,56 @@
class MenuMngr class MenuMngr
{ {
struct MenuIdEle struct MenuIdEle
{ {
String name; String name;
AMX* amx; AMX* amx;
MenuIdEle* next; MenuIdEle* next;
int id; int id;
static int uniqueid; static int uniqueid;
MenuIdEle( const char* n, AMX* a, MenuIdEle* m ) : name( n ) , amx(a) , next( m ) {
id = ++uniqueid; MenuIdEle(const char* n, AMX* a, MenuIdEle* m) : name(n), amx(a), next(m)
} {
~MenuIdEle() { --uniqueid; } id = ++uniqueid;
} *headid; }
~MenuIdEle() { --uniqueid; }
} *headid;
public: public:
class iterator; class iterator;
private: private:
class MenuCommand class MenuCommand
{ {
friend class iterator; friend class iterator;
friend class MenuMngr; friend class MenuMngr;
CPluginMngr::CPlugin *plugin; CPluginMngr::CPlugin *plugin;
int menuid; int menuid;
int keys; int keys;
int function; int function;
MenuCommand* next; MenuCommand* next;
MenuCommand( CPluginMngr::CPlugin *a, int mi, int k, int f ); MenuCommand(CPluginMngr::CPlugin *a, int mi, int k, int f);
public: public:
inline int getFunction() { return function; } inline int getFunction() { return function; }
inline CPluginMngr::CPlugin* getPlugin() { return plugin; } 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; } *headcmd;
public: public:
MenuMngr() { headid = 0; headcmd = 0; }
MenuMngr() { headid = 0; headcmd = 0; }
~MenuMngr(); ~MenuMngr();
// Interface // Interface
int findMenuId(const char* name, AMX* a = 0); 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 registerMenuCmd(CPluginMngr::CPlugin *a, int mi, int k, int f);
void clear(); void clear();
class iterator { class iterator
{
MenuCommand* a; MenuCommand* a;
public: public:
iterator(MenuCommand*aa) : a(aa) {} iterator(MenuCommand*aa) : a(aa) {}
@ -96,8 +97,9 @@ public:
operator bool () const { return a ? true : false; } operator bool () const { return a ? true : false; }
MenuCommand& operator*() { return *a; } MenuCommand& operator*() { return *a; }
}; };
inline iterator begin() const { return iterator(headcmd); } inline iterator begin() const { return iterator(headcmd); }
inline iterator end() const { return iterator(0); } inline iterator end() const { return iterator(0); }
}; };
#endif #endif //MENUS_H

View File

@ -37,34 +37,35 @@
// ***************************************************** // *****************************************************
// class CCVar // class CCVar
// ***************************************************** // *****************************************************
class CCVar class CCVar
{ {
cvar_t cvar; cvar_t cvar;
String name; String name;
String plugin; String plugin;
public: public:
CCVar( const char* pname, const char* pplugin, CCVar(const char* pname, const char* pplugin, int pflags, float pvalue) : name(pname), plugin(pplugin)
int pflags, float pvalue ) : name(pname) , plugin(pplugin ) { {
cvar.name = (char*)name.c_str(); cvar.name = (char*)name.c_str();
cvar.flags = pflags; cvar.flags = pflags;
cvar.string = ""; cvar.string = "";
cvar.value = pvalue; cvar.value = pvalue;
} }
inline cvar_t* getCvar() { return &cvar; } inline cvar_t* getCvar() { return &cvar; }
inline const char* getPluginName() { return plugin.c_str(); } inline const char* getPluginName() { return plugin.c_str(); }
inline const char* getName() { return name.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 // class CPlayer
// ***************************************************** // *****************************************************
struct ClientCvarQuery_Info 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; String cvarName;
int resultFwd; int resultFwd;
@ -89,7 +90,8 @@ public:
float time; float time;
float playtime; float playtime;
struct { struct
{
int ammo; int ammo;
int clip; int clip;
} weapons[MAX_WEAPONS]; } weapons[MAX_WEAPONS];
@ -117,17 +119,20 @@ public:
CQueue<ClientCvarQuery_Info*> cvarQueryQueue; CQueue<ClientCvarQuery_Info*> cvarQueryQueue;
void Init( edict_t* e , int i ); void Init(edict_t* e, int i);
void Disconnect(); void Disconnect();
void PutInServer(); void PutInServer();
bool Connect(const char* connectname,const char* ipaddress);
bool Connect(const char* connectname, const char* ipaddress);
inline bool IsBot(){ inline bool IsBot()
return ((pEdict->v.flags & FL_FAKECLIENT)?true:false); {
return ((pEdict->v.flags & FL_FAKECLIENT) ? true : false);
} }
inline bool IsAlive(){ inline bool IsAlive()
return ((pEdict->v.deadflag==DEAD_NO)&&(pEdict->v.health>0)); {
return ((pEdict->v.deadflag == DEAD_NO) && (pEdict->v.health > 0));
} }
inline void Authorize() { authorized = true; } inline void Authorize() { authorized = true; }
@ -140,36 +145,38 @@ public:
class Grenades class Grenades
{ {
struct Obj struct Obj
{ {
CPlayer* player; CPlayer* player;
edict_t* grenade; edict_t* grenade;
float time; float time;
int type; int type;
Obj* next; Obj* next;
} *head; } *head;
public: public:
Grenades() { head = 0; } Grenades() { head = 0; }
~Grenades() { clear(); } ~Grenades() { clear(); }
void put( edict_t* grenade, float time, int type, CPlayer* player ); void put(edict_t* grenade, float time, int type, CPlayer* player);
bool find( edict_t* enemy, CPlayer** p, int& type ); bool find(edict_t* enemy, CPlayer** p, int& type);
void clear(); void clear();
}; };
// ***************************************************** // *****************************************************
// class ForceObject // class ForceObject
// ***************************************************** // *****************************************************
class ForceObject {
class ForceObject
{
String filename; String filename;
FORCE_TYPE type; FORCE_TYPE type;
Vector mins; Vector mins;
Vector maxs; Vector maxs;
AMX* amx; AMX* amx;
public: public:
ForceObject(const char* n, FORCE_TYPE c,Vector& mi, Vector& 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) {} filename(n), type(c), mins(mi), maxs(ma), amx(a) {}
inline const char* getFilename() { return filename.c_str(); } inline const char* getFilename() { return filename.c_str(); }
inline AMX* getAMX() { return amx; } inline AMX* getAMX() { return amx; }
Vector& getMin() { return mins; } Vector& getMin() { return mins; }
@ -183,81 +190,89 @@ public:
class XVars class XVars
{ {
struct XVarEle { struct XVarEle
AMX* amx; {
cell* value; AMX* amx;
}; cell* value;
};
XVarEle* head; XVarEle* head;
int size; int size;
int num; int num;
int realloc_array(int nsize);
int realloc_array( int nsize );
public: public:
XVars() { num = 0; size = 0; head = 0; } XVars() { num = 0; size = 0; head = 0; }
~XVars() { clear(); } ~XVars() { clear(); }
void clear(); void clear();
int put( AMX* a, cell* v ); int put(AMX* a, cell* v);
inline cell getValue( int a ) {
return ( a >= 0 && a < num ) ? *(head[a].value) : 0; inline cell getValue(int a)
} {
inline int setValue( int a, cell v ) { return (a >= 0 && a < num) ? *(head[a].value) : 0;
if ( a >= 0 && a < num ){ }
*(head[a].value) = v;
return 0; inline int setValue(int a, cell v)
} {
return 1; if (a >= 0 && a < num)
} {
*(head[a].value) = v;
return 0;
}
return 1;
}
}; };
// ***************************************************** // *****************************************************
// class CScript // class CScript
// ***************************************************** // *****************************************************
class CScript class CScript
{ {
String filename; String filename;
AMX* amx; AMX* amx;
void* code; void* code;
public: 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 AMX* getAMX() { return amx; }
inline const char* getName() { return filename.c_str(); } 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; } inline void* getCode() { return code; }
}; };
// ***************************************************** // *****************************************************
// class TeamIds // class TeamIds
// ***************************************************** // *****************************************************
class TeamIds class TeamIds
{ {
struct TeamEle { struct TeamEle
String name; {
int id; String name;
char tid; int id;
static char uid; char tid;
TeamEle* next; static char uid;
TeamEle(const char* n, int& i) : name(n) , id(i) , next(0) { TeamEle* next;
tid = uid++;
}; TeamEle(const char* n, int& i) : name(n), id(i), next(0)
~TeamEle(){ --uid; } {
} *head; tid = uid++;
}
~TeamEle() { --uid; }
} *head;
int newTeam; int newTeam;
public: public:
TeamIds(); TeamIds();
~TeamIds(); ~TeamIds();
void registerTeam( const char* n ,int s ); void registerTeam(const char* n, int s);
int findTeamId( const char* n); int findTeamId(const char* n);
int findTeamIdCase( const char* n); int findTeamIdCase(const char* n);
inline bool isNewTeam() { return newTeam ? true : false; } inline bool isNewTeam() { return newTeam ? true : false; }
}; };
#endif //CMISC_H
#endif

View File

@ -36,19 +36,20 @@
#ifndef CMODULE_H #ifndef CMODULE_H
#define CMODULE_H #define CMODULE_H
enum MODULE_STATUS { enum MODULE_STATUS
MODULE_NONE, // No module loaded {
MODULE_QUERY, // Query failed MODULE_NONE, // No module loaded
MODULE_BADLOAD, // Bad file or the module writer messed something up ;] MODULE_QUERY, // Query failed
MODULE_LOADED, // Loaded MODULE_BADLOAD, // Bad file or the module writer messed something up ;]
MODULE_NOINFO, // No info MODULE_LOADED, // Loaded
MODULE_NOQUERY, // No query function present MODULE_NOINFO, // No info
MODULE_NOATTACH, // No attach function present MODULE_NOQUERY, // No query function present
MODULE_OLD, // Old interface MODULE_NOATTACH, // No attach function present
MODULE_NEWER, // newer interface MODULE_OLD, // Old interface
MODULE_INTERROR, // Internal error MODULE_NEWER, // newer interface
MODULE_FUNCNOTPRESENT, // Function not present MODULE_INTERROR, // Internal error
MODULE_NOT64BIT // Not 64 bit compatible MODULE_FUNCNOTPRESENT, // Function not present
MODULE_NOT64BIT // Not 64 bit compatible
}; };
struct amxx_module_info_s struct amxx_module_info_s
@ -60,7 +61,6 @@ struct amxx_module_info_s
const char *logtag; //added in version 2 const char *logtag; //added in version 2
}; };
#define AMXX_OK 0 /* no error */ #define AMXX_OK 0 /* no error */
#define AMXX_IFVERS 1 /* interface version */ #define AMXX_IFVERS 1 /* interface version */
#define AMXX_PARAM 2 /* Invalid parameter */ #define AMXX_PARAM 2 /* Invalid parameter */
@ -84,12 +84,15 @@ public:
~CModule(); ~CModule();
// Interface // Interface
bool attachModule(); bool attachModule();
bool queryModule(); bool queryModule();
bool detachModule(); bool detachModule();
#ifndef FAKEMETA #ifndef FAKEMETA
bool attachMetamod(const char *mmfile, PLUG_LOADTIME now); bool attachMetamod(const char *mmfile, PLUG_LOADTIME now);
#endif #endif
const char* getStatus() const; const char* getStatus() const;
inline const char* getType() const { return m_Amxx ? "amxx" : (m_Metamod ? "amx&mm" : "amx"); } inline const char* getType() const { return m_Amxx ? "amxx" : (m_Metamod ? "amx&mm" : "amx"); }
inline const char* getAuthor() const { return m_InfoNew.author; } 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 char* getName() const { return m_InfoNew.name; }
inline const amxx_module_info_s* getInfoNew() const { return &m_InfoNew; } // new inline const amxx_module_info_s* getInfoNew() const { return &m_InfoNew; } // new
inline int getStatusValue() { return m_Status; } 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 isReloadable() { return ((m_Status == MODULE_LOADED) && (m_InfoNew.reload != 0)); }
inline bool isAmxx() const { return m_Amxx; } inline bool isAmxx() const { return m_Amxx; }
inline const char *getMissingFunc() const { return m_MissingFunc; } inline const char *getMissingFunc() const { return m_MissingFunc; }
@ -108,7 +111,4 @@ public:
CList<AMX_NATIVE_INFO*> m_Natives; CList<AMX_NATIVE_INFO*> m_Natives;
}; };
#endif #endif //CMODULE_H

View File

@ -36,7 +36,8 @@
// class CPluginMngr // class CPluginMngr
// ***************************************************** // *****************************************************
enum { enum
{
ps_bad_load, ps_bad_load,
ps_error, ps_error,
ps_locked, ps_locked,
@ -47,7 +48,6 @@ enum {
class CPluginMngr class CPluginMngr
{ {
public: public:
class iterator; class iterator;
@ -70,12 +70,10 @@ public:
int status; int status;
CPlugin* next; CPlugin* next;
int id; int id;
CPlugin(int i , const char* p,const char* n, char* e, int d); CPlugin(int i, const char* p, const char* n, char* e, int d);
~CPlugin( ); ~CPlugin();
bool m_Debug; bool m_Debug;
public: public:
inline const char* getName() { return name.c_str();} inline const char* getName() { return name.c_str();}
inline const char* getVersion() { return version.c_str();} inline const char* getVersion() { return version.c_str();}
inline const char* getTitle() { return title.c_str();} inline const char* getTitle() { return title.c_str();}
@ -85,19 +83,19 @@ public:
inline int getId() const { return id; } inline int getId() const { return id; }
inline AMX* getAMX() { return &amx; } inline AMX* getAMX() { return &amx; }
inline const AMX* getAMX() const { return &amx; } inline const AMX* getAMX() const { return &amx; }
inline void setTitle( const char* n ) { title.assign(n); } inline void setTitle(const char* n) { title.assign(n); }
inline void setAuthor( const char* n ) { author.assign(n); } inline void setAuthor(const char* n) { author.assign(n); }
inline void setVersion( const char* n ) { version.assign(n); } inline void setVersion(const char* n) { version.assign(n); }
inline void setError( const char* n ) { errorMsg.assign(n); } inline void setError(const char* n) { errorMsg.assign(n); }
inline bool isValid() const { return (status >= ps_paused); } 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()); } inline bool isExecutable(int id) const { return (isValid() && !isPaused()); }
void Finalize(); void Finalize();
void pausePlugin(); void pausePlugin();
void unpausePlugin(); void unpausePlugin();
void pauseFunction( int id ); void pauseFunction(int id);
void unpauseFunction( int id ); void unpauseFunction(int id);
void setStatus( int a ); void setStatus(int a);
const char* getStatus() const; const char* getStatus() const;
inline bool isDebug() const { return m_Debug; } inline bool isDebug() const { return m_Debug; }
}; };
@ -105,8 +103,6 @@ public:
private: private:
CPlugin *head; CPlugin *head;
int pCounter; int pCounter;
public: public:
CPluginMngr() { head = 0; pCounter = 0; pNatives = NULL; m_Finalized=false;} CPluginMngr() { head = 0; pCounter = 0; pNatives = NULL; m_Finalized=false;}
~CPluginMngr() { clear(); } ~CPluginMngr() { clear(); }
@ -117,8 +113,8 @@ public:
// Interface // Interface
CPlugin* loadPlugin(const char* path, const char* name, char* error, int debug); CPlugin* loadPlugin(const char* path, const char* name, char* error, int debug);
void unloadPlugin( CPlugin** a ); void unloadPlugin(CPlugin** a);
int loadPluginsFromFile( const char* filename ); int loadPluginsFromFile(const char* filename);
CPlugin* findPluginFast(AMX *amx); CPlugin* findPluginFast(AMX *amx);
CPlugin* findPlugin(AMX *amx); CPlugin* findPlugin(AMX *amx);
CPlugin* findPlugin(int index); CPlugin* findPlugin(int index);
@ -127,7 +123,8 @@ public:
void Finalize(); void Finalize();
void clear(); void clear();
class iterator { class iterator
{
CPlugin *a; CPlugin *a;
public: public:
iterator(CPlugin*aa) : a(aa) {} iterator(CPlugin*aa) : a(aa) {}
@ -137,10 +134,9 @@ public:
operator bool () const { return a ? true : false; } operator bool () const { return a ? true : false; }
CPlugin& operator*() { return *a; } CPlugin& operator*() { return *a; }
}; };
inline iterator begin() const { return iterator(head); } inline iterator begin() const { return iterator(head); }
inline iterator end() const { return iterator(0); } inline iterator end() const { return iterator(0); }
}; };
#endif #endif //PLUGIN_H

View File

@ -43,27 +43,32 @@ public:
T item; T item;
CStackItem *prev; CStackItem *prev;
}; };
public: public:
CStack() CStack()
{ {
mSize = 0; mSize = 0;
mStack = NULL; mStack = NULL;
} }
~CStack() ~CStack()
{ {
CStackItem *p, *t; CStackItem *p, *t;
p = mStack; p = mStack;
while (p) while (p)
{ {
t = p->prev; t = p->prev;
delete p; delete p;
p = t; p = t;
} }
mStack = NULL; mStack = NULL;
} }
bool empty() bool empty()
{ {
return (mSize==0); return (mSize == 0);
} }
void push(const T & v) void push(const T & v)
@ -98,4 +103,3 @@ private:
}; };
#endif //_INCLUDE_CQUEUE_H #endif //_INCLUDE_CQUEUE_H

View File

@ -54,19 +54,19 @@ private:
// execution // execution
float m_fNextExecTime; float m_fNextExecTime;
public: public:
void set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat, float fCurrentTime); void set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat, float fCurrentTime);
void clear(); void clear();
bool isFree() const; bool isFree() const;
CPluginMngr::CPlugin *getPlugin() const; CPluginMngr::CPlugin *getPlugin() const;
int getTaskId() 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 changeBase(float fNewBase);
void resetNextExecTime(float fCurrentTime); void resetNextExecTime(float fCurrentTime);
bool shouldRepeat(); bool shouldRepeat();
CTask(); CTask();
~CTask(); ~CTask();
@ -91,9 +91,8 @@ private:
if (right.m_bFree) if (right.m_bFree)
return left.isFree(); return left.isFree();
return !left.isFree() && return !left.isFree() && (right.m_pAmx ? left.getPlugin()->getAMX() == right.m_pAmx : true) &&
(right.m_pAmx ? left.getPlugin()->getAMX() == right.m_pAmx : true) && left.getTaskId() == right.m_iId;
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 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); 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 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 changeTasks(int iId, AMX *pAmx, float fNewBase); // change all tasks that match the id and amx
bool taskExists(int iId, AMX *pAmx); bool taskExists(int iId, AMX *pAmx);
void startFrame(); void startFrame();
void clear(); void clear();
}; };
#endif #endif //CTASK_H

View File

@ -41,53 +41,50 @@
class Vault class Vault
{ {
struct Obj struct Obj
{ {
String key; String key;
String value; String value;
int number; int number;
Obj *next; Obj *next;
Obj( const char* k, const char* v); Obj(const char* k, const char* v);
} *head; } *head;
String path; String path;
Obj** find( const char* n ); Obj** find(const char* n);
public: public:
Vault() {head=0;} Vault() {head=0;}
~Vault() { clear();} ~Vault() { clear();}
// Interface // Interface
bool exists( const char* k ); bool exists(const char* k);
void put(const char* k, const char* v); void put(const char* k, const char* v);
void remove( const char* k ); void remove(const char* k);
const char* get( const char* n ); const char* get(const char* n);
int get_number( const char* n ); int get_number(const char* n);
void setSource( const char* n ); void setSource(const char* n);
bool loadVault( ); bool loadVault();
bool saveVault( ); bool saveVault();
void clear(); 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 { inline iterator begin() const { return iterator(head); }
Obj * a; inline iterator end() const { return iterator(0); }
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); }
}; };
#endif #endif //VAULT_CUSTOM_H

View File

@ -32,8 +32,8 @@
#define __FAKEMETA_H__ #define __FAKEMETA_H__
#ifndef FAKEMETA #ifndef FAKEMETA
int UnloadMetamodPlugin(void *handle); int UnloadMetamodPlugin(void *handle);
int LoadMetamodPlugin(const char *path, void **handle, PLUG_LOADTIME now); int LoadMetamodPlugin(const char *path, void **handle, PLUG_LOADTIME now);
#else #else
// Fake metamod api for modules // Fake metamod api for modules
@ -42,11 +42,12 @@ int LoadMetamodPlugin(const char *path, void **handle, PLUG_LOADTIME now);
// from mplugin.h (metamod) // from mplugin.h (metamod)
// Flags to indicate current "load" state of plugin. // Flags to indicate current "load" state of plugin.
// NOTE: order is important, as greater/less comparisons are made. // NOTE: order is important, as greater/less comparisons are made.
typedef enum { typedef enum
{
PL_EMPTY = 0, // empty slot PL_EMPTY = 0, // empty slot
PL_VALID, // has valid info in it PL_VALID, // has valid info in it
PL_BADFILE, // nonexistent file (open failed), 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_OPENED, // dlopened and queried
PL_FAILED, // opened, but failed to attach or unattach PL_FAILED, // opened, but failed to attach or unattach
PL_RUNNING, // attached and running PL_RUNNING, // attached and running
@ -55,11 +56,10 @@ typedef enum {
// from h_export.h (metamod) // from h_export.h (metamod)
// Our GiveFnptrsToDll, called by engine. // Our GiveFnptrsToDll, called by engine.
typedef void (WINAPI *GIVE_ENGINE_FUNCTIONS_FN) (enginefuncs_t typedef void (WINAPI *GIVE_ENGINE_FUNCTIONS_FN) (enginefuncs_t *pengfuncsFromEngine, globalvars_t *pGlobals);
*pengfuncsFromEngine, globalvars_t *pGlobals);
// *** CFakeMeta // *** CFakeMeta
class CFakeMeta class CFakeMeta
{ {
private: private:
@ -100,7 +100,6 @@ public:
inline void SetStatus(PLUG_STATUS newStatus) inline void SetStatus(PLUG_STATUS newStatus)
{ m_Status = newStatus; } { m_Status = newStatus; }
inline plugin_info_t * GetInfo() inline plugin_info_t * GetInfo()
{ return m_Info; } { return m_Info; }
inline const plugin_info_t * GetInfo() const inline const plugin_info_t * GetInfo() const
@ -232,4 +231,3 @@ extern CFakeMeta g_FakeMeta;
#endif //FAKEMETA #endif //FAKEMETA
#endif // #ifndef __FAKEMETA_H__ #endif // #ifndef __FAKEMETA_H__

View File

@ -36,10 +36,10 @@
#undef DLLEXPORT #undef DLLEXPORT
#ifndef __linux__ #ifndef __linux__
#define DLLEXPORT __declspec(dllexport) #define DLLEXPORT __declspec(dllexport)
#else #else
#define DLLEXPORT #define DLLEXPORT
#define WINAPI #define WINAPI
#endif #endif
#undef C_DLLEXPORT #undef C_DLLEXPORT

View File

@ -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 #ifndef _INCLUDE_NEWMENUS_H
#define _INCLUDE_NEWMENUS_H #define _INCLUDE_NEWMENUS_H
#define MENU_EXIT -3 #define MENU_EXIT -3
#define MENU_BACK -2 #define MENU_BACK -2
#define MENU_MORE -1 #define MENU_MORE -1
#define ITEM_IGNORE 0 #define ITEM_IGNORE 0
#define ITEM_ENABLED 1 #define ITEM_ENABLED 1
#define ITEM_DISABLED 2 #define ITEM_DISABLED 2
#define MENUITEMS 7 #define MENUITEMS 7
typedef int (*MENUITEM_CALLBACK)(int, int, int); typedef int (*MENUITEM_CALLBACK)(int, int, int);
@ -22,9 +53,9 @@ struct menuitem
size_t id; size_t id;
}; };
typedef unsigned int menu_t; typedef unsigned int menu_t;
typedef unsigned int item_t; typedef unsigned int item_t;
typedef unsigned int page_t; typedef unsigned int page_t;
class Menu class Menu
{ {