From ea4c6d72b59bb392bae75ad645290922707368b7 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Thu, 6 Jul 2017 10:45:03 +0100 Subject: [PATCH] Added Stats.Add --- Facepunch.Steamworks/Client/Stats.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Facepunch.Steamworks/Client/Stats.cs b/Facepunch.Steamworks/Client/Stats.cs index 066918d..5b8eac3 100644 --- a/Facepunch.Steamworks/Client/Stats.cs +++ b/Facepunch.Steamworks/Client/Stats.cs @@ -91,6 +91,18 @@ namespace Facepunch.Steamworks return r; } + /// + /// Adds this amount to the named stat. Internally this calls Get() and adds + /// to that value. Steam doesn't provide a mechanism for atomically increasing + /// stats like this, this functionality is added here as a convenience. + /// + public bool Add( string name, int amount = 1, bool store = true ) + { + var val = GetInt( name ); + val += amount; + return Set( name, val, store ); + } + public void Dispose() { client = null;