Skip to content

Commit

Permalink
Added Stats.Add
Browse files Browse the repository at this point in the history
  • Loading branch information
garrynewman committed Jul 6, 2017
1 parent b327ab7 commit ea4c6d7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Facepunch.Steamworks/Client/Stats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ public bool Set( string name, float value, bool store = true )
return r;
}

/// <summary>
/// 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.
/// </summary>
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;
Expand Down

0 comments on commit ea4c6d7

Please sign in to comment.