Changeset 10919 for code/branches/cpp11_v2/src/libraries/network/packet
- Timestamp:
- Dec 5, 2015, 10:47:51 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/libraries/network/packet
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/libraries/network/packet/ClassID.cc
r10769 r10919 55 55 56 56 //calculate total needed size (for all strings and integers) 57 std::map<std::string, Identifier*>::const_iterator it = IdentifierManager::getInstance().getIdentifierByStringMap().begin(); 58 for(;it != IdentifierManager::getInstance().getIdentifierByStringMap().end();++it){ 59 id = it->second; 57 for(const auto& mapEntry : IdentifierManager::getInstance().getIdentifierByStringMap()){ 58 id = mapEntry.second; 60 59 if(id == nullptr || !id->hasFactory()) 61 60 continue; -
code/branches/cpp11_v2/src/libraries/network/packet/Gamestate.cc
r10918 r10919 213 213 { 214 214 std::list<uint32_t> v1; 215 ObjectList<Synchronisable>::iterator it; 216 for (it = ObjectList<Synchronisable>::begin(); it != ObjectList<Synchronisable>::end(); ++it) 217 { 218 if (it->getObjectID() == OBJECTID_UNKNOWN) 219 { 220 if (it->objectMode_ != 0x0) 215 for (Synchronisable* synchronisable : ObjectList<Synchronisable>()) 216 { 217 if (synchronisable->getObjectID() == OBJECTID_UNKNOWN) 218 { 219 if (synchronisable->objectMode_ != 0x0) 221 220 { 222 221 orxout(user_error, context::packets) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << endl; 223 222 orxout(user_error, context::packets) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << endl; 224 orxout(user_error, context::packets) << "Objects class: " << it->getIdentifier()->getName() << endl;223 orxout(user_error, context::packets) << "Objects class: " << synchronisable->getIdentifier()->getName() << endl; 225 224 assert(false); 226 225 } … … 228 227 else 229 228 { 230 std::list<uint32_t>::iterator it2; 231 for (it2 = v1.begin(); it2 != v1.end(); ++it2) 229 for (uint32_t id : v1) 232 230 { 233 if ( it->getObjectID() == *it2)231 if (synchronisable->getObjectID() == id) 234 232 { 235 233 orxout(user_error, context::packets) << "Found duplicate objectIDs on the client!" << endl … … 239 237 } 240 238 } 241 v1.push_back( it->getObjectID());239 v1.push_back(synchronisable->getObjectID()); 242 240 } 243 241 } … … 762 760 uint32_t size = 0; 763 761 uint32_t nrOfVariables = 0; 764 // get the start of the Synchronisable list765 ObjectList<Synchronisable>::iterator it;766 762 // get total size of gamestate 767 for( it = ObjectList<Synchronisable>::begin(); it; ++it){768 size+= it->getSize(id, mode); // size of the actual data of the synchronisable769 nrOfVariables += it->getNrOfVariables();763 for(Synchronisable* synchronisable : ObjectList<Synchronisable>()){ 764 size+=synchronisable->getSize(id, mode); // size of the actual data of the synchronisable 765 nrOfVariables += synchronisable->getNrOfVariables(); 770 766 } 771 767 // orxout() << "allocating " << nrOfVariables << " ints" << endl; -
code/branches/cpp11_v2/src/libraries/network/packet/ServerInformation.h
r10857 r10919 50 50 void send( ENetPeer* peer ); 51 51 void setServerName(std::string name) { this->serverName_ = name; } 52 std::string getServerName() { return this->serverName_; }52 std::string getServerName() const { return this->serverName_; } 53 53 void setServerIP( std::string IP ) { this->serverIP_ = IP; } 54 std::string getServerIP() { return this->serverIP_; }54 std::string getServerIP() const { return this->serverIP_; } 55 55 void setClientNumber( int clientNumber ) { this->clientNumber_ = clientNumber; } 56 int getClientNumber() { return this->clientNumber_; }57 uint32_t getServerRTT() { return this->serverRTT_; }56 int getClientNumber() const { return this->clientNumber_; } 57 uint32_t getServerRTT() const { return this->serverRTT_; } 58 58 59 59 private:
Note: See TracChangeset
for help on using the changeset viewer.