Changeset 2e63b64 in network-game for server


Ignore:
Timestamp:
Dec 28, 2013, 4:21:05 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
eb2ad4f
Parents:
bcfd99a
Message:

gameMap removed from server

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/server.cpp

    rbcfd99a r2e63b64  
    4444// from used to be const. Removed that so I could take a reference
    4545// and use it to send messages
    46 void processMessage(const NETWORK_MSG& clientMsg, struct sockaddr_in& from, MessageProcessor& msgProcessor, map<unsigned int, Player*>& mapPlayers, map<string, Game*>& mapGames, WorldMap* gameMap, unsigned int& unusedPlayerId);
     46void processMessage(const NETWORK_MSG& clientMsg, struct sockaddr_in& from, MessageProcessor& msgProcessor, map<unsigned int, Player*>& mapPlayers, map<string, Game*>& mapGames, unsigned int& unusedPlayerId);
    4747
    4848bool handleGameEvents(Game* game, map<unsigned int, Player*>& mapPlayers, MessageProcessor& msgPocessor);
     
    9090   outputLog.open("server.log", ios::app);
    9191   outputLog << "Started server on " << getCurrentDateTimeString() << endl;
    92 
    93    WorldMap* gameMap = WorldMap::loadMapFromFile("../data/map.txt");
    94 
    95    // add some items to the map. They will be sent out
    96    // to players when they login
    97    for (int y=0; y<gameMap->height; y++)
    98    {
    99       for (int x=0; x<gameMap->width; x++)
    100       {
    101          switch (gameMap->getStructure(x, y))
    102          {
    103             case WorldMap::STRUCTURE_BLUE_FLAG:
    104                gameMap->addObject(WorldMap::OBJECT_BLUE_FLAG, x*25+12, y*25+12);
    105                break;
    106             case WorldMap::STRUCTURE_RED_FLAG:
    107                gameMap->addObject(WorldMap::OBJECT_RED_FLAG, x*25+12, y*25+12);
    108                break;
    109          }
    110       }
    111    }
    11292
    11393   sock = socket(AF_INET, SOCK_DGRAM, 0);
     
    212192         map<string, Game*>::iterator itGames;
    213193         Game* game = NULL;
    214          WorldMap* gameMap = NULL;
    215194
    216195         for (itGames = mapGames.begin(); itGames != mapGames.end();) {
     
    268247      if (msgProcessor.receiveMessage(&clientMsg, &from) >= 0)
    269248      {
    270          processMessage(clientMsg, from, msgProcessor, mapPlayers, mapGames, gameMap, unusedPlayerId);
     249         processMessage(clientMsg, from, msgProcessor, mapPlayers, mapGames, unusedPlayerId);
    271250
    272251         cout << "Finished processing the message" << endl;
     
    293272}
    294273
    295 void processMessage(const NETWORK_MSG &clientMsg, struct sockaddr_in &from, MessageProcessor &msgProcessor, map<unsigned int, Player*>& mapPlayers, map<string, Game*>& mapGames, WorldMap* gameMap, unsigned int& unusedPlayerId)
     274void processMessage(const NETWORK_MSG &clientMsg, struct sockaddr_in &from, MessageProcessor &msgProcessor, map<unsigned int, Player*>& mapPlayers, map<string, Game*>& mapGames, unsigned int& unusedPlayerId)
    296275{
    297276   NETWORK_MSG serverMsg;
Note: See TracChangeset for help on using the changeset viewer.