Changeset 3084 for code/trunk/src/network/Client.cc
- Timestamp:
- May 26, 2009, 9:20:57 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/network/Client.cc
r2896 r3084 21 21 * 22 22 * Author: 23 * Oliver Scheuss , (C) 200723 * Oliver Scheuss 24 24 * Co-authors: 25 25 * ... … … 48 48 #include "core/CoreIncludes.h" 49 49 #include "packet/Packet.h" 50 #include "FunctionCallManager.h" 50 51 51 52 // #include "packet/Acknowledgement.h" … … 140 141 */ 141 142 void Client::update(const Clock& time){ 142 // COUT(3) << "."; 143 if(client_connection.isConnected() && isSynched_){ 144 COUT(4) << "popping partial gamestate: " << std::endl; 145 packet::Gamestate *gs = gamestate.getGamestate(); 146 if(gs){ 147 COUT(4) << "client tick: sending gs " << gs << std::endl; 148 if( !gs->send() ) 149 COUT(3) << "Problem adding partial gamestate to queue" << std::endl; 143 //this steers our network frequency 144 timeSinceLastUpdate_+=time.getDeltaTime(); 145 if(timeSinceLastUpdate_>=NETWORK_PERIOD){ 146 timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD; 147 // COUT(3) << "."; 148 if(client_connection.isConnected() && isSynched_){ 149 COUT(4) << "popping partial gamestate: " << std::endl; 150 packet::Gamestate *gs = gamestate.getGamestate(); 151 //assert(gs); <--- there might be the case that no data has to be sent, so its commented out now 152 if(gs){ 153 COUT(4) << "client tick: sending gs " << gs << std::endl; 154 if( !gs->send() ) 155 COUT(3) << "Problem adding partial gamestate to queue" << std::endl; 150 156 // gs gets automatically deleted by enet callback 157 } 158 FunctionCallManager::sendCalls(); 151 159 } 152 160 } 161 153 162 ENetEvent *event; 154 163 // stop if the packet queue is empty … … 167 176 } 168 177 gamestate.cleanup(); 178 169 179 return; 170 180 }
Note: See TracChangeset
for help on using the changeset viewer.