Changeset 894
- Timestamp:
- Mar 13, 2008, 4:16:02 PM (17 years ago)
- Location:
- code/branches/network/src/network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/GameStateManager.cc
r891 r894 65 65 } 66 66 67 GameStateCompressed GameStateManager::popGameState(int clientID) {67 GameStateCompressed *GameStateManager::popGameState(int clientID) { 68 68 int gID = head_->findClient(clientID)->getGamestateID(); 69 69 COUT(4) << "popgamestate: sending gstate id: " << id << "diffed from: " << gID << std::endl; … … 72 72 GameState *server = reference; 73 73 //head_->findClient(clientID)->setGamestateID(id); 74 return *encode(client, server);74 return encode(client, server); 75 75 } else { 76 76 GameState *server = reference; 77 77 //head_->findClient(clientID)->setGamestateID(id); 78 return *encode(server);78 return encode(server); 79 79 // return an undiffed gamestate and set appropriate flags 80 80 } -
code/branches/network/src/network/GameStateManager.h
r891 r894 43 43 ~GameStateManager(); 44 44 void update(); 45 GameStateCompressed popGameState(int clientID);45 GameStateCompressed *popGameState(int clientID); 46 46 void ackGameState(int clientID, int gamestateID); 47 47 int id; -
code/branches/network/src/network/Server.cc
r790 r894 134 134 gamestates->update(); 135 135 //std::cout << "updated gamestate, sending it" << std::endl; 136 sendGameState(); 136 if(clients->getGamestateID()!=GAMESTATEID_INITIAL) 137 sendGameState(); 137 138 //std::cout << "sent gamestate" << std::endl; 138 139 } … … 142 143 */ 143 144 bool Server::sendGameState() { 144 std::cout << "starting gamestate" << std::endl;145 COUT(5) << "starting sendGameState" << std::endl; 145 146 ClientInformation *temp = clients; 146 147 bool added=false; … … 159 160 int cid = temp->getID(); 160 161 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 } 162 167 //std::cout << "adding gamestate" << std::endl; 163 168 connection->addPacket(packet_gen.gstate(gs), cid); … … 168 173 if(added) 169 174 return connection->sendPackets(); 170 else171 175 COUT(2) << "could not send packets (containing i.e. gamestates)" << std::endl; 176 return false; 172 177 } 173 178
Note: See TracChangeset
for help on using the changeset viewer.