All pastes #3688 Raw Edit

AresTheImpaler

public cpp v1 · immutable
#3688 ·published 2005-01-03 04:21 UTC
rendered paste body
	bool Cache( KeyValues kv ) {		int i;		if ( nextCache >= PLAYERTRACKER_MAX_CACHE )			nextCache = 0;		for(i = nextCache; i < PLAYERTRACKER_MAX_CACHE; i++)			if(	kvCache[i] == NULL )                          {				kvCache[i++] = &kv;				nextCache = i;				return TRUE;			   }		if( nextCache != 0 )                 {			nextCache = i;			for( i = 0; i < nextCache; i++ )				if(	kvCache[i] == NULL ) {					kvCache[i++] = &kv;					nextCache = i;					return TRUE;				}		}#ifdef PLAYERTRACKER_WEAK_ASS_CACHE		return FALSE;#else		int drop; int dropval; int last;		i = 0;		do {			last = kvCache[i].GetInt("last");			if( last < dropval )                         {				dropval = last;				drop = i++;			}                         i++;		} while (i < PLAYERTRACKER_MAX_CACHE);		kvCache[drop].deleteThis();		kvCache[drop] = &kv;		return TRUE;#endif	}