Skip to content

Commit

Permalink
CInfClassCharacter: Adjust ActiveWeapon API
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaffeine committed Jan 21, 2024
1 parent 45bf193 commit 19ba18f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/game/server/infclass/entities/infccharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1453,9 +1453,12 @@ void CInfClassCharacter::SetSuperWeaponIndicatorEnabled(bool Enabled)

INFWEAPON CInfClassCharacter::GetInfWeaponID(int WID) const
{
if(WID < 0)
WID = m_ActiveWeapon;

if(WID == WEAPON_HAMMER)
{
switch(PrivateGetPlayerClass())
switch(GetPlayerClass())
{
case PLAYERCLASS_NINJA:
return INFWEAPON::NINJA_HAMMER;
Expand All @@ -1465,7 +1468,7 @@ INFWEAPON CInfClassCharacter::GetInfWeaponID(int WID) const
}
else if(WID == WEAPON_GUN)
{
switch(PrivateGetPlayerClass())
switch(GetPlayerClass())
{
case PLAYERCLASS_MERCENARY:
return INFWEAPON::MERCENARY_GUN;
Expand All @@ -1476,7 +1479,7 @@ INFWEAPON CInfClassCharacter::GetInfWeaponID(int WID) const
}
else if(WID == WEAPON_SHOTGUN)
{
switch(PrivateGetPlayerClass())
switch(GetPlayerClass())
{
case PLAYERCLASS_MEDIC:
return INFWEAPON::MEDIC_SHOTGUN;
Expand All @@ -1490,7 +1493,7 @@ INFWEAPON CInfClassCharacter::GetInfWeaponID(int WID) const
}
else if(WID == WEAPON_GRENADE)
{
switch(PrivateGetPlayerClass())
switch(GetPlayerClass())
{
case PLAYERCLASS_MERCENARY:
return INFWEAPON::MERCENARY_GRENADE;
Expand All @@ -1512,7 +1515,7 @@ INFWEAPON CInfClassCharacter::GetInfWeaponID(int WID) const
}
else if(WID == WEAPON_LASER)
{
switch(PrivateGetPlayerClass())
switch(GetPlayerClass())
{
case PLAYERCLASS_ENGINEER:
return INFWEAPON::ENGINEER_LASER;
Expand Down
4 changes: 3 additions & 1 deletion src/game/server/infclass/entities/infccharacter.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ class CInfClassCharacter : public CCharacter
void Die(const DeathContext &Context);

void GiveWeapon(int Weapon, int Ammo);

int ActiveWeapon() const { return m_ActiveWeapon; }
void SetActiveWeapon(int Weapon);
void SetLastWeapon(int Weapon);
bool HasWeapon(int Weapon) const;
Expand Down Expand Up @@ -235,7 +237,7 @@ class CInfClassCharacter : public CCharacter
bool HasSuperWeaponIndicator() const;
void SetSuperWeaponIndicatorEnabled(bool Enabled);

INFWEAPON GetInfWeaponID(int WID) const;
INFWEAPON GetInfWeaponID(int WID = -1) const;

using CCharacter::GameWorld;
using CCharacter::Server;
Expand Down

0 comments on commit 19ba18f

Please sign in to comment.