Skip to content

Commit 679fbb5

Browse files
committed
Add m_iSlot and m_iPosition handling to tf_weapon_builder, setting values whenever SetSubtype is called
1 parent 2aaf362 commit 679fbb5

File tree

4 files changed

+8
-39
lines changed

4 files changed

+8
-39
lines changed

src/game/client/tf/c_tf_weapon_builder.cpp

-16
Original file line numberDiff line numberDiff line change
@@ -239,22 +239,6 @@ bool C_TFWeaponBuilder::IsPlacingObject( void )
239239
return false;
240240
}
241241

242-
//-----------------------------------------------------------------------------
243-
// Purpose:
244-
//-----------------------------------------------------------------------------
245-
int C_TFWeaponBuilder::GetSlot( void ) const
246-
{
247-
return GetObjectInfo( m_iObjectType )->m_SelectionSlot;
248-
}
249-
250-
//-----------------------------------------------------------------------------
251-
// Purpose:
252-
//-----------------------------------------------------------------------------
253-
int C_TFWeaponBuilder::GetPosition( void ) const
254-
{
255-
return GetObjectInfo( m_iObjectType )->m_SelectionPosition;
256-
}
257-
258242
//-----------------------------------------------------------------------------
259243
// Purpose:
260244
//-----------------------------------------------------------------------------

src/game/client/tf/c_tf_weapon_builder.h

-3
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ class C_TFWeaponBuilder : public C_TFWeaponBase
4848

4949
virtual void UpdateAttachmentModels( void );
5050

51-
virtual int GetSlot( void ) const;
52-
virtual int GetPosition( void ) const;
53-
5451
void SetupObjectSelectionSprite( void );
5552

5653
virtual CHudTexture const *GetSpriteActive( void ) const;

src/game/server/tf/tf_weapon_builder.cpp

+5-17
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ CTFWeaponBuilder::~CTFWeaponBuilder()
8686
void CTFWeaponBuilder::SetSubType( int iSubType )
8787
{
8888
m_iObjectType = iSubType;
89-
89+
90+
const CObjectInfo *pInfo = GetObjectInfo( m_iObjectType );
91+
SetSlot( pInfo->m_SelectionSlot );
92+
SetPosition( pInfo->m_SelectionPosition );
93+
9094
// m_iViewModelIndex is set by the base Precache(), which didn't know what
9195
// type of object we built, so it didn't get the right viewmodel index.
9296
// Now that our data is filled in, go and get the right index.
@@ -1148,22 +1152,6 @@ bool CTFWeaponBuilder::HasAmmo( void )
11481152
return ( pOwner->GetBuildResources() >= iCost );
11491153
}
11501154

1151-
//-----------------------------------------------------------------------------
1152-
// Purpose:
1153-
//-----------------------------------------------------------------------------
1154-
int CTFWeaponBuilder::GetSlot( void ) const
1155-
{
1156-
return GetObjectInfo( m_iObjectType )->m_SelectionSlot;
1157-
}
1158-
1159-
//-----------------------------------------------------------------------------
1160-
// Purpose:
1161-
//-----------------------------------------------------------------------------
1162-
int CTFWeaponBuilder::GetPosition( void ) const
1163-
{
1164-
return GetObjectInfo( m_iObjectType )->m_SelectionPosition;
1165-
}
1166-
11671155
//-----------------------------------------------------------------------------
11681156
// Purpose:
11691157
// Output : char const

src/game/shared/basecombatweapon_shared.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,9 @@ class CBaseCombatWeapon : public BASECOMBATWEAPON_DERIVED_FROM
649649

650650
IPhysicsConstraint *GetConstraint() { return m_pConstraint; }
651651

652+
CNetworkVar( int, m_iSlot ); // which bucket this weapon is in
653+
CNetworkVar( int, m_iPosition ); // position in the bucket
654+
652655
private:
653656
WEAPON_FILE_INFO_HANDLE m_hWeaponFileInfo;
654657
IPhysicsConstraint *m_pConstraint;
@@ -662,9 +665,6 @@ class CBaseCombatWeapon : public BASECOMBATWEAPON_DERIVED_FROM
662665

663666
CNetworkVar( short, m_nCustomViewmodelModelIndex );
664667

665-
CNetworkVar( int, m_iSlot ); // which bucket this weapon is in
666-
CNetworkVar( int, m_iPosition ); // position in the bucket
667-
668668
// Server only
669669
#if !defined( CLIENT_DLL )
670670

0 commit comments

Comments
 (0)