Changes in server/DataAccess.cpp [426fb84:7fa452f] in network-game
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/DataAccess.cpp
r426fb84 r7fa452f 178 178 { 179 179 // each array is the score for one game 180 // the columns are result, team, blue score, red score, and time the game ended180 // the columns are result, team, blue score, and red score 181 181 // for result 0 is defeat and 1 is victory 182 182 // for team, 1 is blue and 2 is red … … 197 197 int i=0; 198 198 while ( ( row = mysql_fetch_row(result)) != NULL ) { 199 gameHistory[i] = new int[ 5];199 gameHistory[i] = new int[4]; 200 200 201 201 int userTeam = atoi(row[2]); 202 int blueScore = atoi(row[3]); 203 int redScore = atoi(row[4]); 204 time_t timeFinished = atoi(row[5]); 202 int blueScore = atoi(row[4]); 203 int redScore = atoi(row[3]); 205 204 int gameResult = -1; 206 205 … … 223 222 gameHistory[i][2] = blueScore; 224 223 gameHistory[i][3] = redScore; 225 gameHistory[i][4] = timeFinished;226 224 227 225 i++; … … 238 236 } 239 237 240 int DataAccess::saveGameHistory(int playerId, int team, int blueScore, int redScore , time_t timeFinished)238 int DataAccess::saveGameHistory(int playerId, int team, int blueScore, int redScore) 241 239 { 242 240 ostringstream oss; 243 241 244 242 cout << "Saving game to db" << endl; 245 oss << playerId << ", " << team << ", " << blueScore << ", " << redScore << ", " << timeFinished;246 247 return insert("gameHistory", "user_id, user_team, blue_score, red_score , time_finished", oss.str());243 oss << playerId << ", " << team << ", " << blueScore << ", " << redScore; 244 245 return insert("gameHistory", "user_id, user_team, blue_score, red_score", oss.str()); 248 246 } 249 247
Note:
See TracChangeset
for help on using the changeset viewer.