Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 13, 2008, 4:16:02 PM (17 years ago)
Author:
scheusso
Message:

added more bugfixing and debug output

Location:
code/branches/network/src/network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/network/GameStateManager.cc

    r891 r894  
    6565  }
    6666
    67   GameStateCompressed GameStateManager::popGameState(int clientID) {
     67  GameStateCompressed *GameStateManager::popGameState(int clientID) {
    6868    int gID = head_->findClient(clientID)->getGamestateID();
    6969    COUT(4) << "popgamestate: sending gstate id: " << id << "diffed from: " << gID << std::endl;
     
    7272      GameState *server = reference;
    7373      //head_->findClient(clientID)->setGamestateID(id);
    74       return *encode(client, server);
     74      return encode(client, server);
    7575    } else {
    7676      GameState *server = reference;
    7777      //head_->findClient(clientID)->setGamestateID(id);
    78       return *encode(server);
     78      return encode(server);
    7979      // return an undiffed gamestate and set appropriate flags
    8080    }
  • code/branches/network/src/network/GameStateManager.h

    r891 r894  
    4343    ~GameStateManager();
    4444    void update();
    45     GameStateCompressed popGameState(int clientID);
     45    GameStateCompressed *popGameState(int clientID);
    4646    void ackGameState(int clientID, int gamestateID);
    4747    int id;
  • code/branches/network/src/network/Server.cc

    r790 r894  
    134134    gamestates->update();
    135135    //std::cout << "updated gamestate, sending it" << std::endl;
    136     sendGameState();
     136    if(clients->getGamestateID()!=GAMESTATEID_INITIAL)
     137      sendGameState();
    137138    //std::cout << "sent gamestate" << std::endl;
    138139  }
     
    142143  */
    143144  bool Server::sendGameState() {
    144     std::cout << "starting gamestate" << std::endl;
     145    COUT(5) << "starting sendGameState" << std::endl;
    145146    ClientInformation *temp = clients;
    146147    bool added=false;
     
    159160      int cid = temp->getID();
    160161      std::cout << "server, got acked ID: " << gid << std::endl;
    161       GameStateCompressed *gs = &(gamestates->popGameState(cid)); // FIXME: taking address of temporary, check if correct
     162      GameStateCompressed *gs = gamestates->popGameState(cid);
     163      if(gs==NULL){
     164        COUT(2) << "could not generate gamestate" << std::endl;
     165        return false;
     166      }
    162167      //std::cout << "adding gamestate" << std::endl;
    163168      connection->addPacket(packet_gen.gstate(gs), cid);
     
    168173    if(added)
    169174      return connection->sendPackets();
    170     else
    171       return false;
     175    COUT(2) << "could not send packets (containing i.e. gamestates)" << std::endl;
     176    return false;
    172177  }
    173178
Note: See TracChangeset for help on using the changeset viewer.