Changeset f15d6a9 in network-game


Ignore:
Timestamp:
Jul 4, 2014, 8:34:34 PM (10 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
master
Children:
b1ce08c
Parents:
3476207
Message:

Server processes JOIN_GAME messages and broadcasts the info to all players

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/server.cpp

    r3476207 rf15d6a9  
    718718
    719719         map<unsigned int, Player*>& oldPlayers = g->getPlayers();
    720          g->addPlayer(p);
     720         g->addPlayer(p, true);
     721         p->team = -1;
    721722
    722723         // send info to other players
     
    752753         break;
    753754      }
     755      case MSG_TYPE_JOIN_TEAM:
     756      {
     757         cout << "Received a JOIN_TEAM message" << endl;
     758
     759         Player* p = findPlayerByAddr(mapPlayers, from);
     760         map<unsigned int, Player*> players = p->currentGame->getPlayers();
     761
     762         memcpy(&(p->team), clientMsg.buffer, 4);
     763
     764         serverMsg.type = MSG_TYPE_PLAYER;
     765         p->serialize(serverMsg.buffer);
     766         msgProcessor.broadcastMessage(serverMsg, players);
     767      }
    754768      default:
    755769      {
Note: See TracChangeset for help on using the changeset viewer.