Skip to content

Commit 65e47d8

Browse files
committed
return value for deserialize
1 parent 546e46c commit 65e47d8

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

source/gameanalytics/Server/GAPlayer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ namespace gameanalytics
228228
catch(const std::exception& e)
229229
{
230230
logging::GALogger::e("Failed to deserialize player: %s", e.what());
231+
return false;
231232
}
232233

234+
return true;
233235
}
234236
}

source/gameanalytics/Server/GAPlayer.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace gameanalytics
2525

2626
std::string _sessionId;
2727

28-
int _sessionNum = 0;
28+
int _sessionNum = 0;
2929
int64_t _sessionLength = 0;
3030
int64_t _totalSessionLength = 0;
3131

@@ -67,13 +67,19 @@ namespace gameanalytics
6767
std::string getCustomDimension2() const;
6868
std::string getCustomDimension3() const;
6969

70+
// returns the last value and increments the transaction count for this player
7071
int getTransactionNum();
7172

73+
// returns true if this is the 1st player session
7274
bool isNewUser() const;
7375

76+
// returns true if the user has an active session
7477
bool isActive() const;
7578

76-
bool deserialize(std::string const& data);
79+
// deserializes a player from the given json
80+
bool deserialize(std::string const& jsonData);
81+
82+
// serializes a player to a json string
7783
std::string serialize() const;
7884

7985
// called when the player joins the server
@@ -82,9 +88,10 @@ namespace gameanalytics
8288
// called when the player logs off
8389
void onExit();
8490

85-
// playtime during the current session
91+
// get the playtime during the current session
8692
int64_t currentSessionPlaytime() const;
8793

94+
// return playtime of the last session, valid only after onExit has been called
8895
int64_t getLastSessionLength() const;
8996

9097
// total session playtime

source/gameanalytics/Server/GASerialize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace gameanalytics
1515
break;
1616

1717
case CustomFields::Value::value_float:
18-
j[key] = std::get<double>(field.value);
18+
j[key] = std::get<double>(field.value);
1919
break;
2020

2121
case CustomFields::Value::value_str:

0 commit comments

Comments
 (0)