Changeset 7fa452f in network-game for server


Ignore:
Timestamp:
Nov 8, 2014, 1:38:54 AM (10 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
master
Children:
347d768
Parents:
306758e
Message:

Change the player team variable so that 0 means no team, 1 means blue team, and 2 means red team (before, -1 meant no team, 0 meant blue team, and 1 meant red team)

Location:
server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • server/DataAccess.cpp

    r306758e r7fa452f  
    180180   // the columns are result, team, blue score, and red score
    181181   // for result 0 is defeat and 1 is victory
    182    // for team, 0 is blue and 1 is red
     182   // for team, 1 is blue and 2 is red
    183183
    184184   MYSQL_RES *result;
     
    205205
    206206      if (blueScore == 3) {
    207          if (userTeam == 0)
     207         if (userTeam == 1)
    208208            gameResult = 1;
    209209         else
    210210            gameResult = 0;
    211211      }else if (redScore == 3) {
    212          if (userTeam == 1)
     212         if (userTeam == 2)
    213213            gameResult = 1;
    214214         else
  • server/server.cpp

    r306758e r7fa452f  
    139139                  switch (p->team)
    140140                  {
    141                   case 0:// blue team
     141                  case 1:// blue team
    142142                     spawnPos = p->currentGame->getMap()->getStructureLocation(STRUCTURE_BLUE_FLAG);
    143143                     break;
    144                   case 1:// red team
     144                  case 2:// red team
    145145                     spawnPos = p->currentGame->getMap()->getStructureLocation(STRUCTURE_RED_FLAG);
    146146                     break;
     
    191191               int winningTeam = -1;
    192192               if (game->getBlueScore() == 3)
    193                   winningTeam = 0;
     193                  winningTeam = 1;
    194194               else if (game->getRedScore() == 3)
    195                   winningTeam = 1;
     195                  winningTeam = 2;
    196196
    197197               if (winningTeam == -1)
     
    780780         map<unsigned int, Player*>& oldPlayers = g->getPlayers();
    781781         g->addPlayer(p);
    782          p->team = -1;
     782         p->team = 0;
    783783
    784784         // send info to other players
     
    921921         case STRUCTURE_BLUE_FLAG:
    922922         {
    923             if (p->team == 0 && p->hasRedFlag) {
     923            if (p->team == 1 && p->hasRedFlag) {
    924924               // check that your flag is at your base
    925925               pos = game->getMap()->getStructureLocation(STRUCTURE_BLUE_FLAG);
     
    950950         case STRUCTURE_RED_FLAG:
    951951         {
    952             if (p->team == 1 && p->hasBlueFlag) {
     952            if (p->team == 2 && p->hasBlueFlag) {
    953953               // check that your flag is at your base
    954954               pos = game->getMap()->getStructureLocation(STRUCTURE_RED_FLAG);
     
    10471047
    10481048         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) {
    10501050               structPos = game->getMap()->getStructureLocation(STRUCTURE_BLUE_FLAG);
    10511051               flagReturned = true;
    10521052               break;
    1053             } else if (p->team == 1 && itObjects->type == OBJECT_RED_FLAG) {
     1053            } else if (p->team == 2 && itObjects->type == OBJECT_RED_FLAG) {
    10541054               structPos = game->getMap()->getStructureLocation(STRUCTURE_RED_FLAG);
    10551055               flagReturned = true;
Note: See TracChangeset for help on using the changeset viewer.