Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 9, 2007, 12:42:46 PM (16 years ago)
Author:
scheusso
Message:

extended gamestatehandling for diffed and not diffed gamestates (initial states, etc)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/network/Server.cc

    r425 r436  
    2121   */
    2222  Server::Server(){
    23     connection = ConnectionManager();
    24     gamestates = GameStateManager();
    2523    packet_gen = PacketGenerator();
     24    clients = new ClientInformation();
     25    connection = new ConnectionManager(clients);
     26    gamestates = new GameStateManager(clients);
    2627  }
    2728
     
    3233   */
    3334  Server::Server(int port, std::string bindAddress){
    34     connection = ConnectionManager(port, bindAddress);
    35     gamestates = GameStateManager();
    3635    packet_gen = PacketGenerator();
     36    clients = new ClientInformation();
     37    connection = new ConnectionManager(port, bindAddress, clients);
     38    gamestates = new GameStateManager(clients);
    3739  }
    3840
     
    4345   */
    4446  Server::Server(int port, const char *bindAddress){
    45     connection = ConnectionManager(port, bindAddress);
    46     gamestates = GameStateManager();
    4747    packet_gen = PacketGenerator();
     48    clients = new ClientInformation();
     49    connection = new ConnectionManager(port, bindAddress, clients);
     50    gamestates = new GameStateManager(clients);
    4851  }
    4952 
     
    5255   */
    5356  void Server::open(){
    54     connection.createListener();
     57    connection->createListener();
    5558    return;
    5659  }
     
    6063   */
    6164  void Server::close(){
    62     connection.quitListener();
     65    connection->quitListener();
    6366    return;
    6467  }
     
    7174  bool Server::sendMSG(std::string msg){
    7275    ENetPacket *packet = packet_gen.chatMessage(msg.c_str());
    73     connection.addPacketAll(packet);
    74     return connection.sendPackets();
     76    connection->addPacketAll(packet);
     77    return connection->sendPackets();
    7578  }
    7679  /**
     
    8184  bool Server::sendMSG(const char *msg){
    8285    ENetPacket *packet = packet_gen.chatMessage(msg);
    83     connection.addPacketAll(packet);
    84     return connection.sendPackets();
     86    connection->addPacketAll(packet);
     87    return connection->sendPackets();
    8588  }
    8689 
     
    101104    ENetPacket *packet;
    102105    int clientID=-1;
    103     while(!connection.queueEmpty()){
    104       packet = connection.getPacket(clientID);
     106    while(!connection->queueEmpty()){
     107      packet = connection->getPacket(clientID);
    105108      elaborate(packet, clientID);
    106109    }
     
    111114   */
    112115  void Server::updateGamestate(){
    113     gamestates.update();
     116    gamestates->update();
    114117    sendGameState();
    115118  }
Note: See TracChangeset for help on using the changeset viewer.