Skip to content

Commit

Permalink
add some missing ifdefs
Browse files Browse the repository at this point in the history
  • Loading branch information
BenLubar committed May 23, 2024
1 parent 943c341 commit 7bfadd0
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 49 deletions.
4 changes: 4 additions & 0 deletions src/game/client/swarm/rd_collections_inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ class HoverableItemIcon : public vgui::ImagePanel
CRD_ItemInstance m_Details;
};

#ifdef RD_7A_DROPS
class CRD_Collection_Panel_Inventory_Unbox_Choice : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CRD_Collection_Panel_Inventory_Unbox_Choice, vgui::EditablePanel );
Expand Down Expand Up @@ -869,6 +870,7 @@ class CRD_Collection_Panel_Inventory_Unbox_Choice : public vgui::EditablePanel
};
CUtlVector<ItemIconSection_t> m_ItemIconSections;
};
#endif

CRD_Collection_Entry_Inventory::CRD_Collection_Entry_Inventory( TGD_Grid *parent, const char *panelName, int index, const ReactiveDropInventory::ItemInstance_t &details )
: BaseClass( parent, panelName ),
Expand Down Expand Up @@ -1070,6 +1072,7 @@ void CRD_Collection_Entry_Inventory::OnCommand( const char *command )
}
}
}
#ifdef RD_7A_DROPS
else if ( const char *szAccessoryDef = StringAfterPrefix( command, "AttachAccessory" ) )
{
SteamItemDef_t iAccessoryDef = V_atoi( szAccessoryDef );
Expand Down Expand Up @@ -1108,6 +1111,7 @@ void CRD_Collection_Entry_Inventory::OnCommand( const char *command )
CRD_Collection_Panel_Inventory_Unbox_Choice *pModal = new CRD_Collection_Panel_Inventory_Unbox_Choice( pTGD, "OptionsModal", this );
pTGD->SetOverridePanel( pModal );
}
#endif
else if ( !V_strcmp( command, "Back" ) )
{
// do nothing
Expand Down
102 changes: 55 additions & 47 deletions src/game/client/swarm/vgui/asw_mission_chooser_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ void CASW_Mission_Chooser_Details::DisplayEntry( TGD_Entry *pBaseEntry )
g_pVGuiLocalize->Find( pEntry->m_szMission[0] ? "#rd_mission_modifier_bounty" : "#rd_mission_modifier_bounty_campaign" ) );
break;
case CASW_Mission_Chooser_Entry::MM_CRAFTING:
#ifdef RD_7A_DROPS
V_snwprintf( wszModifiers, NELEMS( wszModifiers ), L"%s\n\n%s\n", wszModifiers,
g_pVGuiLocalize->Find( pEntry->m_szMission[0] ? "#rd_mission_modifier_crafting" : "#rd_mission_modifier_crafting_campaign" ) );
for ( int j = 0; j < NUM_RD_CRAFTING_MATERIAL_RARITIES; j++ )
Expand All @@ -606,6 +607,7 @@ void CASW_Mission_Chooser_Details::DisplayEntry( TGD_Entry *pBaseEntry )
V_snwprintf( wszModifiers, NELEMS( wszModifiers ), L"%s\n%s", wszModifiers, wszPerRarity );
}
}
#endif
break;
}
}
Expand Down Expand Up @@ -706,77 +708,83 @@ CASW_Mission_Chooser_Entry::CASW_Mission_Chooser_Entry( TGD_Grid *parent, const
}
}
#ifdef RD_7A_DROPS
CUtlVector<ReactiveDropInventory::ItemInstance_t> tokens;
ReactiveDropInventory::GetItemsForSlot( tokens, "material_drop_token" );
for ( int i = 0; i < NUM_RD_CRAFTING_MATERIAL_RARITIES; i++ )
{
m_MaterialsPerRarity[i] = 0;
}

if ( pMission )
CUtlVector<ReactiveDropInventory::ItemInstance_t> optin;
ReactiveDropInventory::GetItemsForDef( optin, 4029 );
if ( optin.Count() )
{
for ( int i = RD_CRAFTING_MATERIAL_NONE + 1; i < NUM_RD_CRAFTING_MATERIAL_TYPES; i++ )
{
RD_Crafting_Material_t eMaterial = RD_Crafting_Material_t( i );
if ( !pMission->CraftingMaterialFoundHere( eMaterial ) )
continue;
CUtlVector<ReactiveDropInventory::ItemInstance_t> tokens;
ReactiveDropInventory::GetItemsForSlot( tokens, "material_drop_token" );

bool bFound = false;
FOR_EACH_VEC( tokens, j )
if ( pMission )
{
for ( int i = RD_CRAFTING_MATERIAL_NONE + 1; i < NUM_RD_CRAFTING_MATERIAL_TYPES; i++ )
{
if ( g_RD_Crafting_Material_Info[i].m_iTokenDef == tokens[j].ItemDefID )
RD_Crafting_Material_t eMaterial = RD_Crafting_Material_t( i );
if ( !pMission->CraftingMaterialFoundHere( eMaterial ) )
continue;

bool bFound = false;
FOR_EACH_VEC( tokens, j )
{
if ( !bFound )
if ( g_RD_Crafting_Material_Info[i].m_iTokenDef == tokens[j].ItemDefID )
{
m_AvailableMaterials.AddToTail( eMaterial );
bFound = true;
}
if ( !bFound )
{
m_AvailableMaterials.AddToTail( eMaterial );
bFound = true;
}

m_MaterialsPerRarity[g_RD_Crafting_Material_Info[i].m_iRarity] += tokens[j].Quantity;
m_MaterialsPerRarity[g_RD_Crafting_Material_Info[i].m_iRarity] += tokens[j].Quantity;
}
}
}
}
}
else if ( pCampaign )
{
CUtlVector<const RD_Mission_t *> missions;
FOR_EACH_VEC( pCampaign->Missions, i )
else if ( pCampaign )
{
if ( i == 0 )
continue;
CUtlVector<const RD_Mission_t *> missions;
FOR_EACH_VEC( pCampaign->Missions, i )
{
if ( i == 0 )
continue;

const RD_Mission_t *pCampaignMission = ReactiveDropMissions::GetMission( pCampaign->Missions[i].MapName );
if ( pCampaignMission )
missions.AddToTail( pCampaignMission );
}
for ( int i = RD_CRAFTING_MATERIAL_NONE + 1; i < NUM_RD_CRAFTING_MATERIAL_TYPES; i++ )
{
RD_Crafting_Material_t eMaterial = RD_Crafting_Material_t( i );
bool bFoundHere = false;
FOR_EACH_VEC( missions, j )
const RD_Mission_t *pCampaignMission = ReactiveDropMissions::GetMission( pCampaign->Missions[i].MapName );
if ( pCampaignMission )
missions.AddToTail( pCampaignMission );
}
for ( int i = RD_CRAFTING_MATERIAL_NONE + 1; i < NUM_RD_CRAFTING_MATERIAL_TYPES; i++ )
{
if ( missions[j]->CraftingMaterialFoundHere( eMaterial ) )
RD_Crafting_Material_t eMaterial = RD_Crafting_Material_t( i );
bool bFoundHere = false;
FOR_EACH_VEC( missions, j )
{
bFoundHere = true;
break;
if ( missions[j]->CraftingMaterialFoundHere( eMaterial ) )
{
bFoundHere = true;
break;
}
}
}

if ( !bFoundHere )
continue;
if ( !bFoundHere )
continue;

bool bFound = false;
FOR_EACH_VEC( tokens, j )
{
if ( g_RD_Crafting_Material_Info[i].m_iTokenDef == tokens[j].ItemDefID )
bool bFound = false;
FOR_EACH_VEC( tokens, j )
{
if ( !bFound )
if ( g_RD_Crafting_Material_Info[i].m_iTokenDef == tokens[j].ItemDefID )
{
m_AvailableMaterials.AddToTail( eMaterial );
bFound = true;
}
if ( !bFound )
{
m_AvailableMaterials.AddToTail( eMaterial );
bFound = true;
}

m_MaterialsPerRarity[g_RD_Crafting_Material_Info[i].m_iRarity] += tokens[j].Quantity;
m_MaterialsPerRarity[g_RD_Crafting_Material_Info[i].m_iRarity] += tokens[j].Quantity;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/shared/swarm/rd_crafting_defs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@ bool CRD_Crafting_Material_Pickup::IsUsable( CBaseEntity *pUser )

return ( pUser && pUser->GetAbsOrigin().DistTo( GetAbsOrigin() ) < ASW_MARINE_USE_RADIUS ); // near enough?
}
#endif

#ifdef DBGFLAG_ASSERT
static int __cdecl CompareItemIDs( const SteamItemDef_t *a, const SteamItemDef_t *b )
Expand Down Expand Up @@ -628,3 +627,4 @@ void CheckContainsAnyItemIDLists( const CUtlVector<SteamItemDef_t> &AllItemDefs
}
}
#endif
#endif
2 changes: 1 addition & 1 deletion src/game/shared/swarm/rd_inventory_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ static class CRD_Inventory_Manager final : public CAutoGameSystem, public CGameE
Msg( "Successfully wrote item schema cache with %d items (skipped %d) in %fs\n", nItemDefs - nSkippedDefs, nSkippedDefs, timer.GetDuration().GetSeconds() );
}

#ifdef DBGFLAG_ASSERT
#if defined( DBGFLAG_ASSERT ) && defined( RD_7A_DROPS )
extern void CheckContainsAnyItemIDLists( const CUtlVector<SteamItemDef_t> &itemIDs );
CheckContainsAnyItemIDLists( ItemDefIDs );
#endif
Expand Down

0 comments on commit 7bfadd0

Please sign in to comment.