some changes in bot's code

This commit is contained in:
Lukasz Wlasinksi 2004-08-12 13:22:34 +00:00
parent 3155a300c6
commit 796a7ad4d7
9 changed files with 11 additions and 10 deletions

View File

@ -91,7 +91,6 @@ void CPlayer::PutInServer(){
} }
void CPlayer::Connect(const char* address ){ void CPlayer::Connect(const char* address ){
bot = IsBot();
strcpy(ip,address); strcpy(ip,address);
rank = 0; rank = 0;
clearStats = 0.0f; clearStats = 0.0f;

View File

@ -21,7 +21,6 @@ struct CPlayer {
int index; int index;
int aiming; int aiming;
int current; int current;
bool bot;
float clearStats; float clearStats;
RankSystem::RankStats* rank; RankSystem::RankStats* rank;

View File

@ -38,7 +38,7 @@
// ***************************************************** // *****************************************************
void CPlayer::Disconnect(){ void CPlayer::Disconnect(){
ingame = staminaSet = fuseSet = false; ingame = staminaSet = fuseSet = bot = false;
} }
void CPlayer::PutInServer(){ void CPlayer::PutInServer(){
@ -55,7 +55,7 @@ void CPlayer::Init( int pi, edict_t* pe )
pEdict = pe; pEdict = pe;
index = pi; index = pi;
current = 0; current = 0;
ingame = staminaSet = false; ingame = staminaSet = fuseSet = bot = false;
} }

View File

@ -90,6 +90,7 @@ void Grenades::clear()
void CPlayer::Disconnect(){ void CPlayer::Disconnect(){
ingame = false; ingame = false;
bot = false;
savedScore = 0; savedScore = 0;
if ( ignoreBots(pEdict) || !isModuleActive() ) // ignore if he is bot and bots rank is disabled or module is paused if ( ignoreBots(pEdict) || !isModuleActive() ) // ignore if he is bot and bots rank is disabled or module is paused
@ -150,6 +151,7 @@ void CPlayer::Init( int pi, edict_t* pe )
current = 0; current = 0;
clearStats = 0.0f; clearStats = 0.0f;
ingame = false; ingame = false;
bot = false;
savedScore = 0; savedScore = 0;
} }

View File

@ -93,6 +93,7 @@ void Grenades::clear()
void CPlayer::Disconnect(){ void CPlayer::Disconnect(){
ingame = false; ingame = false;
bot = false;
if ( ignoreBots(pEdict) || !isModuleActive() ) // ignore if he is bot and bots rank is disabled or module is paused if ( ignoreBots(pEdict) || !isModuleActive() ) // ignore if he is bot and bots rank is disabled or module is paused
return; return;
@ -145,6 +146,8 @@ void CPlayer::Init( int pi, edict_t* pe )
current = 0; current = 0;
clearStats = 0.0f; clearStats = 0.0f;
rank = 0; rank = 0;
ingame = false;
bot = false;
} }
void CPlayer::saveKill(CPlayer* pVictim, int wweapon, int hhs, int ttk){ void CPlayer::saveKill(CPlayer* pVictim, int wweapon, int hhs, int ttk){

View File

@ -75,7 +75,6 @@ void CPlayer::PutInServer(){
ingame = false; ingame = false;
} }
void CPlayer::Connect( const char* ippp ){ void CPlayer::Connect( const char* ippp ){
bot = IsBot();
strcpy(ip,ippp); strcpy(ip,ippp);
} }

View File

@ -90,7 +90,6 @@ struct CPlayer {
int frags; // suma dla kontroli ostatniego fraga, to - v.frags = lastfrag int frags; // suma dla kontroli ostatniego fraga, to - v.frags = lastfrag
bool ingame; bool ingame;
bool bot;
float clearStats; float clearStats;
struct PlayerWeapon : public Stats { struct PlayerWeapon : public Stats {
@ -117,6 +116,7 @@ struct CPlayer {
void saveHit(CPlayer* pVictim, int weapon, int damage, int aiming); void saveHit(CPlayer* pVictim, int weapon, int damage, int aiming);
void saveShot(int weapon); void saveShot(int weapon);
void restartStats(bool all = true); void restartStats(bool all = true);
inline bool IsBot(){ inline bool IsBot(){
const char* auth= (*g_engfuncs.pfnGetPlayerAuthId)(pEdict); const char* auth= (*g_engfuncs.pfnGetPlayerAuthId)(pEdict);
return ( auth && !strcmp( auth , "BOT" ) ); return ( auth && !strcmp( auth , "BOT" ) );

View File

@ -188,7 +188,7 @@ void ClientUserInfoChanged_Post( edict_t *pEntity, char *infobuffer ) {
const char* name = INFOKEY_VALUE(infobuffer,"name"); const char* name = INFOKEY_VALUE(infobuffer,"name");
const char* oldname = STRING(pEntity->v.netname); const char* oldname = STRING(pEntity->v.netname);
if ( pPlayer->ingame){ if ( pPlayer->ingame ){
if ( strcmp(oldname,name) ) { if ( strcmp(oldname,name) ) {
if (!tsstats_rank->value) if (!tsstats_rank->value)
pPlayer->rank = g_rank.findEntryInRank( name, name ); pPlayer->rank = g_rank.findEntryInRank( name, name );
@ -197,7 +197,6 @@ void ClientUserInfoChanged_Post( edict_t *pEntity, char *infobuffer ) {
} }
} }
else if ( pPlayer->IsBot() ) { else if ( pPlayer->IsBot() ) {
pPlayer->Connect( "127.0.0.1" );
pPlayer->PutInServer(); pPlayer->PutInServer();
} }