From 2f71850ff0f2bd4cd2e5f21e93c5b1d867916798 Mon Sep 17 00:00:00 2001 From: XP-Cagey Date: Tue, 5 Apr 2005 00:30:35 +0000 Subject: [PATCH] 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 --- main/source/cl_dll/ammo.cpp | 11 +++++------ main/source/dlls/player.cpp | 4 ---- main/source/mod/AvHNetworkMessages.cpp | 2 +- main/source/mod/AvHPlayer.cpp | 13 +++++++------ 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/main/source/cl_dll/ammo.cpp b/main/source/cl_dll/ammo.cpp index 4052918..336abf0 100644 --- a/main/source/cl_dll/ammo.cpp +++ b/main/source/cl_dll/ammo.cpp @@ -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; } diff --git a/main/source/dlls/player.cpp b/main/source/dlls/player.cpp index b54e4b8..19ee4d4 100644 --- a/main/source/dlls/player.cpp +++ b/main/source/dlls/player.cpp @@ -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 ); } diff --git a/main/source/mod/AvHNetworkMessages.cpp b/main/source/mod/AvHNetworkMessages.cpp index 15fa05c..0330152 100644 --- a/main/source/mod/AvHNetworkMessages.cpp +++ b/main/source/mod/AvHNetworkMessages.cpp @@ -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 ); diff --git a/main/source/mod/AvHPlayer.cpp b/main/source/mod/AvHPlayer.cpp index f33c402..451032c 100644 --- a/main/source/mod/AvHPlayer.cpp +++ b/main/source/mod/AvHPlayer.cpp @@ -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; } }