Fixed incorrect message size for SetResearch

Removed outdated comment from player.cpp
Revised MsgFunc_CurAmmo to evaluate flags only if message had a valid weapon
Changed AvHPlayer.cpp permissions to allow switching teams before a round starts and disallow joining active teams that aren't used by the map.

git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@33 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
XP-Cagey 2005-04-05 00:30:35 +00:00
parent e6db2ee4e5
commit 2f71850ff0
4 changed files with 13 additions and 17 deletions

View file

@ -670,12 +670,9 @@ int CHudAmmo::MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf )
return 0;
}
bool bOnTarget = (iState & WEAPON_ON_TARGET) != 0; //used to track autoaim state
bool bIsCurrent = (iState & WEAPON_IS_CURRENT) != 0;
if ( g_iUser1 != OBS_IN_EYE )
{
if ( iId == -1 && iClip == -1 )
if ( iId == -1 && iClip == -1 ) //this conditional is never true due to iId < 1 check above!
{
gHUD.m_fPlayerDead = TRUE;
gpActiveSel = NULL;
@ -690,8 +687,10 @@ int CHudAmmo::MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf )
{ return 0; }
m_pWeapon = pWeapon;
m_pWeapon->iEnabled = (iState & WEAPON_IS_ENABLED) ? TRUE : FALSE;
m_pWeapon->iClip = iClip;
bool bOnTarget = (iState & WEAPON_ON_TARGET) != 0; //used to track autoaim state
bool bIsCurrent = (iState & WEAPON_IS_CURRENT) != 0;
m_pWeapon->iEnabled = (iState & WEAPON_IS_ENABLED) != 0 ? TRUE : FALSE;
m_pWeapon->iClip = abs(iClip);
if( !bIsCurrent )
{ return 1; }

View file

@ -812,10 +812,6 @@ void CBasePlayer::DestroyAllItems(BOOL removeSuit)
for ( i = 0; i < MAX_AMMO_SLOTS;i++)
m_rgAmmo[i] = 0;
// Removed because network messages were being sent before client was fully in the game (some messages weren't going through, like gmsgWeaponList).
// This gets called every tick by AvHPlayer::UpdateClientData() anyways.
//UpdateClientData();
// send Selected Weapon Message to our client
NetMsg_CurWeapon( pev, 0, 0, 0 );
}

View file

@ -77,7 +77,7 @@ void Net_InitializeMessages(void)
g_msgSetOrder = REG_USER_MSG( "SetOrder", -1 );
g_msgSetParticleTemplates = REG_USER_MSG( "Particles", -1 );
g_msgSetSelect = REG_USER_MSG( "SetSelect", -1 );
g_msgSetRequest = REG_USER_MSG( "SetRequest", 3 );
g_msgSetRequest = REG_USER_MSG( "SetRequest", 2 );
g_msgSetSoundNames = REG_USER_MSG( "SoundNames", -1 );
g_msgSetTechNodes = REG_USER_MSG( "SetTech", 9 );
g_msgSetTechSlots = REG_USER_MSG( "TechSlots", 1 + kNumTechSlots );

View file

@ -9719,11 +9719,12 @@ bool AvHPlayer::GetIsAuthorized(AvHAuthAction inAction, int inParameter) const
case TEAM_SPECT:
return true;
default:
// check it's an active team - game theTeam if haven't seen other team information
if( theTeam >= TEAM_ACTIVE_BEGIN && inParameter < TEAM_ACTIVE_END )
// check it's an active team
if( theTeam == GetGameRules()->GetTeamA()->GetTeamNumber() || theTeam == GetGameRules()->GetTeamB()->GetTeamNumber() )
{
if( CVAR_GET_FLOAT("sv_cheats") != 0 ) { return true; } //cheaters can switch
if( this->GetHasBeenSpectator() ) { return false; } // spectators have seen everybody
if( GetGameRules()->GetCheatsEnabled() ) { return true; } // cheaters can switch
if( !GetGameRules()->GetGameStarted() ) { return true; } // can switch teams before start
if( this->GetHasBeenSpectator() ) { return false; } // spectators have seen everybody
for(int counter = TEAM_ACTIVE_BEGIN; counter < TEAM_ACTIVE_END; counter++)
{
if( theTeam != counter && this->GetHasSeenTeam( (AvHTeamNumber)counter ) )
@ -9731,7 +9732,7 @@ bool AvHPlayer::GetIsAuthorized(AvHAuthAction inAction, int inParameter) const
}
return true; // haven't seen another team, authorized to join
}
return false; // unknown team - never grant an unknown permission!
return false; // unknown/inactive team - never grant an unknown permission!
}
}
case AUTH_ACTION_ADJUST_BALANCE:
@ -9895,7 +9896,7 @@ void AvHPlayer::UpdateBalanceVariables(void)
{
if( this->mBalanceMessagePending )
{
NetMsg_BalanceVarChangesPending( this->pev, false );
NetMsg_BalanceVarChangesPending( this->pev, false );
this->mBalanceMessagePending = false;
}
}