Changeset 7fa452f in network-game
- Timestamp:
- Nov 8, 2014, 1:38:54 AM (10 years ago)
- Branches:
- master
- Children:
- 347d768
- Parents:
- 306758e
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/GameRender.cpp
r306758e r7fa452f 96 96 al_draw_filled_circle(pos.x, pos.y, 14, al_map_rgb(0, 0, 0)); 97 97 98 if (p->team == 0)98 if (p->team == 1) 99 99 color = al_map_rgb(0, 0, 255); 100 else if (p->team == 1)100 else if (p->team == 2) 101 101 color = al_map_rgb(255, 0, 0); 102 102 else { -
client/Client/main.cpp
r306758e r7fa452f 505 505 for (itPlayers = gamePlayers.begin(); itPlayers != gamePlayers.end(); itPlayers++) { 506 506 switch (itPlayers->second->team) { 507 case -1:507 case 0: 508 508 drawPosition = 200; 509 509 break; 510 case 0:510 case 1: 511 511 drawPosition = 400; 512 512 break; 513 case 1:513 case 2: 514 514 drawPosition = 600; 515 515 break; … … 1514 1514 void joinWaitingArea() { 1515 1515 cout << "joining waiting area" << endl; 1516 currentPlayer->team = -1;1516 currentPlayer->team = 0; 1517 1517 1518 1518 msgTo.type = MSG_TYPE_JOIN_TEAM; … … 1524 1524 void joinBlueTeam() { 1525 1525 cout << "joining blue team" << endl; 1526 currentPlayer->team = 0;1526 currentPlayer->team = 1; 1527 1527 1528 1528 msgTo.type = MSG_TYPE_JOIN_TEAM; … … 1534 1534 void joinRedTeam() { 1535 1535 cout << "joining red team" << endl; 1536 currentPlayer->team = 1;1536 currentPlayer->team = 2; 1537 1537 1538 1538 msgTo.type = MSG_TYPE_JOIN_TEAM; -
common/Game.cpp
r306758e r7fa452f 184 184 switch (it->type) { 185 185 case OBJECT_BLUE_FLAG: 186 if (p->team == 1) {186 if (p->team == 2) { 187 187 p->hasBlueFlag = true; 188 188 itemId = it->id; … … 190 190 break; 191 191 case OBJECT_RED_FLAG: 192 if (p->team == 0) {192 if (p->team == 1) { 193 193 p->hasRedFlag = true; 194 194 itemId = it->id; -
common/Player.cpp
r306758e r7fa452f 30 30 this->range = 0; 31 31 this->attackCooldown = 0; 32 this->team = 0; // blueteam by default32 this->team = 0; // no team by default 33 33 this->hasBlueFlag = false; 34 34 this->hasRedFlag = false; … … 104 104 this->range = 0; 105 105 this->attackCooldown = 0; 106 this->team = 0; // blueteam by default106 this->team = 0; // no team by default 107 107 this->hasBlueFlag = false; 108 108 this->hasRedFlag = false; -
common/Player.h
r306758e r7fa452f 84 84 int range; 85 85 unsigned long long attackCooldown; 86 int team; // 0 is blue, 1is red86 int team; // 0 is none, 1 is blue, 2 is red 87 87 bool hasBlueFlag; 88 88 bool hasRedFlag; -
server/DataAccess.cpp
r306758e r7fa452f 180 180 // the columns are result, team, blue score, and red score 181 181 // for result 0 is defeat and 1 is victory 182 // for team, 0 is blue and 1is red182 // for team, 1 is blue and 2 is red 183 183 184 184 MYSQL_RES *result; … … 205 205 206 206 if (blueScore == 3) { 207 if (userTeam == 0)207 if (userTeam == 1) 208 208 gameResult = 1; 209 209 else 210 210 gameResult = 0; 211 211 }else if (redScore == 3) { 212 if (userTeam == 1)212 if (userTeam == 2) 213 213 gameResult = 1; 214 214 else -
server/server.cpp
r306758e r7fa452f 139 139 switch (p->team) 140 140 { 141 case 0:// blue team141 case 1:// blue team 142 142 spawnPos = p->currentGame->getMap()->getStructureLocation(STRUCTURE_BLUE_FLAG); 143 143 break; 144 case 1:// red team144 case 2:// red team 145 145 spawnPos = p->currentGame->getMap()->getStructureLocation(STRUCTURE_RED_FLAG); 146 146 break; … … 191 191 int winningTeam = -1; 192 192 if (game->getBlueScore() == 3) 193 winningTeam = 0;193 winningTeam = 1; 194 194 else if (game->getRedScore() == 3) 195 winningTeam = 1;195 winningTeam = 2; 196 196 197 197 if (winningTeam == -1) … … 780 780 map<unsigned int, Player*>& oldPlayers = g->getPlayers(); 781 781 g->addPlayer(p); 782 p->team = -1;782 p->team = 0; 783 783 784 784 // send info to other players … … 921 921 case STRUCTURE_BLUE_FLAG: 922 922 { 923 if (p->team == 0&& p->hasRedFlag) {923 if (p->team == 1 && p->hasRedFlag) { 924 924 // check that your flag is at your base 925 925 pos = game->getMap()->getStructureLocation(STRUCTURE_BLUE_FLAG); … … 950 950 case STRUCTURE_RED_FLAG: 951 951 { 952 if (p->team == 1&& p->hasBlueFlag) {952 if (p->team == 2 && p->hasBlueFlag) { 953 953 // check that your flag is at your base 954 954 pos = game->getMap()->getStructureLocation(STRUCTURE_RED_FLAG); … … 1047 1047 1048 1048 if (posDistance(p->pos, pos.toFloat()) < 10) { 1049 if (p->team == 0&& itObjects->type == OBJECT_BLUE_FLAG) {1049 if (p->team == 1 && itObjects->type == OBJECT_BLUE_FLAG) { 1050 1050 structPos = game->getMap()->getStructureLocation(STRUCTURE_BLUE_FLAG); 1051 1051 flagReturned = true; 1052 1052 break; 1053 } else if (p->team == 1&& itObjects->type == OBJECT_RED_FLAG) {1053 } else if (p->team == 2 && itObjects->type == OBJECT_RED_FLAG) { 1054 1054 structPos = game->getMap()->getStructureLocation(STRUCTURE_RED_FLAG); 1055 1055 flagReturned = true;
Note:
See TracChangeset
for help on using the changeset viewer.