Changeset 199 for trunk/src/statistics.cpp
- Timestamp:
- 05/03/2009 05:12:43 PM (3 years ago)
- File:
-
- 1 edited
-
trunk/src/statistics.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/statistics.cpp
r198 r199 20 20 21 21 #include <string> 22 #include <sstream> 22 23 #include <cstdlib> 23 24 #include <boost/foreach.hpp> … … 38 39 39 40 tmp = backend->get("statistics_games_started"); 40 games_started = atoi(tmp.c_str());41 _games_started = atoi(tmp.c_str()); 41 42 42 43 tmp = backend->get("statistics_games_finished"); 43 games_finished = atoi(tmp.c_str());44 _games_finished = atoi(tmp.c_str()); 44 45 45 46 tmp = backend->get("statistics_score_distribution"); … … 53 54 score_distribution.push_back(atoi(i.c_str())); 54 55 } 56 57 istringstream i(tmp); 58 i >> _last_reset; 55 59 } 56 60 57 61 void Statistics::game_started() 58 62 { 59 games_started++;63 _games_started++; 60 64 save(); 61 65 } … … 64 68 { 65 69 int score_slot; 66 games_finished++;70 _games_finished++; 67 71 68 72 score_slot = score/score_distribution_granuality; … … 74 78 void Statistics::save() { 75 79 string tmp; 76 backend->set("statistics_games_started", stringify(games_started)); 77 backend->set("statistics_games_finished", stringify(games_finished)); 80 backend->set("statistics_games_started", stringify(_games_started)); 81 backend->set("statistics_games_finished", stringify(_games_finished)); 82 backend->set("statistics_last_reset", stringify(_last_reset)); 78 83 79 84 tmp = ""; … … 89 94 90 95 void Statistics::reset() { 91 games_started = 0; 92 games_finished = 0; 96 _games_started = 0; 97 _games_finished = 0; 98 _last_reset = time(NULL); 93 99 94 100 score_distribution = vector<int>(score_distributions_slots, 0);
Note: See TracChangeset
for help on using the changeset viewer.
