Removed bot member variable from CPlayer; instead, everything now calls the inline IsBot() function.

Hopefully that will fix the "bot bug"
This commit is contained in:
Pavol Marko 2004-12-22 13:01:55 +00:00
parent 21ceae3c9e
commit e986848faf
4 changed files with 8 additions and 12 deletions

View File

@ -39,7 +39,6 @@ void CPlayer::Init( edict_t* e , int i )
pEdict = e; pEdict = e;
initialized = false; initialized = false;
ingame = false; ingame = false;
bot = false;
authorized = false; authorized = false;
current = 0; current = 0;
@ -59,7 +58,6 @@ void CPlayer::Disconnect() {
ingame = false; ingame = false;
initialized = false; initialized = false;
authorized = false; authorized = false;
bot = 0;
} }
void CPlayer::PutInServer() { void CPlayer::PutInServer() {
@ -70,7 +68,6 @@ bool CPlayer::Connect(const char* connectname,const char* ipaddress) {
name.assign(connectname); name.assign(connectname);
ip.assign(ipaddress); ip.assign(ipaddress);
time = gpGlobals->time; time = gpGlobals->time;
bot = IsBot();
death_killer = 0; death_killer = 0;
memset(flags,0,sizeof(flags)); memset(flags,0,sizeof(flags));
memset(weapons,0,sizeof(weapons)); memset(weapons,0,sizeof(weapons));

View File

@ -74,7 +74,6 @@ public:
bool initialized; bool initialized;
bool ingame; bool ingame;
bool bot;
bool authorized; bool authorized;
float time; float time;

View File

@ -158,7 +158,7 @@ static cell AMX_NATIVE_CALL console_cmd(AMX *amx, cell *params) /* 2 param */
} }
else{ else{
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if ( !pPlayer->bot && pPlayer->initialized ) CLIENT_COMMAND(pPlayer->pEdict, cmd ); if ( !pPlayer->IsBot() && pPlayer->initialized ) CLIENT_COMMAND(pPlayer->pEdict, cmd );
} }
return len; return len;
@ -399,7 +399,7 @@ static cell AMX_NATIVE_CALL is_user_bot(AMX *amx, cell *params) /* 1 param */
int index = params[1]; int index = params[1];
if (index<1||index>gpGlobals->maxClients) if (index<1||index>gpGlobals->maxClients)
return 0; return 0;
return (GET_PLAYER_POINTER_I(index)->bot ? 1 : 0); return (GET_PLAYER_POINTER_I(index)->IsBot() ? 1 : 0);
} }
@ -1140,7 +1140,7 @@ static cell AMX_NATIVE_CALL client_cmd(AMX *amx, cell *params) /* 2 param */
if (params[1] == 0) { if (params[1] == 0) {
for(int i = 1; i <= gpGlobals->maxClients; ++i){ for(int i = 1; i <= gpGlobals->maxClients; ++i){
CPlayer* pPlayer = GET_PLAYER_POINTER_I(i); CPlayer* pPlayer = GET_PLAYER_POINTER_I(i);
if (!pPlayer->bot && pPlayer->initialized /*&& pPlayer->ingame*/ ) if (!pPlayer->IsBot() && pPlayer->initialized /*&& pPlayer->ingame*/ )
CLIENT_COMMAND(pPlayer->pEdict, cmd ); CLIENT_COMMAND(pPlayer->pEdict, cmd );
} }
} }
@ -1151,7 +1151,7 @@ static cell AMX_NATIVE_CALL client_cmd(AMX *amx, cell *params) /* 2 param */
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if ( !pPlayer->bot && pPlayer->initialized /*&& pPlayer->ingame*/ ) if ( !pPlayer->IsBot() && pPlayer->initialized /*&& pPlayer->ingame*/ )
CLIENT_COMMAND(pPlayer->pEdict, cmd ); CLIENT_COMMAND(pPlayer->pEdict, cmd );
} }
return len; return len;
@ -1503,7 +1503,7 @@ static cell AMX_NATIVE_CALL get_players(AMX *amx, cell *params) /* 4 param */
if (pPlayer->ingame){ if (pPlayer->ingame){
if (pPlayer->IsAlive() ? (flags & 2) : (flags & 1)) if (pPlayer->IsAlive() ? (flags & 2) : (flags & 1))
continue; continue;
if (pPlayer->bot ? (flags & 4) : (flags & 8)) if (pPlayer->IsBot() ? (flags & 4) : (flags & 8))
continue; continue;
if ((flags & 16) && (pPlayer->teamId != team) ) if ((flags & 16) && (pPlayer->teamId != team) )
continue; continue;
@ -1547,7 +1547,7 @@ static cell AMX_NATIVE_CALL find_player(AMX *amx, cell *params) /* 1 param */
if (pPlayer->ingame){ if (pPlayer->ingame){
if (pPlayer->IsAlive()?(flags&64):(flags&32)) if (pPlayer->IsAlive()?(flags&64):(flags&32))
continue; continue;
if (pPlayer->bot?(flags&128):(flags&256)) if (pPlayer->IsBot()?(flags&128):(flags&256))
continue; continue;
if (flags&1){ if (flags&1){
if (flags&2048) { if (flags&2048) {

View File

@ -524,7 +524,7 @@ void C_ServerDeactivate_Post() {
BOOL C_ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ){ BOOL C_ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ){
CPlayer* pPlayer = GET_PLAYER_POINTER(pEntity); CPlayer* pPlayer = GET_PLAYER_POINTER(pEntity);
if (!pPlayer->bot) { if (!pPlayer->IsBot()) {
bool a = pPlayer->Connect(pszName,pszAddress); bool a = pPlayer->Connect(pszName,pszAddress);
@ -556,7 +556,7 @@ void C_ClientDisconnect( edict_t *pEntity ) {
void C_ClientPutInServer_Post( edict_t *pEntity ) { void C_ClientPutInServer_Post( edict_t *pEntity ) {
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
if (!pPlayer->bot) { if (!pPlayer->IsBot()) {
pPlayer->PutInServer(); pPlayer->PutInServer();
++g_players_num; ++g_players_num;