Changeset 3476207 in network-game for client/Client/main.cpp
- Timestamp:
- Jul 4, 2014, 8:23:38 PM (10 years ago)
- Branches:
- master
- Children:
- dfc81f0, f15d6a9
- Parents:
- e98426d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
re98426d r3476207 439 439 int drawPosition = 0; 440 440 441 switch (currentPlayer->team) {442 case -1:443 drawPosition = 200;444 break;445 case 0:446 drawPosition = 400;447 break;448 case 1:449 drawPosition = 600;450 break;451 }452 453 441 map<unsigned int, Player*> gamePlayers = game->getPlayers(); 454 442 map<unsigned int, Player*>::iterator itPlayers; … … 456 444 int i=0; 457 445 for (itPlayers = gamePlayers.begin(); itPlayers != gamePlayers.end(); itPlayers++) { 446 switch (itPlayers->second->team) { 447 case -1: 448 drawPosition = 200; 449 break; 450 case 0: 451 drawPosition = 400; 452 break; 453 case 1: 454 drawPosition = 600; 455 break; 456 } 457 458 458 oss << itPlayers->second->name << endl; 459 459 al_draw_text(font, al_map_rgb(0, 255, 0), drawPosition, 135+i*15, ALLEGRO_ALIGN_LEFT, oss.str().c_str()); … … 845 845 state = STATE_GAME_LOBBY; 846 846 wndCurrent = wndGameLobby; 847 mapPlayers[curPlayerId]->team = -1;848 847 849 848 msgTo.type = MSG_TYPE_JOIN_GAME_ACK; … … 954 953 p.deserialize(msg.buffer); 955 954 cout << "Deserialized player" << endl; 955 cout << "player team: " << p.team << endl; 956 cout << "current player team: " << currentPlayer->team << endl; 956 957 p.timeLastUpdated = getCurrentMillis(); 957 958 p.isChasing = false; … … 966 967 mapPlayers[p.getId()] = new Player(p); 967 968 968 game->addPlayer(mapPlayers[p.getId()] );969 game->addPlayer(mapPlayers[p.getId()], false); 969 970 970 971 break; … … 1369 1370 cout << "joining waiting area" << endl; 1370 1371 currentPlayer->team = -1; 1372 1373 msgTo.type = MSG_TYPE_JOIN_TEAM; 1374 memcpy(msgTo.buffer, &(currentPlayer->team), 4); 1375 1376 msgProcessor.sendMessage(&msgTo, &server); 1371 1377 } 1372 1378 … … 1374 1380 cout << "joining blue team" << endl; 1375 1381 currentPlayer->team = 0; 1382 1383 msgTo.type = MSG_TYPE_JOIN_TEAM; 1384 memcpy(msgTo.buffer, &(currentPlayer->team), 4); 1385 1386 msgProcessor.sendMessage(&msgTo, &server); 1376 1387 } 1377 1388 … … 1379 1390 cout << "joining red team" << endl; 1380 1391 currentPlayer->team = 1; 1392 1393 msgTo.type = MSG_TYPE_JOIN_TEAM; 1394 memcpy(msgTo.buffer, &(currentPlayer->team), 4); 1395 1396 msgProcessor.sendMessage(&msgTo, &server); 1381 1397 } 1382 1398
Note:
See TracChangeset
for help on using the changeset viewer.