Changeset cdb0e98 in network-game for server/server.cpp
- Timestamp:
- Jul 5, 2014, 2:27:33 AM (11 years ago)
- Branches:
- master
- Children:
- 53643ca
- Parents:
- b28e2bf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/server.cpp
rb28e2bf rcdb0e98 567 567 break; 568 568 } 569 case MSG_TYPE_PROFILE: 570 { 571 serverMsg.type = MSG_TYPE_PROFILE; 572 573 // each array is the score for one game 574 // the columns are result, team, blue score, and red score 575 // for result 0 is defeat and 1 is victory 576 // for team, 0 is blue and 1 is red 577 int scores[][4] = { 578 {1, 1, 2, 3}, 579 {1, 0, 3, 2}, 580 {0, 1, 3, 1}, 581 {1, 1, 0, 3}, 582 {0, 0, 2, 3}, 583 {1, 0, 3, 2}, 584 {1, 0, 3, 0}, 585 {0, 1, 3, 1}, 586 {1, 1, 1, 3}, 587 {1, 0, 3, 2} 588 }; 589 590 int honorPoints = 1000; 591 int numGames = 10; 592 memcpy(serverMsg.buffer, &honorPoints, 4); 593 memcpy(serverMsg.buffer+4, &numGames, 4); 594 for (unsigned int i=0; i<sizeof(scores)/sizeof(scores[0]); i++) { 595 memcpy(serverMsg.buffer+8+i*16, &scores[i][0], 4); 596 memcpy(serverMsg.buffer+12+i*16, &scores[i][1], 4); 597 memcpy(serverMsg.buffer+16+i*16, &scores[i][2], 4); 598 memcpy(serverMsg.buffer+20+i*16, &scores[i][3], 4); 599 } 600 601 msgProcessor.sendMessage(&serverMsg, &from); 602 603 break; 604 } 569 605 case MSG_TYPE_CREATE_GAME: 570 606 {
Note:
See TracChangeset
for help on using the changeset viewer.