This commit is contained in:
mv 2024-08-30 02:35:59 +03:00
parent f34a27a744
commit 32bfeab9fc
4 changed files with 23 additions and 0 deletions

Binary file not shown.

View File

@ -2,6 +2,7 @@
#include "c_asw_campaign_save.h" #include "c_asw_campaign_save.h"
#include "steam/isteamremotestorage.h" #include "steam/isteamremotestorage.h"
#include "filesystem.h" #include "filesystem.h"
#include "igameevents.h"
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"
@ -30,6 +31,7 @@ C_ASW_Campaign_Save::C_ASW_Campaign_Save()
{ {
m_iVersion = 0; m_iVersion = 0;
m_CampaignName[0] = '\0'; m_CampaignName[0] = '\0';
m_szPreviousCampaignName[0] = '\0';
m_iCurrentPosition = 0; m_iCurrentPosition = 0;
m_bMultiplayerGame = false; m_bMultiplayerGame = false;
} }
@ -51,6 +53,23 @@ int C_ASW_Campaign_Save::GetRetries()
return m_NumRetries[m_iCurrentPosition]; return m_NumRetries[m_iCurrentPosition];
} }
void C_ASW_Campaign_Save::OnDataChanged( DataUpdateType_t updateType )
{
BaseClass::OnDataChanged( updateType );
if ( Q_strcmp( m_szPreviousCampaignName, m_CampaignName ) )
{
Q_strncpy( m_szPreviousCampaignName, m_CampaignName, sizeof( m_szPreviousCampaignName ) );
IGameEvent * event = gameeventmanager->CreateEvent( "campaign_changed" );
if ( event )
{
event->SetString( "campaign", m_CampaignName );
gameeventmanager->FireEventClientSide( event );
}
}
}
ConVar asw_steam_cloud_debug( "asw_steam_cloud_debug", "1", FCVAR_NONE, "Print Steam Cloud messages" ); ConVar asw_steam_cloud_debug( "asw_steam_cloud_debug", "1", FCVAR_NONE, "Print Steam Cloud messages" );
bool GetFileFromRemoteStorage( ISteamRemoteStorage *pRemoteStorage, const char *pszRemoteFileName, const char *pszLocalFileName ) bool GetFileFromRemoteStorage( ISteamRemoteStorage *pRemoteStorage, const char *pszRemoteFileName, const char *pszLocalFileName )

View File

@ -21,11 +21,14 @@ public:
C_ASW_Campaign_Save(); C_ASW_Campaign_Save();
virtual ~C_ASW_Campaign_Save(); virtual ~C_ASW_Campaign_Save();
virtual void OnDataChanged( DataUpdateType_t updateType );
// savegame version (current is 0) // savegame version (current is 0)
CNetworkVar(int, m_iVersion); CNetworkVar(int, m_iVersion);
// the campaign this save game is meant for // the campaign this save game is meant for
char m_CampaignName[255]; char m_CampaignName[255];
char m_szPreviousCampaignName[255];
// the mission ID of the location the squad is current in // the mission ID of the location the squad is current in
CNetworkVar(int, m_iCurrentPosition); CNetworkVar(int, m_iCurrentPosition);

View File

@ -810,6 +810,7 @@ class CAchievement_Ammo_Resupply : public CASW_Achievement
{ {
SetFlags( ACH_SAVE_GLOBAL ); SetFlags( ACH_SAVE_GLOBAL );
SetGoal( 10 ); SetGoal( 10 );
SetStoreProgressInSteam( true );
} }
// server fires an event for this achievement, no other code within achievement necessary // server fires an event for this achievement, no other code within achievement necessary
}; };