Changeset 1711 for code/branches/network/src/network/Client.cc
- Timestamp:
- Sep 5, 2008, 11:32:42 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/Client.cc
r1710 r1711 123 123 } 124 124 125 bool Client::sendChat(packet::Chat *chat){125 /*bool Client::sendChat(packet::Chat *chat){ 126 126 chat->process(); 127 127 packet::Packet *p = new packet::Packet(chat); 128 128 return p->send(); 129 } 129 }*/ 130 130 131 131 … … 139 139 if(!isConnected) 140 140 return false; 141 packet::Packet p(new packet::Chat(message, clientID_)); 142 return p.send(); 143 //return client_connection.sendPackets(); 141 packet::Chat chat(message, 0); 142 return chat.send(); 144 143 // send packets 145 144 } … … 155 154 if(gs){ 156 155 COUT(4) << "client tick: sending gs " << gs << std::endl; 157 packet::Packet packet(gs); 158 if( !packet.send() ) 156 if( !gs->send() ) 159 157 COUT(3) << "Problem adding partial gamestate to queue" << std::endl; 160 // now delete it to save memory 161 delete gs; 158 // gs gets automatically deleted by enet callback 162 159 } 163 160 } … … 167 164 event = client_connection.getEvent(); 168 165 COUT(5) << "tick packet size " << event->packet->dataLength << std::endl; 169 packet::Packet packet(event->packet, event->peer);170 assert(packet .getPacketContent()->process());166 packet::Packet *packet = packet::Packet::createPacket(event->packet, event->peer); 167 assert(packet->process()); 171 168 } 172 169 int gameStateID = gamestate.processGamestates(); … … 174 171 if(gameStateFailure_){ 175 172 packet::Acknowledgement ack(GAMESTATEID_INITIAL, 0); 176 packet::Packet packet(&ack); 177 if(!packet.send()) 173 if(!ack.send()) 178 174 COUT(3) << "could not (negatively) ack gamestate" << std::endl; 179 175 else … … 188 184 gameStateFailure_=false; 189 185 packet::Acknowledgement ack(gameStateID, 0); 190 packet::Packet packet(&ack); 191 if(!packet.send()) 186 if(!ack.send()) 192 187 COUT(3) << "could not ack gamestate" << std::endl; 193 188 }// otherwise we had no gamestate to load
Note: See TracChangeset
for help on using the changeset viewer.