Changeset 8858 for code/trunk/src/libraries/network/Client.cc
- Timestamp:
- Aug 23, 2011, 12:45:53 AM (13 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:ignore
-
old new 1 1 build 2 2 codeblocks 3 vs 3 4 dependencies
-
- Property svn:mergeinfo changed
/code/branches/output (added) merged: 8739-8740,8765,8771-8772,8774-8780,8787-8789,8794-8799,8801,8803-8812,8814,8816-8817,8820,8822,8825-8837,8840,8844,8846,8848-8850,8853-8854
- Property svn:ignore
-
code/trunk/src/libraries/network/Client.cc
r8327 r8858 44 44 45 45 #include "util/Clock.h" 46 #include "util/ Debug.h"46 #include "util/Output.h" 47 47 #include "util/ScopedSingletonManager.h" 48 48 #include "synchronisable/Synchronisable.h" … … 116 116 } 117 117 118 bool Client::processChat(const std::string& message, unsigned int playerID)119 {120 // COUT(1) << "Player " << playerID << ": " << message << std::endl;121 return true;122 }123 124 118 void Client::printRTT() 125 119 { 126 COUT(0) << "Round trip time to server is " << ClientConnection::getRTT() << " ms" << endl;127 } 128 129 /** 130 * This function implements the method of sending a chat message to the server120 orxout(message) << "Round trip time to server is " << ClientConnection::getRTT() << " ms" << endl; 121 } 122 123 /** 124 * @brief Sends a chat message to the server. 131 125 * @param message message to be sent 132 * @return result(true/false) 126 * @param sourceID the ID of the sender 127 * @param targetID the ID of the receiver 133 128 */ 134 bool Client::chat(const std::string& message) 135 { 136 packet::Chat *m = new packet::Chat(message, Host::getPlayerID()); 137 return m->send(static_cast<Host*>(this)); 138 } 139 129 void Client::doSendChat(const std::string& message, unsigned int sourceID, unsigned int targetID) 130 { 131 // send the message to the server 132 packet::Chat* packet = new packet::Chat(message, sourceID, targetID); 133 packet->send(static_cast<Host*>(this)); 134 } 135 136 /** 137 * @brief Gets called if a packet::Chat packet is received. Calls the parent function which passes the message to the listeners. 138 */ 139 void Client::doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID) 140 { 141 // call the parent function which passes the message to the listeners 142 Host::doReceiveChat(message, sourceID, targetID); 143 } 140 144 141 145 /** … … 150 154 { 151 155 timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD; 152 // COUT(3) << '.';153 156 if ( isConnected() && isSynched_ ) 154 157 { 155 COUT(4) << "popping partial gamestate: " << std::endl;158 orxout(verbose, context::network) << "popping partial gamestate: " << endl; 156 159 // packet::Gamestate *gs = GamestateClient::getGamestate(); 157 160 if( GamestateManager::update() ) … … 166 169 //assert(gs); <--- there might be the case that no data has to be sent, so its commented out now 167 170 // if(gs){ 168 // COUT(4) << "client tick: sending gs " << gs << std::endl;171 // orxout(verbose, context::network) << "client tick: sending gs " << gs << endl; 169 172 // if( !gs->send() ) 170 // COUT(2) << "Problem adding partial gamestate to queue" << std::endl;173 // orxout(internal_warning, context::network) << "Problem adding partial gamestate to queue" << endl; 171 174 // // gs gets automatically deleted by enet callback 172 175 // } … … 204 207 Game::getInstance().popState(); 205 208 } 206 209 207 210 void Client::processPacket(packet::Packet* packet) 208 211 { … … 217 220 packet->process(static_cast<Host*>(this)); 218 221 } 219 220 221 222 223 222 }
Note: See TracChangeset
for help on using the changeset viewer.