mirror of
https://github.com/unknownworlds/NS.git
synced 2024-11-23 04:52:16 +00:00
o Fixed bug with the throttling of cvar checks.
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@233 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
parent
577727d9a5
commit
f593a651e8
3 changed files with 12 additions and 8 deletions
Binary file not shown.
|
@ -334,6 +334,8 @@ void SetGameRules(AvHGamerules* inGameRules)
|
|||
g_pGameRules = inGameRules;
|
||||
}
|
||||
|
||||
// puzl: performance. We need to throttle the rate at which we read the cvar "sv_cheats" as it is read very frequently
|
||||
static float gSvCheatsLastUpdateTime;
|
||||
AvHGamerules::AvHGamerules() : mTeamOne(TEAM_ONE), mTeamTwo(TEAM_TWO)
|
||||
{
|
||||
this->mGameStarted = false;
|
||||
|
@ -341,7 +343,7 @@ AvHGamerules::AvHGamerules() : mTeamOne(TEAM_ONE), mTeamTwo(TEAM_TWO)
|
|||
|
||||
this->mTeamOne.SetTeamType(AVH_CLASS_TYPE_MARINE);
|
||||
this->mTeamTwo.SetTeamType(AVH_CLASS_TYPE_ALIEN);
|
||||
|
||||
gSvCheatsLastUpdateTime=-1.0f;
|
||||
this->mVictoryTime = -1;
|
||||
this->mMapMode = MAP_MODE_UNDEFINED;
|
||||
this->mLastParticleUpdate = -1;
|
||||
|
@ -1373,13 +1375,14 @@ const AvHBaseInfoLocationListType& AvHGamerules::GetInfoLocations() const
|
|||
return mInfoLocations;
|
||||
}
|
||||
|
||||
|
||||
bool AvHGamerules::GetCheatsEnabled(void) const
|
||||
{
|
||||
static float theCheatsEnabled = CVAR_GET_FLOAT( "sv_cheats" );
|
||||
static float theLastUpdateTime = gpGlobals->time;
|
||||
if ( gpGlobals->time > (theLastUpdateTime + 0.5f ) ) {
|
||||
ALERT(at_console, UTIL_VarArgs("GetCheatsEnabled %f > %f\n", gpGlobals->time, (gSvCheatsLastUpdateTime + 0.5f )) );
|
||||
if ( gpGlobals->time > (gSvCheatsLastUpdateTime + 0.5f ) ) {
|
||||
theCheatsEnabled = CVAR_GET_FLOAT( "sv_cheats" );
|
||||
theLastUpdateTime = gpGlobals->time;
|
||||
gSvCheatsLastUpdateTime = gpGlobals->time;
|
||||
}
|
||||
return (theCheatsEnabled == 1.0f);
|
||||
}
|
||||
|
@ -2810,7 +2813,7 @@ void AvHGamerules::ResetGame(bool inPreserveTeams)
|
|||
// Reset game rules
|
||||
this->mFirstUpdate = true;
|
||||
this->mPreserveTeams = inPreserveTeams;
|
||||
|
||||
gSvCheatsLastUpdateTime=-1.0f;
|
||||
// Reset all players
|
||||
// FOR_ALL_ENTITIES(kAvHPlayerClassName, AvHPlayer*)
|
||||
// theEntity->Reset();
|
||||
|
@ -3052,6 +3055,7 @@ void AvHGamerules::InternalResetGameRules()
|
|||
this->mVictoryTeam = TEAM_IND;
|
||||
this->mVictoryDraw = false;
|
||||
this->mVictoryTime = 0;
|
||||
gSvCheatsLastUpdateTime = -1.0f;
|
||||
this->mCheats.clear();
|
||||
this->mLastParticleUpdate = -1;
|
||||
this->mLastNetworkUpdate = -1;
|
||||
|
|
|
@ -6982,9 +6982,9 @@ void AvHPlayer::PropagateServerVariables()
|
|||
{
|
||||
mServerVariableList[i].mLastValueSent = theValue;
|
||||
|
||||
#ifdef AVH_SERVER
|
||||
ALERT(at_console, UTIL_VarArgs("Sent server var to %s: %s %s\n", this->mDesiredNetName, mServerVariableList[i].mName.c_str(), mServerVariableList[i].mLastValueSent.c_str()));
|
||||
#endif
|
||||
//#ifdef AVH_SERVER
|
||||
// ALERT(at_console, UTIL_VarArgs("Sent server var to %s: %s %s\n", this->mDesiredNetName, mServerVariableList[i].mName.c_str(), mServerVariableList[i].mLastValueSent.c_str()));
|
||||
//#endif
|
||||
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgServerVar, NULL, this->pev);
|
||||
|
||||
|
|
Loading…
Reference in a new issue