Changeset 1710
- Timestamp:
- Sep 5, 2008, 12:27:37 PM (16 years ago)
- Location:
- code/branches/network/src/network
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/Client.cc
r1705 r1710 155 155 if(gs){ 156 156 COUT(4) << "client tick: sending gs " << gs << std::endl; 157 packet::Packet p (gs);158 if( !p .send() )157 packet::Packet packet(gs); 158 if( !packet.send() ) 159 159 COUT(3) << "Problem adding partial gamestate to queue" << std::endl; 160 160 // now delete it to save memory … … 173 173 if(gameStateID==GAMESTATEID_INITIAL) 174 174 if(gameStateFailure_){ 175 packet::Packet packet(new packet::Acknowledgement(GAMESTATEID_INITIAL, 0)); 175 packet::Acknowledgement ack(GAMESTATEID_INITIAL, 0); 176 packet::Packet packet(&ack); 176 177 if(!packet.send()) 177 178 COUT(3) << "could not (negatively) ack gamestate" << std::endl; … … 186 187 isSynched_=true; 187 188 gameStateFailure_=false; 188 packet::Packet packet(new packet::Acknowledgement(gameStateID, 0)); 189 packet::Acknowledgement ack(gameStateID, 0); 190 packet::Packet packet(&ack); 189 191 if(!packet.send()) 190 192 COUT(3) << "could not ack gamestate" << std::endl; -
code/branches/network/src/network/ConnectionManager.cc
r1705 r1710 360 360 ++it; 361 361 } 362 packet.setPacketContent(0);363 362 //sendPackets(); 364 363 COUT(4) << "syncClassid:\tall synchClassID packets have been sent" << std::endl; -
code/branches/network/src/network/GamestateHandler.h
r1706 r1710 52 52 53 53 public: 54 static bool addGamestate(packet::Gamestate *gs, int clientID){ return instance_->add Gamestate(gs, clientID); }54 static bool addGamestate(packet::Gamestate *gs, int clientID){ return instance_->add(gs, clientID); } 55 55 static bool ackGamestate(int gamestateID, int clientID){ return instance_->ack(gamestateID, clientID); } 56 56 }; -
code/branches/network/src/network/Server.cc
r1709 r1710 121 121 if(!pkt->send()) 122 122 COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl; 123 delete pkt; 123 124 } 124 125 return message->process(); … … 140 141 COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl; 141 142 } 142 return chat->process(); 143 return chat->process();; 143 144 } 144 145 … … 269 270 added=true; 270 271 temp=temp->next(); 271 // now delete gamestate272 272 delete gs; 273 273 } … … 323 323 temp->setSynched(true); 324 324 COUT(3) << "sending welcome" << std::endl; 325 packet::Packet packet(new packet::Welcome(temp->getID(), temp->getShipID())); 325 packet::Welcome *w = new packet::Welcome(temp->getID(), temp->getShipID()); 326 packet::Packet packet(w); 326 327 assert(packet.send()); 328 delete w; 327 329 return true; 328 330 } -
code/branches/network/src/network/packet/Gamestate.cc
r1705 r1710 80 80 81 81 //start write gamestate header 82 HEADER->packetType = ENUM::Gamestate; 82 83 HEADER->normsize = currentsize; 83 84 HEADER->id = id; -
code/branches/network/src/network/packet/Gamestate.h
r1705 r1710 28 28 29 29 #include "PacketContent.h" 30 #include "Packet.h" 30 31 #include "network/Synchronisable.h" 31 32 //#include "util/Bytestream.h" … … 40 41 41 42 struct GamestateHeader{ 43 ENUM::Type packetType; 42 44 int id; // id of the gamestate 43 45 unsigned int compsize; -
code/branches/network/src/network/packet/Packet.cc
r1709 r1710 41 41 packetContent_ = createPacketContent(packet); 42 42 enet_packet_destroy(packet); 43 delete peer;44 43 } 45 44 46 45 Packet::~Packet(){ 47 if(packetContent_)48 delete packetContent_;49 46 if(enetPacket_){ 50 47 enet_packet_destroy(enetPacket_); … … 66 63 if(!packetContent_) 67 64 return false; 68 COUT(3) << "creating packet with data: " << packetContent_->getData() << " size: " << packetContent_->getSize() << " and flags: " << packetContent_->getFlags() << std::endl;69 65 enetPacket_ = enet_packet_create(packetContent_->getData(), packetContent_->getSize(), packetContent_->getFlags()); 70 66 } … … 92 88 break; 93 89 default: 94 assert(0); 90 assert(0); //TODO: repair this 91 break; 95 92 } 96 93 return packetContent_;
Note: See TracChangeset
for help on using the changeset viewer.