Rewrote CString

This commit is contained in:
David Anderson 2004-08-13 08:46:04 +00:00
parent 2a00a62bcb
commit 955fcb8549
32 changed files with 366 additions and 305 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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;
}

View File

@ -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( );

View File

@ -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;
}

View File

@ -63,7 +63,7 @@ public:
friend class LogEventsMngr;
friend class CLogEvent;
LogEventsMngr* parent;
String text;
CString text;
int logid;
int pos;
int result;

View File

@ -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;

View File

@ -40,7 +40,7 @@ class MenuMngr
{
struct MenuIdEle
{
String name;
CString name;
AMX* amx;
MenuIdEle* next;
int id;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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<AMX_NATIVE_INFO*> m_Natives;

View File

@ -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 );

View File

@ -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<<id)) ? true : false; }

View File

@ -1,70 +0,0 @@
/* 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.
*/
#include "string.h"
#include "amxmodx.h"
#include "CString.h"
#include "CFile.h"
String::String()
{
len = 0;
napis = 0;
}
String::String( const char* n )
{
napis = 0;
set(n);
}
String::~String()
{
clear();
}
void String::set( const char* n )
{
clear();
if ( n != 0 ){
len = strlen( n );
napis = new char[ len + 1 ];
if ( napis ) strcpy( napis , n );
else len = 0;
}
}
void String::clear() {
delete[] napis;
napis = 0;
len = 0;
}

View File

@ -29,30 +29,110 @@
* version.
*/
#ifndef STRING_CUSTOM_H
#define STRING_CUSTOM_H
#ifndef _INCLUDE_CSTRING_H
#define _INCLUDE_CSTRING_H
// *****************************************************
// class String
// *****************************************************
class String
//by David "BAILOPAN" Anderson
class CString
{
char* napis;
short int len;
public:
String();
String( const char* n );
~String();
void set( const char* n );
inline bool empty() const { return (len == 0); }
inline const char* str() const { return napis ? napis : "(null)"; }
inline short int size() const { return len; }
void clear();
CString() { v = NULL; mSize = 0; }
~CString() { if (v) delete [] v; }
//added these for amxx
CString(const char *src) { v = NULL; mSize = 0; assign(src); }
CString(CString &src) { v = NULL; mSize = 0; assign(src.c_str()); }
const char *c_str() { return v?v:""; }
const char *c_str() const { return v?v:""; }
void append(const char *t)
{
Grow(strlen(v) + strlen(t));
strcat(v, t);
}
void append(CString &d)
{
const char *t = d.c_str();
Grow(strlen(v) + strlen(t));
strcat(v, t);
}
void assign(const char *d)
{
if (!d)
{
Grow(1);
strcpy(v, "");
return;
}
Grow(strlen(d));
if (v)
strcpy(v, d);
}
void clear()
{
if (v)
delete [] v;
v = NULL;
mSize = 0;
}
int compare (const char *d)
{
if (v) {
if (d) {
return strcmp(v, d);
} else {
return strlen(v);
}
} else {
if (d) {
return strlen(d);
} else {
return 0;
}
}
}
//Added this for amxx inclusion
bool empty()
{
if (!v || !mSize)
return true;
return false;
}
int size()
{
if (!v)
return 0;
return strlen(v);
}
private:
void Grow(int d)
{
if (d<1)
return;
if (d > 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

View File

@ -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;

View File

@ -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); }

View File

@ -29,7 +29,6 @@
* version.
*/
#include <string>
#include <time.h>
#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]);
}

View File

@ -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;

View File

@ -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);

View File

@ -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();

View File

@ -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<<iId);
g_weaponsData[iId].iId = iId;
g_weaponsData[iId].ammoSlot = iSlot;
g_weaponsData[iId].fullName.set(wpnName);
g_weaponsData[iId].fullName.assign(wpnName);
}
}
@ -243,7 +243,7 @@ void Client_ScoreInfo(void* mValue)
pPlayer->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);
}

View File

@ -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; \
} \
} \

View File

@ -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; }

View File

@ -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");
}

View File

@ -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)
{

View File

@ -637,9 +637,6 @@
<File
RelativePath="..\CPlugin.cpp">
</File>
<File
RelativePath="..\CString.cpp">
</File>
<File
RelativePath="..\CTask.cpp">
</File>
@ -741,6 +738,9 @@
<File
RelativePath="..\amxxfile.h">
</File>
<File
RelativePath="..\amxxlog.h">
</File>
<File
RelativePath="..\CCmd.h">
</File>

View File

@ -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

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Version="7.10"
Name="amxmodx_mm"
SccProjectName=""
SccLocalPath="">
@ -73,8 +73,14 @@
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
@ -138,8 +144,14 @@
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="MemtestDebug|Win32"
@ -204,8 +216,14 @@
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="MemtestRelease|Win32"
@ -269,8 +287,14 @@
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="JITDebug|Win32"
@ -335,8 +359,14 @@
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="JITRelease|Win32"
@ -400,8 +430,14 @@
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="JITMemtestRelease|Win32"
@ -465,8 +501,14 @@
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="MaximalSpeed|Win32"
@ -533,14 +575,37 @@
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\amx.cpp">
</File>
<File
RelativePath="..\amxcore.cpp">
</File>
<File
RelativePath="..\amxmodx.cpp">
</File>
<File
RelativePath="..\amxtime.cpp">
</File>
<File
RelativePath="..\amxxlog.cpp">
</File>
<File
RelativePath="..\CCmd.cpp">
</File>
@ -577,21 +642,6 @@
<File
RelativePath="..\CVault.cpp">
</File>
<File
RelativePath="..\amx.cpp">
</File>
<File
RelativePath="..\amxcore.cpp">
</File>
<File
RelativePath="..\amxmodx.cpp">
</File>
<File
RelativePath="..\amxtime.cpp">
</File>
<File
RelativePath="..\amxxlog.cpp">
</File>
<File
RelativePath="..\emsg.cpp">
</File>
@ -675,6 +725,15 @@
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="..\amx.h">
</File>
<File
RelativePath="..\amxmodx.h">
</File>
<File
RelativePath="..\amxxfile.h">
</File>
<File
RelativePath="..\CCmd.h">
</File>
@ -717,15 +776,6 @@
<File
RelativePath="..\CVector.h">
</File>
<File
RelativePath="..\amx.h">
</File>
<File
RelativePath="..\amxmodx.h">
</File>
<File
RelativePath="..\amxxfile.h">
</File>
<File
RelativePath="..\fakemeta.h">
</File>