An optional array parameter (LIKE TEH TASKS ONE) can be now passed to cvar query handlers

This commit is contained in:
Pavol Marko
2005-09-06 10:12:02 +00:00
parent 2f27b7da8d
commit 6bebf37f1a
4 changed files with 133 additions and 83 deletions

View File

@@ -48,7 +48,7 @@ void CPlayer::Init( edict_t* e , int i )
aiming = 0;
menu = 0;
keys = 0;
death_weapon.clear();
name.clear();
ip.clear();
@@ -56,43 +56,45 @@ void CPlayer::Init( edict_t* e , int i )
}
void CPlayer::Disconnect() {
ingame = false;
initialized = false;
authorized = false;
ingame = false;
initialized = false;
authorized = false;
while (!cvarQueryQueue.empty())
{
ClientCvarQuery_Info *pQuery = cvarQueryQueue.front();
unregisterSPForward(pQuery->resultFwd);
delete pQuery;
cvarQueryQueue.pop();
}
while (!cvarQueryQueue.empty())
{
ClientCvarQuery_Info *pQuery = cvarQueryQueue.front();
unregisterSPForward(pQuery->resultFwd);
if (pQuery->params)
delete [] pQuery->params;
delete pQuery;
cvarQueryQueue.pop();
}
bot = 0;
bot = 0;
}
void CPlayer::PutInServer() {
playtime = gpGlobals->time;
ingame = true;
playtime = gpGlobals->time;
ingame = true;
}
bool CPlayer::Connect(const char* connectname,const char* ipaddress) {
name.assign(connectname);
ip.assign(ipaddress);
time = gpGlobals->time;
bot = IsBot();
death_killer = 0;
memset(flags,0,sizeof(flags));
memset(weapons,0,sizeof(weapons));
initialized = true;
authorized = false;
name.assign(connectname);
ip.assign(ipaddress);
time = gpGlobals->time;
bot = IsBot();
death_killer = 0;
memset(flags,0,sizeof(flags));
memset(weapons,0,sizeof(weapons));
initialized = true;
authorized = false;
const char* authid = GETPLAYERAUTHID( pEdict );
const char* authid = GETPLAYERAUTHID( pEdict );
if ( (authid == 0) || (*authid == 0)
|| (strcmp( authid , "STEAM_ID_PENDING") == 0) )
return true;
if ( (authid == 0) || (*authid == 0)
|| (strcmp( authid , "STEAM_ID_PENDING") == 0) )
return true;
return false;
return false;
}
@@ -102,48 +104,48 @@ bool CPlayer::Connect(const char* connectname,const char* ipaddress) {
// *****************************************************
void Grenades::put( edict_t* grenade, float time, int type, CPlayer* player )
{
Obj* a = new Obj;
if ( a == 0 ) return;
a->player = player;
a->grenade = grenade;
a->time = gpGlobals->time + time;
a->type = type;
a->next = head;
head = a;
Obj* a = new Obj;
if ( a == 0 ) return;
a->player = player;
a->grenade = grenade;
a->time = gpGlobals->time + time;
a->type = type;
a->next = head;
head = a;
}
bool Grenades::find( edict_t* enemy, CPlayer** p, int& type )
{
bool found = false;
Obj** a = &head;
while ( *a ){
if ( (*a)->time > gpGlobals->time ) {
if ( (*a)->grenade == enemy ) {
found = true;
(*p) = (*a)->player;
type = (*a)->type;
}
}
else {
Obj* b = (*a)->next;
delete *a;
*a = b;
bool found = false;
Obj** a = &head;
while ( *a ){
if ( (*a)->time > gpGlobals->time ) {
if ( (*a)->grenade == enemy ) {
found = true;
(*p) = (*a)->player;
type = (*a)->type;
}
}
else {
Obj* b = (*a)->next;
delete *a;
*a = b;
continue;
continue;
}
a = &(*a)->next;
}
return found;
}
a = &(*a)->next;
}
return found;
}
void Grenades::clear()
{
while(head){
Obj* a = head->next;
delete head;
head = a;
}
while(head){
Obj* a = head->next;
delete head;
head = a;
}
}
// *****************************************************
@@ -158,17 +160,17 @@ void XVars::clear() {
int XVars::put( AMX* p, cell* v )
{
for(int a = 0; a < num; ++a) {
if ( (head[a].amx == p) && (head[a].value == v) )
return a;
}
for(int a = 0; a < num; ++a) {
if ( (head[a].amx == p) && (head[a].value == v) )
return a;
}
if ( (num >= size) && realloc_array( size ? (size * 2) : 8 ) )
return -1;
if ( (num >= size) && realloc_array( size ? (size * 2) : 8 ) )
return -1;
head[num].value = v;
head[num].amx = p;
return num++;
head[num].value = v;
head[num].amx = p;
return num++;
}
int XVars::realloc_array( int nsize )
@@ -190,17 +192,17 @@ int XVars::realloc_array( int nsize )
// *****************************************************
TeamIds::TeamIds() { head = 0; newTeam = 0; }
TeamIds::~TeamIds() {
while( head ) {
while( head ) {
TeamEle* a = head->next;
delete head;
head = a;
}
}
}
void TeamIds::registerTeam( const char* n ,int s )
{
TeamEle** a = &head;
while( *a ){
TeamEle** a = &head;
while( *a ){
if ( strcmp((*a)->name.c_str(),n) == 0 ){
if (s != -1){
(*a)->id = s;
@@ -209,31 +211,31 @@ void TeamIds::registerTeam( const char* n ,int s )
return;
}
a = &(*a)->next;
}
*a = new TeamEle( n , s );
}
*a = new TeamEle( n , s );
if ( *a == 0 ) return;
newTeam |= (1<<(*a)->tid);
newTeam |= (1<<(*a)->tid);
}
int TeamIds::findTeamId( const char* n )
{
TeamEle* a = head;
while( a ){
while( a ){
if ( !stricmp(a->name.c_str(),n) )
return a->id;
a = a->next;
}
}
return -1;
}
int TeamIds::findTeamIdCase( const char* n)
{
TeamEle* a = head;
while( a ){
while( a ){
if ( !strcmp(a->name.c_str(), n) )
return a->id;
a = a->next;
}
}
return -1;
}