Changes in / [a9a1295:426fb84] in network-game
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
ra9a1295 r426fb84 17 17 #include <cstdio> 18 18 #include <cstdlib> 19 //#include <cmath> 19 20 #include <sys/types.h> 20 21 #include <string> 21 22 #include <iostream> 22 #include <iomanip>23 23 #include <sstream> 24 24 #include <fstream> … … 483 483 oss.str(""); 484 484 485 time_t time_finished = gameHistory[i][4]; 486 struct tm* now = localtime(&time_finished); 487 488 oss << (now->tm_mon + 1) << "/" << now->tm_mday << "/" << (now->tm_year + 1900) << " ";; 489 490 if (now->tm_hour == 0) 491 oss << "12"; 492 else if (now->tm_hour <= 12) 493 oss << now->tm_hour; 494 else 495 oss << now->tm_hour-12; 496 497 oss << ":" << setfill('0') << setw(2) << now->tm_min << setfill(' ') << " "; 498 499 if (now->tm_hour < 12) 500 oss << "AM"; 501 else 502 oss << "PM"; 503 504 oss << endl; 505 485 oss << "6/11/2014, 5:12 PM" << endl; 506 486 al_draw_text(font, al_map_rgb(0, 255, 0), 622, 190+30*(i+1), ALLEGRO_ALIGN_CENTRE, oss.str().c_str()); 507 487 oss.clear(); … … 941 921 gameHistory = (int**)malloc(numGames*sizeof(int*)); 942 922 for (int i=0; i<numGames; i++) { 943 gameHistory[i] = (int*)malloc( 5*sizeof(int));923 gameHistory[i] = (int*)malloc(4*sizeof(int)); 944 924 cout << endl << "game record " << (i+1) << endl; 945 925 946 memcpy(&gameHistory[i][0], msg.buffer+16+i*20, 4); 947 memcpy(&gameHistory[i][1], msg.buffer+20+i*20, 4); 948 memcpy(&gameHistory[i][2], msg.buffer+24+i*20, 4); 949 memcpy(&gameHistory[i][3], msg.buffer+28+i*20, 4); 950 memcpy(&gameHistory[i][4], msg.buffer+32+i*20, 4); 926 memcpy(&gameHistory[i][0], msg.buffer+16+i*16, 4); 927 memcpy(&gameHistory[i][1], msg.buffer+20+i*16, 4); 928 memcpy(&gameHistory[i][2], msg.buffer+24+i*16, 4); 929 memcpy(&gameHistory[i][3], msg.buffer+28+i*16, 4); 951 930 952 931 cout << "result: " << gameHistory[i][0] << endl; … … 954 933 cout << "blue score: " << gameHistory[i][2] << endl; 955 934 cout << "red score: " << gameHistory[i][3] << endl; 956 957 time_t time_finished = gameHistory[i][4];958 struct tm* now = localtime(&time_finished);959 960 cout << "time game finished: ";961 cout << (now->tm_year + 1900) << '-'962 << (now->tm_mon + 1) << '-'963 << now->tm_mday << " "964 << now->tm_hour << ":"965 << now->tm_min966 << endl;967 935 } 968 936
Note:
See TracChangeset
for help on using the changeset viewer.