From 955fcb854927e9c70a09039d5bfbd12f8af7641d Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 13 Aug 2004 08:46:04 +0000 Subject: [PATCH] Rewrote CString --- amxmodx/CCmd.cpp | 6 +- amxmodx/CCmd.h | 22 ++--- amxmodx/CEvent.cpp | 8 +- amxmodx/CEvent.h | 2 +- amxmodx/CFile.cpp | 8 +- amxmodx/CFile.h | 4 +- amxmodx/CLogEvent.cpp | 6 +- amxmodx/CLogEvent.h | 2 +- amxmodx/CMenu.cpp | 2 +- amxmodx/CMenu.h | 2 +- amxmodx/CMisc.cpp | 16 ++-- amxmodx/CMisc.h | 30 +++---- amxmodx/CModule.cpp | 12 +-- amxmodx/CModule.h | 6 +- amxmodx/CPlugin.cpp | 8 +- amxmodx/CPlugin.h | 22 ++--- amxmodx/CString.cpp | 70 ---------------- amxmodx/CString.h | 124 ++++++++++++++++++++++++----- amxmodx/CVault.cpp | 12 +-- amxmodx/CVault.h | 10 +-- amxmodx/amxmodx.cpp | 45 +++++------ amxmodx/amxmodx.h | 6 +- amxmodx/amxxlog.cpp | 28 +++---- amxmodx/amxxlog.h | 6 +- amxmodx/emsg.cpp | 10 +-- amxmodx/fakemeta.cpp | 20 ++--- amxmodx/fakemeta.h | 6 +- amxmodx/meta_api.cpp | 38 ++++----- amxmodx/modules.cpp | 10 +-- amxmodx/msvc/amxmodx_mm 7.1.vcproj | 6 +- amxmodx/msvc/amxmodx_mm.sln | 22 ++--- amxmodx/msvc/amxmodx_mm.vcproj | 102 ++++++++++++++++++------ 32 files changed, 366 insertions(+), 305 deletions(-) delete mode 100755 amxmodx/CString.cpp diff --git a/amxmodx/CCmd.cpp b/amxmodx/CCmd.cpp index a0469d4d..82663c4b 100755 --- a/amxmodx/CCmd.cpp +++ b/amxmodx/CCmd.cpp @@ -56,8 +56,8 @@ CmdMngr::Command::Command( CPluginMngr::CPlugin* pplugin,const char* pcmd, char szCmd[64], szArg[64]; *szCmd = 0; *szArg=0; sscanf(pcmd,"%s %s",szCmd,szArg); - command.set(szCmd); - argument.set(szArg); + command.assign(szCmd); + argument.assign(szArg); plugin = pplugin; flags = pflags; cmdtype = 0; @@ -238,7 +238,7 @@ void CmdMngr::registerPrefix( const char* nn ) CmdMngr::CmdPrefix** CmdMngr::findPrefix( const char* nn ){ CmdPrefix** aa = &prefixHead; while(*aa){ - if ( !strncmp( (*aa)->name.str(), nn, (*aa)->name.size() ) ) + if ( !strncmp( (*aa)->name.c_str(), nn, (*aa)->name.size() ) ) break; aa=&(*aa)->next; } diff --git a/amxmodx/CCmd.h b/amxmodx/CCmd.h index 34ea2dce..11002e69 100755 --- a/amxmodx/CCmd.h +++ b/amxmodx/CCmd.h @@ -52,10 +52,10 @@ public: friend class CmdMngr; CPluginMngr::CPlugin* plugin; CmdMngr* parent; - String command; - String argument; - String commandline; - String info; + CString command; + CString argument; + CString commandline; + CString info; bool listable; int function; int flags; @@ -67,12 +67,12 @@ public: ~Command(); public: - inline const char* getCommand() const{ return command.str(); } - inline const char* getArgument() const{ return argument.str(); } - inline const char* getCmdInfo() const{ return info.str(); } - inline const char* getCmdLine() const{ return commandline.str(); } - inline bool matchCommandLine(const char* cmd, const char* arg) { return (!stricmp(command.str()+prefix, cmd+prefix ) && (argument.empty() || !stricmp(argument.str() , arg ))); } - inline bool matchCommand(const char* cmd) { return (!strcmp(command.str(), cmd )); } + inline const char* getCommand() { return command.c_str(); } + inline const char* getArgument() { return argument.c_str(); } + inline const char* getCmdInfo() { return info.c_str(); } + inline const char* getCmdLine() { return commandline.c_str(); } + inline bool matchCommandLine(const char* cmd, const char* arg) { return (!stricmp(command.c_str()+prefix, cmd+prefix ) && (argument.empty() || !stricmp(argument.c_str() , arg ))); } + inline bool matchCommand(const char* cmd) { return (!strcmp(command.c_str(), cmd )); } inline int getFunction() const { return function; } inline bool gotAccess(int f) const { return (!flags||((flags & f)==flags)); } inline CPluginMngr::CPlugin* getPlugin() { return plugin; } @@ -100,7 +100,7 @@ private: CmdLink* clcmdlist; struct CmdPrefix { - String name; + CString name; CmdMngr* parent; CmdLink* list; CmdPrefix* next; diff --git a/amxmodx/CEvent.cpp b/amxmodx/CEvent.cpp index bd6b4a72..911f25aa 100755 --- a/amxmodx/CEvent.cpp +++ b/amxmodx/CEvent.cpp @@ -169,7 +169,7 @@ void EventsMngr::ClEvent::registerFilter(char *filter) tmpCond->paramId = atoi(filter); // rest of line - tmpCond->sValue.set(value); + tmpCond->sValue.assign(value); tmpCond->fValue = atof(value); tmpCond->iValue = atoi(value); @@ -381,9 +381,9 @@ void EventsMngr::parseValue(const char *sz) anyConditions = true; switch(condIter->type) { - case '=': if (!strcmp(sz, condIter->sValue.str())) execute=true; break; - case '!': if (strcmp(sz, condIter->sValue.str())) execute=true; break; - case '&': if (strstr(sz, condIter->sValue.str())) execute=true; break; + case '=': if (!strcmp(sz, condIter->sValue.c_str())) execute=true; break; + case '!': if (strcmp(sz, condIter->sValue.c_str())) execute=true; break; + case '&': if (strstr(sz, condIter->sValue.c_str())) execute=true; break; } if (execute) break; diff --git a/amxmodx/CEvent.h b/amxmodx/CEvent.h index 0a3f8ba0..44469536 100755 --- a/amxmodx/CEvent.h +++ b/amxmodx/CEvent.h @@ -88,7 +88,7 @@ public: { int paramId; // the message parameter id - String sValue; // value (string) + CString sValue; // value (string) float fValue; // value (float) int iValue; // value (int) int type; // type (can be int, float, string) diff --git a/amxmodx/CFile.cpp b/amxmodx/CFile.cpp index 2743140e..ffd969c7 100755 --- a/amxmodx/CFile.cpp +++ b/amxmodx/CFile.cpp @@ -52,9 +52,9 @@ File::operator bool ( ) const return fp && !feof(fp); } -File& operator<<( File& f, const String& n ) +File& operator<<( File& f, const CString& n ) { - if ( f ) fputs( n.str() , f.fp ) ; + if ( f ) fputs( n.c_str() , f.fp ) ; return f; } @@ -77,12 +77,12 @@ File& operator<<( File& f, const char& c ) return f; } -File& operator>>( File& f, String& n ) +File& operator>>( File& f, CString& n ) { if ( !f ) return f; char temp[1024]; fscanf( f.fp , "%s", temp ); - n.set(temp); + n.assign(temp); return f; } diff --git a/amxmodx/CFile.h b/amxmodx/CFile.h index e8995bcc..b7a83cb6 100755 --- a/amxmodx/CFile.h +++ b/amxmodx/CFile.h @@ -44,11 +44,11 @@ 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 CString& 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, CString& n ); friend File& operator>>( File& f, char* n ); int getline( char* buf, int sz ); File& skipWs( ); diff --git a/amxmodx/CLogEvent.cpp b/amxmodx/CLogEvent.cpp index b6998afe..bda823d3 100755 --- a/amxmodx/CLogEvent.cpp +++ b/amxmodx/CLogEvent.cpp @@ -50,8 +50,8 @@ int LogEventsMngr::CLogCmp::compareCondition(const char* string){ if ( logid == parent->logCounter ) return result; logid = parent->logCounter; - if ( in ) return result = strstr( string , text.str() ) ? 0 : 1; - return result = strcmp(string,text.str()); + if ( in ) return result = strstr( string , text.c_str() ) ? 0 : 1; + return result = strcmp(string,text.c_str()); } LogEventsMngr::CLogCmp* LogEventsMngr::registerCondition(char* filter){ @@ -65,7 +65,7 @@ LogEventsMngr::CLogCmp* LogEventsMngr::registerCondition(char* filter){ if ( pos < 0 || pos >= MAX_LOGARGS) pos = 0; CLogCmp* c = logcmplist; while( c ) { - if ( (c->pos==pos) && (c->in==in) && !strcmp(c->text.str(), filter)) + if ( (c->pos==pos) && (c->in==in) && !strcmp(c->text.c_str(), filter)) return c; c = c->next; } diff --git a/amxmodx/CLogEvent.h b/amxmodx/CLogEvent.h index 5512b74b..7c5c87c4 100755 --- a/amxmodx/CLogEvent.h +++ b/amxmodx/CLogEvent.h @@ -63,7 +63,7 @@ public: friend class LogEventsMngr; friend class CLogEvent; LogEventsMngr* parent; - String text; + CString text; int logid; int pos; int result; diff --git a/amxmodx/CMenu.cpp b/amxmodx/CMenu.cpp index f442df1f..72ccac58 100755 --- a/amxmodx/CMenu.cpp +++ b/amxmodx/CMenu.cpp @@ -51,7 +51,7 @@ MenuMngr::~MenuMngr() int MenuMngr::findMenuId(const char* name, AMX* amx) { for( MenuIdEle* b = headid; b ; b = b->next) { - if ( (!b->amx || amx == b->amx) && strstr(name,b->name.str()) ) + if ( (!b->amx || amx == b->amx) && strstr(name,b->name.c_str()) ) return b->id; } return 0; diff --git a/amxmodx/CMenu.h b/amxmodx/CMenu.h index 66e89b2c..152363c6 100755 --- a/amxmodx/CMenu.h +++ b/amxmodx/CMenu.h @@ -40,7 +40,7 @@ class MenuMngr { struct MenuIdEle { - String name; + CString name; AMX* amx; MenuIdEle* next; int id; diff --git a/amxmodx/CMisc.cpp b/amxmodx/CMisc.cpp index 4f75d576..fbe977fc 100755 --- a/amxmodx/CMisc.cpp +++ b/amxmodx/CMisc.cpp @@ -29,10 +29,10 @@ * version. */ #include "amxmodx.h" - // ***************************************************** // class CPlayer // ***************************************************** + void CPlayer::Init( edict_t* e , int i ) { index = i; @@ -61,13 +61,14 @@ void CPlayer::Disconnect() { authorized = false; bot = 0; } + void CPlayer::PutInServer() { playtime = gpGlobals->time; ingame = true; } bool CPlayer::Connect(const char* connectname,const char* ipaddress) { - name.set(connectname); - ip.set(ipaddress); + name.assign(connectname); + ip.assign(ipaddress); time = gpGlobals->time; bot = IsBot(); death_killer = 0; @@ -118,7 +119,8 @@ bool Grenades::find( edict_t* enemy, CPlayer** p, int& type ) Obj* b = (*a)->next; delete *a; *a = b; - continue; + + continue; } a = &(*a)->next; @@ -190,7 +192,7 @@ void TeamIds::registerTeam( const char* n ,int s ) { TeamEle** a = &head; while( *a ){ - if ( strcmp((*a)->name.str(),n) == 0 ){ + if ( strcmp((*a)->name.c_str(),n) == 0 ){ if (s != -1){ (*a)->id = s; newTeam &= ~(1<<(*a)->tid); @@ -208,7 +210,7 @@ int TeamIds::findTeamId( const char* n ) { TeamEle* a = head; while( a ){ - if ( !strcmpi(a->name.str(),n) ) + if ( !strcmpi(a->name.c_str(),n) ) return a->id; a = a->next; } @@ -219,7 +221,7 @@ int TeamIds::findTeamIdCase( const char* n) { TeamEle* a = head; while( a ){ - if ( !strcmp(a->name.str(), n) ) + if ( !strcmp(a->name.c_str(), n) ) return a->id; a = a->next; } diff --git a/amxmodx/CMisc.h b/amxmodx/CMisc.h index 109f0287..d55c439b 100755 --- a/amxmodx/CMisc.h +++ b/amxmodx/CMisc.h @@ -40,20 +40,20 @@ class CCVar { cvar_t cvar; - String name; - String plugin; + CString name; + CString plugin; public: CCVar( const char* pname, const char* pplugin, int pflags, float pvalue ) : name(pname) , plugin(pplugin ) { - cvar.name = (char*)name.str(); + 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.str(); } - inline const char* getName() { return name.str(); } - inline bool operator == ( const char* string ) const { return (strcmp(name.str(),string)==0); } + 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); } }; @@ -68,9 +68,9 @@ class CPlayer public: edict_t* pEdict; - String name; - String ip; - String team; + CString name; + CString ip; + CString team; bool initialized; bool ingame; @@ -98,7 +98,7 @@ public: int death_killer; int death_victim; bool death_tk; - String death_weapon; + CString death_weapon; Vector lastTrace; Vector thisTrace; @@ -150,7 +150,7 @@ public: // class ForceObject // ***************************************************** class ForceObject { - String filename; + CString filename; FORCE_TYPE type; Vector mins; Vector maxs; @@ -158,7 +158,7 @@ class ForceObject { public: 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.str(); } + inline const char* getFilename() { return filename.c_str(); } inline AMX* getAMX() { return amx; } Vector& getMin() { return mins; } Vector& getMax() { return maxs; } @@ -204,13 +204,13 @@ public: // ***************************************************** class CScript { - String filename; + CString filename; AMX* amx; void* code; public: 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.str(); } + inline const char* getName() { return filename.c_str(); } inline bool operator==( void* a ) { return (amx == (AMX*)a); } inline void* getCode() { return code; } }; @@ -221,7 +221,7 @@ public: class TeamIds { struct TeamEle { - String name; + CString name; int id; char tid; static char uid; diff --git a/amxmodx/CModule.cpp b/amxmodx/CModule.cpp index 429694ef..b7f42d82 100755 --- a/amxmodx/CModule.cpp +++ b/amxmodx/CModule.cpp @@ -147,7 +147,7 @@ void CModule::clear(bool clearFilename) m_Handle = NULL; m_Status = MODULE_NONE; if (clearFilename) - m_Filename.set("unknown"); + m_Filename.assign("unknown"); // old m_InfoOld = NULL; @@ -187,7 +187,7 @@ bool CModule::attachModule() m_Status = MODULE_LOADED; return true; case AMXX_PARAM: - AMXXLOG_Log("[AMXX] Internal Error: Module \"%s\" (version \"%s\") retured \"Invalid parameter\" from Attach func.", m_Filename.str(), getVersion()); + AMXXLOG_Log("[AMXX] Internal Error: Module \"%s\" (version \"%s\") retured \"Invalid parameter\" from Attach func.", m_Filename.c_str(), getVersion()); m_Status = MODULE_INTERROR; return false; case AMXX_FUNC_NOT_PRESENT: @@ -195,7 +195,7 @@ bool CModule::attachModule() m_MissingFunc = g_LastRequestedFunc; return false; default: - AMXXLOG_Log("[AMXX] Module \"%s\" (version \"%s\") returned an invalid code.", m_Filename.str(), getVersion()); + AMXXLOG_Log("[AMXX] Module \"%s\" (version \"%s\") returned an invalid code.", m_Filename.c_str(), getVersion()); m_Status = MODULE_BADLOAD; return false; } @@ -217,7 +217,7 @@ bool CModule::queryModule() if (m_Status != MODULE_NONE) // don't check if already queried return false; - m_Handle = DLLOAD(m_Filename.str()); // load file + m_Handle = DLLOAD(m_Filename.c_str()); // load file if (!m_Handle) { m_Status = MODULE_BADLOAD; @@ -242,7 +242,7 @@ bool CModule::queryModule() switch (retVal) { case AMXX_PARAM: - AMXXLOG_Log("[AMXX] Internal Error: Module \"%s\" (version \"%s\") retured \"Invalid parameter\" from Attach func.", m_Filename.str(), getVersion()); + AMXXLOG_Log("[AMXX] Internal Error: Module \"%s\" (version \"%s\") retured \"Invalid parameter\" from Attach func.", m_Filename.c_str(), getVersion()); m_Status = MODULE_INTERROR; return false; case AMXX_IFVERS: @@ -254,7 +254,7 @@ bool CModule::queryModule() case AMXX_OK: break; default: - AMXXLOG_Log("[AMXX] Module \"%s\" (version \"%s\") returned an invalid code.", m_Filename.str(), getVersion()); + AMXXLOG_Log("[AMXX] Module \"%s\" (version \"%s\") returned an invalid code.", m_Filename.c_str(), getVersion()); m_Status = MODULE_BADLOAD; return false; } diff --git a/amxmodx/CModule.h b/amxmodx/CModule.h index c4694c8e..68aca045 100755 --- a/amxmodx/CModule.h +++ b/amxmodx/CModule.h @@ -69,7 +69,7 @@ struct amxx_module_info_s class CModule { - String m_Filename; // Filename + CString m_Filename; // Filename bool m_Metamod; // Using metamod? bool m_Amxx; // Using new module interface? module_info_s* m_InfoOld; // module info (old module interface) @@ -95,11 +95,11 @@ public: inline module_info_s* getInfo() const { return m_InfoOld; } // old inline const amxx_module_info_s* getInfoNew() const { return &m_InfoNew; } // new inline int getStatusValue() { return m_Status; } - inline bool operator==( void* fname ) { return !strcmp( m_Filename.str() , (char*)fname ); } + inline bool operator==( void* fname ) { return !strcmp( m_Filename.c_str() , (char*)fname ); } inline bool isReloadable() { return m_Amxx ? ((m_Status == MODULE_LOADED) && (m_InfoNew.reload != 0)) : ( (m_Status==MODULE_LOADED) && (m_InfoOld->type==RELOAD_MODULE)); } inline bool isAmxx() const { return m_Amxx; } inline const char *getMissingFunc() const { return m_MissingFunc; } - inline const char *getFilename() const { return m_Filename.str(); } + inline const char *getFilename() { return m_Filename.c_str(); } void CModule::CallPluginsLoaded(); CList m_Natives; diff --git a/amxmodx/CPlugin.cpp b/amxmodx/CPlugin.cpp index e821e26f..9076017c 100755 --- a/amxmodx/CPlugin.cpp +++ b/amxmodx/CPlugin.cpp @@ -112,7 +112,7 @@ CPluginMngr::CPlugin* CPluginMngr::findPlugin(const char* name) { int len = strlen(name); if (!len) return 0; CPlugin*a = head; - while( a && strncmp(a->name.str(), name,len) ) + while( a && strncmp(a->name.c_str(), name,len) ) a=a->next; return a; } @@ -130,9 +130,9 @@ const char* CPluginMngr::CPlugin::getStatus() const { CPluginMngr::CPlugin::CPlugin(int i, const char* p,const char* n, char* e) : name(n), title(n) { const char* unk = "unknown"; - title.set(unk); - author.set(unk); - version.set(unk); + title.assign(unk); + author.assign(unk); + version.assign(unk); char* path = build_pathname("%s/%s",p,n); code = 0; int err = load_amxscript(&amx,&code,path,e ); diff --git a/amxmodx/CPlugin.h b/amxmodx/CPlugin.h index 82c6d461..2e29945e 100755 --- a/amxmodx/CPlugin.h +++ b/amxmodx/CPlugin.h @@ -59,10 +59,10 @@ public: AMX amx; void* code; - String name; - String version; - String title; - String author; + CString name; + CString version; + CString title; + CString author; int paused_fun; int status; CPlugin* next; @@ -72,15 +72,15 @@ public: public: - inline const char* getName() const { return name.str();} - inline const char* getVersion() const { return version.str();} - inline const char* getTitle() const { return title.str();} - inline const char* getAuthor()const { return author.str();} + inline const char* getName() { return name.c_str();} + inline const char* getVersion() { return version.c_str();} + inline const char* getTitle() { return title.c_str();} + inline const char* getAuthor() { return author.c_str();} inline int getId() const { return id; } inline AMX* getAMX() { return &amx; } - inline void setTitle( const char* n ) { title.set(n); } - inline void setAuthor( const char* n ) { author.set(n); } - inline void setVersion( const char* n ) { version.set(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 bool isValid() const { return ((status != ps_bad_load) && (status != ps_locked)); } inline bool isPaused() const { return ( (status == ps_paused) || (status == ps_stopped)); } inline bool isFunctionPaused( int id ) const { return (paused_fun & (1< mSize) + { + char *t = new char[d+1]; + if (v) { + strcpy(t, v); + t[strlen(v)] = 0; + delete [] v; + } + v = t; + mSize = d; + } + } + + char *v; + int mSize; }; -#endif - - - +#endif //_INCLUDE_CSTRING_H \ No newline at end of file diff --git a/amxmodx/CVault.cpp b/amxmodx/CVault.cpp index 55016ca9..c6c5b85a 100755 --- a/amxmodx/CVault.cpp +++ b/amxmodx/CVault.cpp @@ -60,7 +60,7 @@ void Vault::put( const char* k, const char* v ) if ( *a ) { - (*a)->value.set(v); + (*a)->value.assign(v); (*a)->number = atoi( v ); } else @@ -78,7 +78,7 @@ Vault::Obj** Vault::find( const char* n ) while( *a ) { - if ( strcmp((*a)->key.str(), n) == 0 ) + if ( strcmp((*a)->key.c_str(), n) == 0 ) return a; a = &(*a)->next; @@ -107,7 +107,7 @@ const char* Vault::get( const char* n ) if ( b == 0 ) return ""; - return b->value.str(); + return b->value.c_str(); } void Vault::clear() @@ -133,7 +133,7 @@ void Vault::remove( const char* n ) void Vault::setSource( const char* n ) { - path.set(n); + path.assign(n); } @@ -143,7 +143,7 @@ bool Vault::loadVault( ) clear(); - File a( path.str() , "r" ); + File a( path.c_str() , "r" ); if ( !a ) return false; @@ -165,7 +165,7 @@ bool Vault::saveVault( ) { if ( path.empty() ) return false; - File a( path.str() , "w" ); + File a( path.c_str() , "w" ); if ( !a ) return false; diff --git a/amxmodx/CVault.h b/amxmodx/CVault.h index a2db7eb8..57a4276e 100755 --- a/amxmodx/CVault.h +++ b/amxmodx/CVault.h @@ -43,14 +43,14 @@ class Vault { struct Obj { - String key; - String value; + CString key; + CString value; int number; Obj *next; Obj( const char* k, const char* v); } *head; - String path; + CString path; Obj** find( const char* n ); @@ -79,8 +79,8 @@ public: 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; } + CString& key() const { return a->key; } + CString& value() const { return a->value; } }; inline iterator begin() const { return iterator(head); } diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index 6155e07e..dfd8bd47 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -29,7 +29,6 @@ * version. */ -#include #include #include "amxmodx.h" @@ -193,7 +192,7 @@ static cell AMX_NATIVE_CALL console_print(AMX *amx, cell *params) /* 2 param */ static cell AMX_NATIVE_CALL client_print(AMX *amx, cell *params) /* 3 param */ { - int len; + int len = 0; char *msg; if (params[1] == 0) { @@ -310,7 +309,7 @@ static cell AMX_NATIVE_CALL get_user_name(AMX *amx, cell *params) /* 3 param */ { int index = params[1]; return set_amxstring(amx,params[2],(index<1||index>gpGlobals->maxClients) ? - hostname->string : g_players[index].name.str() , params[3]); + hostname->string : g_players[index].name.c_str() , params[3]); } static cell AMX_NATIVE_CALL get_user_index(AMX *amx, cell *params) /* 1 param */ @@ -319,7 +318,7 @@ static cell AMX_NATIVE_CALL get_user_index(AMX *amx, cell *params) /* 1 param * char* sptemp = get_amxstring(amx,params[1],0,i); for(i = 1; i <= gpGlobals->maxClients; ++i) { CPlayer* pPlayer = GET_PLAYER_POINTER_I(i); - if ( strcmp(pPlayer->name.str(), sptemp) == 0 ) + if ( strcmp(pPlayer->name.c_str(), sptemp) == 0 ) return i; } @@ -471,7 +470,7 @@ static cell AMX_NATIVE_CALL get_weaponname(AMX *amx, cell *params) /* 3 param */ amx_RaiseError(amx,AMX_ERR_NATIVE); return 0; } - return set_amxstring(amx,params[2],g_weaponsData[index].fullName.str(),params[3]); + return set_amxstring(amx,params[2],g_weaponsData[index].fullName.c_str(),params[3]); } static cell AMX_NATIVE_CALL get_user_weapons(AMX *amx, cell *params) /* 3 param */ @@ -554,7 +553,7 @@ static cell AMX_NATIVE_CALL get_user_ip(AMX *amx, cell *params) /* 3 param */ char *ptr; char szIp[32]; strcpy(szIp,(index<1||index>gpGlobals->maxClients)? - CVAR_GET_STRING("net_address"):g_players[index].ip.str()); + CVAR_GET_STRING("net_address"):g_players[index].ip.c_str()); if (params[4] && (ptr = strstr(szIp,":"))!=0) *ptr = '\0'; return set_amxstring(amx,params[2],szIp,params[3]); @@ -701,7 +700,7 @@ static cell AMX_NATIVE_CALL get_user_team(AMX *amx, cell *params) /* 3 param */ } // if ( params[3] ) - set_amxstring(amx,params[2],pPlayer->team.str(),params[3]); + set_amxstring(amx,params[2],pPlayer->team.c_str(),params[3]); return pPlayer->teamId; } @@ -1248,7 +1247,7 @@ static cell AMX_NATIVE_CALL log_to_file(AMX *amx, cell *params) /* 1 param */ int ilen; char* szFile = get_amxstring(amx,params[1],0,ilen); FILE*fp; - const char* filename = build_pathname("%s/%s",g_log_dir.str(),szFile); + const char* filename = build_pathname("%s/%s",g_log_dir.c_str(),szFile); bool first_time = true; if ((fp=fopen(filename,"r"))!=NULL){ first_time = false; @@ -1270,11 +1269,11 @@ static cell AMX_NATIVE_CALL log_to_file(AMX *amx, cell *params) /* 1 param */ if ( first_time ){ char game_dir[512]; GET_GAME_DIR(game_dir); - filename = build_pathname("%s/%s",g_log_dir.str(),szFile); + filename = build_pathname("%s/%s",g_log_dir.c_str(),szFile); fprintf(fp,"L %s: Log file started (file \"%s\") (game \"%s\") (amx \"%s\")\n", - date,filename,g_mod_name.str(),Plugin_info.version); + date,filename,g_mod_name.c_str(),Plugin_info.version); print_srvconsole("L %s: Log file started (file \"%s\") (game \"%s\") (amx \"%s\")\n", - date,filename,g_mod_name.str(),Plugin_info.version); + date,filename,g_mod_name.c_str(),Plugin_info.version); } fprintf(fp,"L %s: %s",date,message); print_srvconsole("L %s: %s",date,message); @@ -1442,18 +1441,18 @@ static cell AMX_NATIVE_CALL get_players(AMX *amx, cell *params) /* 4 param */ continue; /*if ( flags & 16 ) { if (flags & 64){ - if (strcmpi(pPlayer->team.str(),sptemp)) + if (strcmpi(pPlayer->team.c_str(),sptemp)) continue; } - else if (strcmp(pPlayer->team.str(),sptemp)) + else if (strcmp(pPlayer->team.c_str(),sptemp)) continue; }*/ if (flags & 32){ if (flags & 64){ - if (stristr(pPlayer->name.str(),sptemp)==NULL) + if (stristr(pPlayer->name.c_str(),sptemp)==NULL) continue; } - else if (strstr(pPlayer->name.str(),sptemp)==NULL) + else if (strstr(pPlayer->name.c_str(),sptemp)==NULL) continue; } aPlayers[iNum++] = i; @@ -1484,18 +1483,18 @@ static cell AMX_NATIVE_CALL find_player(AMX *amx, cell *params) /* 1 param */ continue; if (flags&1){ if (flags&2048) { - if (strcmpi(pPlayer->name.str(),sptemp)) + if (strcmpi(pPlayer->name.c_str(),sptemp)) continue; } - else if (strcmp(pPlayer->name.str(),sptemp)) + else if (strcmp(pPlayer->name.c_str(),sptemp)) continue; } if (flags&2){ if (flags&2048) { - if (stristr(pPlayer->name.str(),sptemp)==NULL) + if (stristr(pPlayer->name.c_str(),sptemp)==NULL) continue; } - else if (strstr(pPlayer->name.str(),sptemp)==NULL) + else if (strstr(pPlayer->name.c_str(),sptemp)==NULL) continue; } if (flags&4){ @@ -1508,15 +1507,15 @@ static cell AMX_NATIVE_CALL find_player(AMX *amx, cell *params) /* 1 param */ continue; } if (flags&8){ - if (strncmp(pPlayer->ip.str(),sptemp,ilen)) + if (strncmp(pPlayer->ip.c_str(),sptemp,ilen)) continue; } if (flags&16){ if (flags&2048) { - if (strcmpi(pPlayer->team.str(),sptemp)) + if (strcmpi(pPlayer->team.c_str(),sptemp)) continue; } - else if (strcmp(pPlayer->team.str(),sptemp)) + else if (strcmp(pPlayer->team.c_str(),sptemp)) continue; } result = i; @@ -1546,7 +1545,7 @@ static cell AMX_NATIVE_CALL get_mapname(AMX *amx, cell *params) /* 2 param */ static cell AMX_NATIVE_CALL get_modname(AMX *amx, cell *params) /* 2 param */ { - return set_amxstring(amx,params[1],g_mod_name.str(),params[2]); + return set_amxstring(amx,params[1],g_mod_name.c_str(),params[2]); } diff --git a/amxmodx/amxmodx.h b/amxmodx/amxmodx.h index 9c4eee16..9304270d 100755 --- a/amxmodx/amxmodx.h +++ b/amxmodx/amxmodx.h @@ -115,7 +115,7 @@ void UTIL_ShowMenu( edict_t* pEntity, int slots, int time, char *menu, int mlen #define GET_PLAYER_POINTER_I(i) (&g_players[i]) struct WeaponsVault { - String fullName; + CString fullName; short int iId; short int ammoSlot; }; @@ -145,8 +145,8 @@ extern Grenades g_grenades; extern LogEventsMngr g_logevents; extern MenuMngr g_menucmds; extern CLangMngr g_langMngr; -extern String g_log_dir; -extern String g_mod_name; +extern CString g_log_dir; +extern CString g_mod_name; extern TeamIds g_teamsIds; extern Vault g_vault; extern CForwardMngr g_forwards; diff --git a/amxmodx/amxxlog.cpp b/amxmodx/amxxlog.cpp index d968c2f8..1d35f230 100755 --- a/amxmodx/amxxlog.cpp +++ b/amxmodx/amxxlog.cpp @@ -56,11 +56,11 @@ void CLog::CloseFile() // log "log file closed" to old file, if any if (!m_LogFile.empty()) { - FILE *fp = fopen(m_LogFile.str(), "r"); + FILE *fp = fopen(m_LogFile.c_str(), "r"); if (fp) { fclose(fp); - fopen(m_LogFile.str(), "a+"); + fopen(m_LogFile.c_str(), "a+"); // get time time_t td; @@ -88,36 +88,36 @@ void CLog::CreateNewFile() int i = 0; while (true) { - m_LogFile.set(build_pathname("%s/L%02d%02d%03d.log", g_log_dir.str(), curTime->tm_mon + 1, curTime->tm_mday, i)); - FILE *pTmpFile = fopen(m_LogFile.str(), "r"); // open for reading to check whether the file exists + m_LogFile.assign(build_pathname("%s/L%02d%02d%03d.log", g_log_dir.c_str(), curTime->tm_mon + 1, curTime->tm_mday, i)); + FILE *pTmpFile = fopen(m_LogFile.c_str(), "r"); // open for reading to check whether the file exists if (!pTmpFile) break; fclose(pTmpFile); ++i; } // Log logfile start - FILE *fp = fopen(m_LogFile.str(), "w"); + FILE *fp = fopen(m_LogFile.c_str(), "w"); if (!fp) { ALERT(at_logged, "[AMXX] Unexpected fatal logging error. AMXX Logging disabled.\n"); SET_LOCALINFO("amxx_logging", "0"); } - fprintf(fp, "AMX Mod X log file started (file \"%s/L%02d%02d%03d.log\") (version \"%s\")\n", g_log_dir.str(), curTime->tm_mon + 1, curTime->tm_mday, i, AMX_VERSION); + fprintf(fp, "AMX Mod X log file started (file \"%s/L%02d%02d%03d.log\") (version \"%s\")\n", g_log_dir.c_str(), curTime->tm_mon + 1, curTime->tm_mday, i, AMX_VERSION); fclose(fp); } -void CLog::UseFile(const String &fileName) +void CLog::UseFile(const CString &fileName) { - m_LogFile.set(build_pathname("%s/%s", g_log_dir.str(), fileName.str())); + m_LogFile.assign(build_pathname("%s/%s", g_log_dir.c_str(), fileName.c_str())); } void CLog::MapChange() { // create dir if not existing #ifdef __linux - mkdir(build_pathname("%s", g_log_dir.str()), 0700); + mkdir(build_pathname("%s", g_log_dir.c_str()), 0700); #else - mkdir(build_pathname("%s", g_log_dir.str())); + mkdir(build_pathname("%s", g_log_dir.c_str())); #endif m_LogType = atoi(get_localinfo("amxx_logging", "1")); @@ -164,14 +164,14 @@ void CLog::Log(const char *fmt, ...) FILE *pF; if (m_LogType == 2) { - pF = fopen(m_LogFile.str(), "a+"); + pF = fopen(m_LogFile.c_str(), "a+"); if (!pF) { CreateNewFile(); - pF = fopen(m_LogFile.str(), "a+"); + pF = fopen(m_LogFile.c_str(), "a+"); if (!pF) { - ALERT(at_logged, "[AMXX] Unexpected fatal logging error (couldn't open %s for a+). AMXX Logging disabled for this map.\n", m_LogFile.str()); + ALERT(at_logged, "[AMXX] Unexpected fatal logging error (couldn't open %s for a+). AMXX Logging disabled for this map.\n", m_LogFile.c_str()); m_LogType = 0; return; } @@ -179,7 +179,7 @@ void CLog::Log(const char *fmt, ...) } else { - pF = fopen(build_pathname("%s/L%02d%02d.log", g_log_dir.str(), curTime->tm_mon + 1, curTime->tm_mday), "a+"); + pF = fopen(build_pathname("%s/L%02d%02d.log", g_log_dir.c_str(), curTime->tm_mon + 1, curTime->tm_mday), "a+"); } fprintf(pF, "L %s: %s\n", date, msg); diff --git a/amxmodx/amxxlog.h b/amxmodx/amxxlog.h index 53a037cf..ac2a88e8 100755 --- a/amxmodx/amxxlog.h +++ b/amxmodx/amxxlog.h @@ -34,11 +34,11 @@ class CLog { private: - String m_LogFile; + CString m_LogFile; int m_LogType; - void GetLastFile(int &outMonth, int &outDay, String &outFilename); - void UseFile(const String &fileName); + void GetLastFile(int &outMonth, int &outDay, CString &outFilename); + void UseFile(const CString &fileName); public: CLog(); ~CLog(); diff --git a/amxmodx/emsg.cpp b/amxmodx/emsg.cpp index d3746e17..ec8223d4 100755 --- a/amxmodx/emsg.cpp +++ b/amxmodx/emsg.cpp @@ -90,7 +90,7 @@ void Client_TeamInfo(void* mValue) case 1: if ( index < 1 || index > gpGlobals->maxClients ) break; char* msg = (char*)mValue; - g_players[ index ].team.set( msg ); + g_players[ index ].team.assign( msg ); g_teamsIds.registerTeam( msg , -1 ); } } @@ -169,7 +169,7 @@ void Client_WeaponList(void* mValue) wpnList |= (1<deaths = deaths; pPlayer->teamId = *(int*)mValue; if ( g_teamsIds.isNewTeam() ) - g_teamsIds.registerTeam( pPlayer->team.str() , pPlayer->teamId ); + g_teamsIds.registerTeam( pPlayer->team.c_str() , pPlayer->teamId ); } } @@ -257,7 +257,7 @@ void Client_DamageEnd(void* mValue) g_events.parseValue( dead->death_killer ); g_events.parseValue( dead->index ); g_events.parseValue( dead->death_headshot ); - g_events.parseValue( dead->death_weapon.str() ); + g_events.parseValue( dead->death_weapon.c_str() ); g_events.parseValue( dead->death_tk ? 1 : 0 ); g_events.executeEvents(); dead->death_killer = 0; @@ -291,7 +291,7 @@ void Client_DeathMsg(void* mValue) if ( !killer || !victim ) break; victim->death_killer = killer_id; - victim->death_weapon.set((char*)mValue); + victim->death_weapon.assign((char*)mValue); victim->death_headshot = hs; victim->death_tk = (killer->teamId == victim->teamId); } diff --git a/amxmodx/fakemeta.cpp b/amxmodx/fakemeta.cpp index b0ba0757..0d953164 100755 --- a/amxmodx/fakemeta.cpp +++ b/amxmodx/fakemeta.cpp @@ -2319,7 +2319,7 @@ enginefuncs_t g_EngineFunctionTable_Post = // ***** CFakeMetaPlugin CFakeMeta::CFakeMetaPlugin::CFakeMetaPlugin(const char *path) { - m_Path.set(path); + m_Path.assign(path); m_Status = PL_EMPTY; m_Info = NULL; memset((void *)&m_DllFuncTable, 0, sizeof(DLL_FUNCTIONS)); @@ -2345,7 +2345,7 @@ int CFakeMeta::CFakeMetaPlugin::Query(mutil_funcs_t *pMetaUtilFuncs) { // Load the library // We don't have to DLCLOSE here. - m_Handle = DLOPEN(build_pathname("%s", m_Path.str())); + m_Handle = DLOPEN(build_pathname("%s", m_Path.c_str())); if (!m_Handle) { m_Status = PL_BADFILE; @@ -2360,25 +2360,25 @@ int CFakeMeta::CFakeMetaPlugin::Query(mutil_funcs_t *pMetaUtilFuncs) bool missingFunc = false; if (!queryFn) { - AMXXLOG_Log("[AMXX] Module \"%s\" doesn't provide a Query function.", m_Path.str()); + AMXXLOG_Log("[AMXX] Module \"%s\" doesn't provide a Query function.", m_Path.c_str()); missingFunc = true; } if (!giveEngFuncsFn) { - AMXXLOG_Log("[AMXX] Module \"%s\" doesn't provide a GiveFnptrsToDll function.", m_Path.str()); + AMXXLOG_Log("[AMXX] Module \"%s\" doesn't provide a GiveFnptrsToDll function.", m_Path.c_str()); missingFunc = true; } // Also check for Attach and Detach if (DLSYM(m_Handle, "Meta_Attach") == NULL) { - AMXXLOG_Log("[AMXX] Module \"%s\" doesn't provide a Meta_Attach function.", m_Path.str()); + AMXXLOG_Log("[AMXX] Module \"%s\" doesn't provide a Meta_Attach function.", m_Path.c_str()); missingFunc = true; } if (DLSYM(m_Handle, "Meta_Detach") == NULL) { - AMXXLOG_Log("[AMXX] Module \"%s\" doesn't provide a Meta_Detach function.", m_Path.str()); + AMXXLOG_Log("[AMXX] Module \"%s\" doesn't provide a Meta_Detach function.", m_Path.c_str()); missingFunc = true; } @@ -2391,7 +2391,7 @@ int CFakeMeta::CFakeMetaPlugin::Query(mutil_funcs_t *pMetaUtilFuncs) if (queryFn(META_INTERFACE_VERSION, &m_Info, pMetaUtilFuncs) != 1) { - AMXXLOG_Log("[AMXX] Query Module \"%s\" failed.", m_Path.str()); + AMXXLOG_Log("[AMXX] Query Module \"%s\" failed.", m_Path.c_str()); m_Status = PL_BADFILE; return 0; } @@ -2413,7 +2413,7 @@ int CFakeMeta::CFakeMetaPlugin::Attach(PLUG_LOADTIME now, meta_globals_t *pMGlob } if (attachFn(now, &m_MetaFuncTable, pMGlobals, pGameDllFuncs) != 1) { - AMXXLOG_Log("[AMXX] Can't Attach Module \"%s\" (\"%s\").", m_Info->name, m_Path.str()); + AMXXLOG_Log("[AMXX] Can't Attach Module \"%s\" (\"%s\").", m_Info->name, m_Path.c_str()); m_Status = PL_FAILED; return 0; } @@ -2435,7 +2435,7 @@ int CFakeMeta::CFakeMetaPlugin::Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reaso } if (detachFn(now, reason) != 1) { - AMXXLOG_Log("[AMXX] Can't Detach Module \"%s\" (\"%s\").", m_Info->name, m_Path.str()); + AMXXLOG_Log("[AMXX] Can't Detach Module \"%s\" (\"%s\").", m_Info->name, m_Path.c_str()); m_Status = PL_FAILED; return 0; } @@ -2452,7 +2452,7 @@ int CFakeMeta::CFakeMetaPlugin::Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reaso { \ if (!m_MetaFuncTable.pfn##getFunc(&table, &ifVers)) \ { \ - AMXXLOG_Log("[AMXX] Failed calling \"%s\" in module \"%s\" (\"%s\")", #getFunc, m_Info->name, m_Path.str()); \ + AMXXLOG_Log("[AMXX] Failed calling \"%s\" in module \"%s\" (\"%s\")", #getFunc, m_Info->name, m_Path.c_str()); \ return 0; \ } \ } \ diff --git a/amxmodx/fakemeta.h b/amxmodx/fakemeta.h index dc2d33ec..29544735 100755 --- a/amxmodx/fakemeta.h +++ b/amxmodx/fakemeta.h @@ -74,7 +74,7 @@ public: { private: // plugin info - String m_Path; + CString m_Path; PLUG_STATUS m_Status; plugin_info_t *m_Info; // Function tables @@ -104,8 +104,8 @@ public: inline void SetInfo(plugin_info_t *newInfo) { m_Info = newInfo; } - inline const char * GetPath() const - { return m_Path.str(); } + inline const char * GetPath() + { return m_Path.c_str(); } inline const META_FUNCTIONS &GetMetaFunctions() const { return m_MetaFuncTable; } diff --git a/amxmodx/meta_api.cpp b/amxmodx/meta_api.cpp index 8b6d563c..ce589238 100755 --- a/amxmodx/meta_api.cpp +++ b/amxmodx/meta_api.cpp @@ -73,8 +73,8 @@ Grenades g_grenades; LogEventsMngr g_logevents; MenuMngr g_menucmds; CLangMngr g_langMngr; -String g_log_dir; -String g_mod_name; +CString g_log_dir; +CString g_mod_name; XVars g_xvars; bool g_bmod_cstrike; bool g_bmod_dod; @@ -91,7 +91,7 @@ float g_auth_time; #ifdef MEMORY_TEST float g_next_memreport_time; unsigned int g_memreport_count; -String g_memreport_dir; +CString g_memreport_dir; bool g_memreport_enabled; #define MEMREPORT_INTERVAL 300.0f /* 5 mins */ #endif // MEMORY_TEST @@ -480,10 +480,10 @@ void C_ServerDeactivate_Post() { char buffer[256]; sprintf(buffer, "%s/memreports/D%02d%02d%03d", get_localinfo("amxx_basedir", "addons/amxx"), curTime->tm_mon + 1, curTime->tm_mday, i); #ifdef __linux__ - mkdir(build_pathname("%s", g_log_dir.str()), 0700); + mkdir(build_pathname("%s", g_log_dir.c_str()), 0700); if (mkdir(build_pathname(buffer), 0700) < 0) #else - mkdir(build_pathname("%s", g_log_dir.str())); + mkdir(build_pathname("%s", g_log_dir.c_str())); if (mkdir(build_pathname(buffer)) < 0) #endif { @@ -501,13 +501,13 @@ void C_ServerDeactivate_Post() { break; } } - g_memreport_dir.set(buffer); + g_memreport_dir.assign(buffer); // g_memreport_dir should be valid now break; } } - m_dumpMemoryReport(build_pathname("%s/r%03d", g_memreport_dir.str(), g_memreport_count)); - AMXXLOG_Log("Memreport #%d created (file \"%s/r%03d\") (interval %f)", g_memreport_count + 1, g_memreport_dir.str(), g_memreport_count, MEMREPORT_INTERVAL); + m_dumpMemoryReport(build_pathname("%s/r%03d", g_memreport_dir.c_str(), g_memreport_count)); + AMXXLOG_Log("Memreport #%d created (file \"%s/r%03d\") (interval %f)", g_memreport_count + 1, g_memreport_dir.c_str(), g_memreport_count, MEMREPORT_INTERVAL); g_memreport_count++; } #endif // MEMORY_TEST @@ -569,7 +569,7 @@ void C_ClientUserInfoChanged_Post( edict_t *pEntity, char *infobuffer ) { // Emulate bot connection and putinserver if ( pPlayer->ingame ) { - pPlayer->name.set(name); // Make sure player have name up to date + pPlayer->name.assign(name); // Make sure player have name up to date } else if ( pPlayer->IsBot() ) { @@ -745,10 +745,10 @@ void C_StartFrame_Post( void ) { char buffer[256]; sprintf(buffer, "%s/memreports/D%02d%02d%03d", get_localinfo("amxx_basedir", "addons/amxx"), curTime->tm_mon + 1, curTime->tm_mday, i); #ifdef __linux__ - mkdir(build_pathname("%s", g_log_dir.str()), 0700); + mkdir(build_pathname("%s", g_log_dir.c_str()), 0700); if (mkdir(build_pathname(buffer), 0700) < 0) #else - mkdir(build_pathname("%s", g_log_dir.str())); + mkdir(build_pathname("%s", g_log_dir.c_str())); if (mkdir(build_pathname(buffer)) < 0) #endif { @@ -766,13 +766,13 @@ void C_StartFrame_Post( void ) { break; } } - g_memreport_dir.set(buffer); + g_memreport_dir.assign(buffer); // g_memreport_dir should be valid now break; } } - m_dumpMemoryReport(build_pathname("%s/r%03d", g_memreport_dir.str(), g_memreport_count)); - AMXXLOG_Log("Memreport #%d created (file \"%s/r%03d\") (interval %f)", g_memreport_count + 1, g_memreport_dir.str(), g_memreport_count, MEMREPORT_INTERVAL); + m_dumpMemoryReport(build_pathname("%s/r%03d", g_memreport_dir.c_str(), g_memreport_count)); + AMXXLOG_Log("Memreport #%d created (file \"%s/r%03d\") (interval %f)", g_memreport_count + 1, g_memreport_dir.c_str(), g_memreport_count, MEMREPORT_INTERVAL); g_memreport_count++; } #endif // MEMORY_TEST @@ -1038,7 +1038,7 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m while ( gameDir[i] ) if (gameDir[i++] == '/') a = &gameDir[i]; - g_mod_name.set(a); + g_mod_name.assign(a); // ###### Print short GPL print_srvconsole( "\n AMX Mod X version %s Copyright (c) 2004 AMX Mod X Development Team \n" @@ -1053,14 +1053,14 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m if ( amx_config.loadVault() ){ Vault::iterator a = amx_config.begin(); while ( a != amx_config.end() ) { - SET_LOCALINFO( (char*)a.key().str() , (char*)a.value().str() ); + SET_LOCALINFO( (char*)a.key().c_str(), (char*)a.value().c_str() ); ++a; } amx_config.clear(); } // ###### Initialize logging here - g_log_dir.set(get_localinfo("amxx_logs", "addons/amxx/logs")); + g_log_dir.assign(get_localinfo("amxx_logs", "addons/amxx/logs")); // ###### Now attach metamod modules // This will also call modules Meta_Query and Meta_Attach functions @@ -1205,7 +1205,7 @@ C_DLLEXPORT int GetEntityAPI2_Post( DLL_FUNCTIONS *pFunctionTable, int *interfac enginefuncs_t meta_engfuncs; C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion ) { - if ( stricmp(g_mod_name.str(),"cstrike") == 0 || stricmp(g_mod_name.str(),"czero")==0 ) + if ( stricmp(g_mod_name.c_str(),"cstrike") == 0 || stricmp(g_mod_name.c_str(),"czero")==0 ) { meta_engfuncs.pfnSetModel = C_SetModel; g_bmod_cstrike = true; @@ -1213,7 +1213,7 @@ C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *inte else { g_bmod_cstrike = false; - g_bmod_dod = !stricmp(g_mod_name.str(),"dod"); + g_bmod_dod = !stricmp(g_mod_name.c_str(),"dod"); } diff --git a/amxmodx/modules.cpp b/amxmodx/modules.cpp index cbe6cd95..e3503607 100755 --- a/amxmodx/modules.cpp +++ b/amxmodx/modules.cpp @@ -263,7 +263,7 @@ const char* get_amxscriptname(AMX* amx) void get_modname(char* buffer ) { - strcpy( buffer , g_mod_name.str() ); + strcpy( buffer , g_mod_name.c_str() ); } char* build_pathname(char *fmt, ... ) @@ -279,7 +279,7 @@ char* build_pathname(char *fmt, ... ) #else "%s/", #endif - g_mod_name.str()); + g_mod_name.c_str()); va_list argptr; va_start (argptr, fmt); @@ -609,7 +609,7 @@ const char *MNF_GetModname(void) { // :TODO: Do we have to do this?? static char buffer[64]; - strcpy(buffer, g_mod_name.str()); + strcpy(buffer, g_mod_name.c_str()); return buffer; } @@ -713,13 +713,13 @@ const char * MNF_GetPlayerName(int id) { if (id < 1 || id > gpGlobals->maxClients) return NULL; - return GET_PLAYER_POINTER_I(id)->name.str(); + return GET_PLAYER_POINTER_I(id)->name.c_str(); } const char * MNF_GetPlayerIP(int id) { if (id < 1 || id > gpGlobals->maxClients) return NULL; - return GET_PLAYER_POINTER_I(id)->ip.str(); + return GET_PLAYER_POINTER_I(id)->ip.c_str(); } int MNF_IsPlayerInGame(int id) { diff --git a/amxmodx/msvc/amxmodx_mm 7.1.vcproj b/amxmodx/msvc/amxmodx_mm 7.1.vcproj index 6a807613..e32f7d72 100755 --- a/amxmodx/msvc/amxmodx_mm 7.1.vcproj +++ b/amxmodx/msvc/amxmodx_mm 7.1.vcproj @@ -637,9 +637,6 @@ - - @@ -741,6 +738,9 @@ + + diff --git a/amxmodx/msvc/amxmodx_mm.sln b/amxmodx/msvc/amxmodx_mm.sln index f69b7bfb..1b2eeb1e 100755 --- a/amxmodx/msvc/amxmodx_mm.sln +++ b/amxmodx/msvc/amxmodx_mm.sln @@ -1,18 +1,18 @@ -Microsoft Visual Studio Solution File, Format Version 7.00 +Microsoft Visual Studio Solution File, Format Version 8.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "amxmodx_mm", "amxmodx_mm.vcproj", "{CDD792EF-ABC5-4C61-803F-616E209C03D6}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection EndProject Global GlobalSection(SolutionConfiguration) = preSolution - ConfigName.0 = Debug - ConfigName.1 = JITDebug - ConfigName.2 = JITMemtestRelease - ConfigName.3 = JITRelease - ConfigName.4 = MaximalSpeed - ConfigName.5 = MemtestDebug - ConfigName.6 = MemtestRelease - ConfigName.7 = Release - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution + Debug = Debug + JITDebug = JITDebug + JITMemtestRelease = JITMemtestRelease + JITRelease = JITRelease + MaximalSpeed = MaximalSpeed + MemtestDebug = MemtestDebug + MemtestRelease = MemtestRelease + Release = Release EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution {CDD792EF-ABC5-4C61-803F-616E209C03D6}.Debug.ActiveCfg = Debug|Win32 diff --git a/amxmodx/msvc/amxmodx_mm.vcproj b/amxmodx/msvc/amxmodx_mm.vcproj index 4c24d5e0..61283c99 100755 --- a/amxmodx/msvc/amxmodx_mm.vcproj +++ b/amxmodx/msvc/amxmodx_mm.vcproj @@ -1,7 +1,7 @@ - + @@ -73,8 +73,14 @@ Culture="1033"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -577,21 +642,6 @@ - - - - - - - - - - @@ -675,6 +725,15 @@ + + + + + + @@ -717,15 +776,6 @@ - - - - - -