Skip to content

Commit

Permalink
Implement reviewers suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
znvjder committed Feb 11, 2024
1 parent 62a7fa0 commit c9d7e05
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Client/mods/deathmatch/logic/rpc/CPlayerRPCs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ void CPlayerRPCs::RemotePlayerSwitchWeapon(CClientEntity* pSource, NetBitStreamI
return;

uint lastSlot, currentSlot;
if (bitStream.Read(lastSlot) && bitStream.Read(currentSlot))
{
CClientPlayer* pPlayer = m_pPlayerManager->Get(pSource->GetID());
if (IS_REMOTE_PLAYER(pPlayer))
{
CLuaArguments Arguments;
Arguments.PushNumber(lastSlot);
Arguments.PushNumber(currentSlot);
pPlayer->CallEvent("onClientPlayerWeaponSwitch", Arguments, true);
}
}
if (!(bitStream.Read(lastSlot) && bitStream.Read(currentSlot)))
return;

CClientPlayer* pPlayer = m_pPlayerManager->Get(pSource->GetID());
if (!IS_REMOTE_PLAYER(pPlayer))
return;

CLuaArguments Arguments;
Arguments.PushNumber(lastSlot);
Arguments.PushNumber(currentSlot);
pPlayer->CallEvent("onClientPlayerWeaponSwitch", Arguments, true);
}
4 changes: 4 additions & 0 deletions Server/mods/deathmatch/logic/CRPCFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,12 @@ void CRPCFunctions::PlayerWeapon(NetBitStreamInterface& bitStream)
playersInNearList.clear();

for (const auto& player : nearList)
{
if (player.first->CanBitStream(eBitStreamVersion::OnPlayerWeaponSwitch_Remote))
{
playersInNearList.push_back(player.first);
}
}

if (!playersInNearList.empty())
{
Expand Down

0 comments on commit c9d7e05

Please sign in to comment.