Changeset 3301 for code/trunk/src/network
- Timestamp:
- Jul 18, 2009, 4:03:59 PM (16 years ago)
- Location:
- code/trunk/src/network
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/network/ClientInformation.cc
r3214 r3301 166 166 167 167 double ClientInformation::getPacketLoss(){ 168 return ((double)this->peer_->packetLoss)/ENET_PEER_PACKET_LOSS_SCALE;168 return static_cast<double>(this->peer_->packetLoss)/ENET_PEER_PACKET_LOSS_SCALE; 169 169 } 170 170 … … 173 173 return gamestateID_; 174 174 else 175 return (unsigned int)-1;175 return static_cast<unsigned int>(-1); 176 176 } 177 177 … … 180 180 return partialGamestateID_; 181 181 else 182 return (unsigned int)-1;182 return static_cast<unsigned int>(-1); 183 183 } 184 184 … … 197 197 198 198 bool ClientInformation::removeClient(unsigned int clientID) { 199 if( (unsigned int)clientID==CLIENTID_UNKNOWN)199 if(clientID==CLIENTID_UNKNOWN) 200 200 return false; 201 201 ClientInformation *temp = head_; -
code/trunk/src/network/GamestateClient.h
r3214 r3301 47 47 #include "GamestateHandler.h" 48 48 49 const unsigned int GAMESTATEID_INITIAL = (unsigned int)-1;49 const unsigned int GAMESTATEID_INITIAL = static_cast<unsigned int>(-1); 50 50 51 51 namespace orxonox -
code/trunk/src/network/GamestateManager.cc
r3214 r3301 174 174 } 175 175 176 assert(curid== (unsigned int)GAMESTATEID_INITIAL || curid<gamestateID);176 assert(curid==GAMESTATEID_INITIAL || curid<gamestateID); 177 177 COUT(4) << "acking gamestate " << gamestateID << " for clientid: " << clientID << " curid: " << curid << std::endl; 178 178 std::map<unsigned int, packet::Gamestate*>::iterator it; -
code/trunk/src/network/NetworkPrereqs.h
r3280 r3301 61 61 namespace orxonox 62 62 { 63 static const unsigned int GAMESTATEID_INITIAL = (unsigned int)-1;64 static const unsigned int CLIENTID_UNKNOWN = (unsigned int)-2;65 static const uint32_t OBJECTID_UNKNOWN = (uint32_t)(-1);63 static const unsigned int GAMESTATEID_INITIAL = static_cast<unsigned int>(-1); 64 static const unsigned int CLIENTID_UNKNOWN = static_cast<unsigned int>(-2); 65 static const uint32_t OBJECTID_UNKNOWN = static_cast<uint32_t>(-1); 66 66 } 67 67 -
code/trunk/src/network/TrafficControl.cc
r3214 r3301 38 38 namespace orxonox { 39 39 40 static const unsigned int SCHED_PRIORITY_OFFSET = (unsigned int)-1;40 static const unsigned int SCHED_PRIORITY_OFFSET = static_cast<unsigned int>(-1); 41 41 42 42 objInfo::objInfo(uint32_t ID, uint32_t creatorID, int32_t curGsID, int32_t diffGsID, uint32_t size, unsigned int prioperm, unsigned int priosched) -
code/trunk/src/network/packet/Chat.cc
r3280 r3301 51 51 *(unsigned int *)(data_ + _PLAYERID ) = playerID; 52 52 *(unsigned int *)(data_ + _MESSAGELENGTH ) = messageLength_; 53 memcpy( data_+_MESSAGE, (void *)message.c_str(), messageLength_ );53 memcpy( data_+_MESSAGE, static_cast<void*>(const_cast<char*>(message.c_str())), messageLength_ ); 54 54 } 55 55 -
code/trunk/src/network/packet/Packet.cc
r3280 r3301 143 143 // Assures we don't create a packet and destroy it right after in another thread 144 144 // without having a reference in the packetMap_ 145 packetMap_[ (size_t)(void*)enetPacket_] = this;145 packetMap_[reinterpret_cast<size_t>(enetPacket_)] = this; 146 146 } 147 147 } … … 172 172 Packet *Packet::createPacket(ENetPacket *packet, ENetPeer *peer){ 173 173 uint8_t *data = packet->data; 174 assert(ClientInformation::findClient(&peer->address)->getID() != (unsigned int)-2|| !Host::isServer());174 assert(ClientInformation::findClient(&peer->address)->getID() != static_cast<unsigned int>(-2) || !Host::isServer()); 175 175 unsigned int clientID = ClientInformation::findClient(&peer->address)->getID(); 176 176 Packet *p = 0; … … 230 230 void Packet::deletePacket(ENetPacket *enetPacket){ 231 231 // Get our Packet from a gloabal map with all Packets created in the send() method of Packet. 232 std::map<size_t, Packet*>::iterator it = packetMap_.find( (size_t)enetPacket);232 std::map<size_t, Packet*>::iterator it = packetMap_.find(reinterpret_cast<size_t>(enetPacket)); 233 233 assert(it != packetMap_.end()); 234 234 // Make sure we don't delete it again in the destructor -
code/trunk/src/network/synchronisable/Synchronisable.h
r3280 r3301 44 44 45 45 /*#define REGISTERDATA(varname, ...) \ 46 registerVariable( (void*)&varname, sizeof(varname), DATA, __VA_ARGS__)46 registerVariable(static_cast<void*>(&varname), sizeof(varname), DATA, __VA_ARGS__) 47 47 #define REGISTERSTRING(stringname, ...) \ 48 48 registerVariable(&stringname, stringname.length()+1, STRING, __VA_ARGS__)*/ -
code/trunk/src/network/synchronisable/SynchronisableVariable.h
r3280 r3301 36 36 #include <cstring> 37 37 #include "util/Serialise.h" 38 #include "util/TemplateUtils.h" 38 39 #include "core/GameMode.h" 39 40 #include "network/synchronisable/NetworkCallbackManager.h" … … 78 79 virtual inline void putData(uint8_t*& mem, uint8_t mode, bool forceCallback = false); 79 80 virtual inline uint32_t getSize(uint8_t mode); 80 virtual inline void* getReference(){ return (void *)&this->variable_; }81 virtual inline void* getReference(){ return static_cast<void*>(const_cast<typename TypeStripper<T>::RawType*>(&this->variable_)); } 81 82 protected: 82 83 … … 178 179 { 179 180 this->varReference_++; 180 memcpy( (void*)&this->varBuffer_, &this->variable_, sizeof(this->variable_));181 memcpy(static_cast<void*>(const_cast<typename TypeStripper<T>::RawType*>(&this->varBuffer_)), &this->variable_, sizeof(this->variable_)); 181 182 } 182 183 } … … 211 212 { 212 213 mem += sizeof(varReference_); 213 memcpy( (void*)&this->varBuffer_, &this->variable_, sizeof(T));214 memcpy(static_cast<void*>(const_cast<typename TypeStripper<T>::RawType*>(&this->varBuffer_)), &this->variable_, sizeof(T)); 214 215 if ( this->callback_ != 0 ) 215 216 callback = true;
Note: See TracChangeset
for help on using the changeset viewer.