mirror of
https://github.com/unknownworlds/NS.git
synced 2025-02-16 08:51:09 +00:00
Ported performance changes from SVN revision 224, 229, 231 and 233, 3.0.5 performance branch.
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@242 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
parent
c2ae858b37
commit
58ec211b68
3 changed files with 27 additions and 15 deletions
|
@ -292,6 +292,7 @@ void SetGameRules(AvHGamerules* inGameRules)
|
|||
g_pGameRules = inGameRules;
|
||||
}
|
||||
|
||||
static float gSvCheatsLastUpdateTime;
|
||||
AvHGamerules::AvHGamerules() : mTeamA(TEAM_ONE), mTeamB(TEAM_TWO)
|
||||
{
|
||||
this->mGameStarted = false;
|
||||
|
@ -299,7 +300,7 @@ AvHGamerules::AvHGamerules() : mTeamA(TEAM_ONE), mTeamB(TEAM_TWO)
|
|||
|
||||
this->mTeamA.SetTeamType(AVH_CLASS_TYPE_MARINE);
|
||||
this->mTeamB.SetTeamType(AVH_CLASS_TYPE_ALIEN);
|
||||
|
||||
gSvCheatsLastUpdateTime = -1.0f;
|
||||
this->mVictoryTime = -1;
|
||||
this->mMapMode = MAP_MODE_UNDEFINED;
|
||||
this->mLastParticleUpdate = -1;
|
||||
|
@ -1039,7 +1040,12 @@ const AvHBaseInfoLocationListType& AvHGamerules::GetInfoLocations() const
|
|||
|
||||
bool AvHGamerules::GetCheatsEnabled(void) const
|
||||
{
|
||||
float theCheatsEnabled = CVAR_GET_FLOAT( "sv_cheats" );
|
||||
static float theCheatsEnabled = CVAR_GET_FLOAT( "sv_cheats" );
|
||||
if (gpGlobals->time > (gSvCheatsLastUpdateTime + 0.5f))
|
||||
{
|
||||
theCheatsEnabled = CVAR_GET_FLOAT( "sv_cheats" );
|
||||
gSvCheatsLastUpdateTime = gpGlobals->time;
|
||||
}
|
||||
return (theCheatsEnabled == 1.0f);
|
||||
}
|
||||
|
||||
|
@ -2319,6 +2325,7 @@ void AvHGamerules::ResetGame(bool inPreserveTeams)
|
|||
// Reset game rules
|
||||
this->mFirstUpdate = true;
|
||||
this->mPreserveTeams = inPreserveTeams;
|
||||
gSvCheatsLastUpdateTime = -1.0f;
|
||||
}
|
||||
|
||||
void AvHGamerules::RecalculateMapMode( void )
|
||||
|
@ -2531,7 +2538,7 @@ void AvHGamerules::InternalResetGameRules()
|
|||
this->mSentCountdownMessage = false;
|
||||
this->mTimeWorldReset = gpGlobals->time;
|
||||
this->mCombatAttackingTeamNumber = TEAM_IND;
|
||||
|
||||
gSvCheatsLastUpdateTime = -1.0f;
|
||||
if(this->mLastMapChange == -1)
|
||||
{
|
||||
this->mLastMapChange = gpGlobals->time;
|
||||
|
|
|
@ -3261,7 +3261,7 @@ void AvHPlayer::Init()
|
|||
AvHGamerules* theGameRules = GetGameRules();
|
||||
|
||||
mServerVariableList.clear();
|
||||
|
||||
mLastUpdateTime = -1;
|
||||
for (i = 0; i < theGameRules->GetNumServerVariables(); ++i)
|
||||
{
|
||||
mServerVariableList.push_back(ServerVariable());
|
||||
|
@ -6534,17 +6534,21 @@ void AvHPlayer::InternalCommonThink()
|
|||
|
||||
void AvHPlayer::PropagateServerVariables()
|
||||
{
|
||||
for (int i = 0; i < (signed)mServerVariableList.size(); ++i)
|
||||
{
|
||||
std::string theValue = CVAR_GET_STRING( mServerVariableList[i].mName.c_str() );
|
||||
|
||||
if ( mServerVariableList[i].mLastValueSent != theValue)
|
||||
{
|
||||
NetMsg_ServerVar( this->pev, mServerVariableList[i].mName, theValue );
|
||||
mServerVariableList[i].mLastValueSent = theValue;
|
||||
break; // Only send one message per tick to avoid overflow.
|
||||
}
|
||||
}
|
||||
if ( gpGlobals->time > (mLastUpdateTime + 0.5f) )
|
||||
{
|
||||
for (int i = 0; i < (signed)mServerVariableList.size(); ++i)
|
||||
{
|
||||
std::string theValue = CVAR_GET_STRING( mServerVariableList[i].mName.c_str() );
|
||||
|
||||
if ( mServerVariableList[i].mLastValueSent != theValue)
|
||||
{
|
||||
NetMsg_ServerVar( this->pev, mServerVariableList[i].mName, theValue );
|
||||
mServerVariableList[i].mLastValueSent = theValue;
|
||||
break; // Only send one message per tick to avoid overflow.
|
||||
}
|
||||
}
|
||||
mLastUpdateTime = gpGlobals->time;
|
||||
}
|
||||
}
|
||||
|
||||
void AvHPlayer::InternalMarineThink()
|
||||
|
|
|
@ -817,6 +817,7 @@ private:
|
|||
|
||||
int mScore;
|
||||
int mSavedCombatFrags;
|
||||
float mLastUpdateTime;
|
||||
|
||||
string mNetworkAddress;
|
||||
int mLastModelIndex;
|
||||
|
|
Loading…
Reference in a new issue