Skip to content

Commit

Permalink
Change return type of GetWeaponptr to CBasePlayerWeapon*
Browse files Browse the repository at this point in the history
  • Loading branch information
SamVanheer committed Jul 22, 2022
1 parent 100aa3e commit 5d8dc69
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
5 changes: 2 additions & 3 deletions dlls/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,7 @@ int GetWeaponData(struct edict_s* player, struct weapon_data_s* info)

while (pPlayerItem)
{
gun = dynamic_cast<CBasePlayerWeapon*>(pPlayerItem->GetWeaponPtr());
gun = pPlayerItem->GetWeaponPtr();
if (gun && gun->UseDecrement())
{
// Get The ID.
Expand Down Expand Up @@ -1737,8 +1737,7 @@ void UpdateClientData(const edict_t* ent, int sendweapons, struct clientdata_s*

if (pl->m_pActiveItem)
{
CBasePlayerWeapon* gun;
gun = (CBasePlayerWeapon*)pl->m_pActiveItem->GetWeaponPtr();
CBasePlayerWeapon* gun = pl->m_pActiveItem->GetWeaponPtr();
if (gun && gun->UseDecrement())
{
ItemInfo II;
Expand Down
4 changes: 1 addition & 3 deletions dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2595,9 +2595,7 @@ void CBasePlayer::PostThink()

while (pPlayerItem)
{
CBasePlayerWeapon* gun;

gun = (CBasePlayerWeapon*)pPlayerItem->GetWeaponPtr();
CBasePlayerWeapon* gun = pPlayerItem->GetWeaponPtr();

if (gun && gun->UseDecrement())
{
Expand Down
5 changes: 3 additions & 2 deletions dlls/weapons.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "weaponinfo.h"

class CBasePlayer;
class CBasePlayerWeapon;

void DeactivateSatchels(CBasePlayer* pOwner);

Expand Down Expand Up @@ -248,7 +249,7 @@ class CBasePlayerItem : public CBaseAnimating

virtual bool UpdateClientData(CBasePlayer* pPlayer) { return false; }

virtual CBasePlayerItem* GetWeaponPtr() { return NULL; }
virtual CBasePlayerWeapon* GetWeaponPtr() { return NULL; }

virtual void GetWeaponData(weapon_data_t& data) {}

Expand Down Expand Up @@ -338,7 +339,7 @@ class CBasePlayerWeapon : public CBasePlayerItem

void PrintState();

CBasePlayerItem* GetWeaponPtr() override { return (CBasePlayerItem*)this; }
CBasePlayerWeapon* GetWeaponPtr() override { return this; }
float GetNextAttackDelay(float delay);

float m_flPumpTime;
Expand Down
2 changes: 1 addition & 1 deletion dlls/weapons_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void CBasePlayer::SelectLastItem()
m_pActiveItem = m_pLastItem;
m_pLastItem = pTemp;

auto weapon = static_cast<CBasePlayerWeapon*>(m_pActiveItem->GetWeaponPtr());
auto weapon = m_pActiveItem->GetWeaponPtr();

if (weapon)
{
Expand Down

0 comments on commit 5d8dc69

Please sign in to comment.