Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2015, 7:05:53 PM (8 years ago)
Author:
muemart
Message:

Run clang-modernize -loop-convert

  • Again, not all possible loops were converted
  • It can do pretty cool transformations, but I had to fix a few compile errors, so there might be some runtime errors lurking around too
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/network/Host.cc

    r10768 r10821  
    8080  void Host::addPacket(ENetPacket *packet, int clientID, uint8_t channelID)
    8181  {
    82     for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
     82    for(auto & instances_ : instances_s)
    8383    {
    84       if( (*it)->isActive() )
     84      if( (instances_)->isActive() )
    8585      {
    86         (*it)->queuePacket(packet, clientID, channelID);
     86        (instances_)->queuePacket(packet, clientID, channelID);
    8787      }
    8888    }
     
    9797  void Host::sendChat(const std::string& message, unsigned int sourceID, unsigned int targetID)
    9898  {
    99     for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
    100       if( (*it)->isActive() )
    101         (*it)->doSendChat(message, sourceID, targetID);
     99    for(auto & instances_ : instances_s)
     100      if( (instances_)->isActive() )
     101        (instances_)->doSendChat(message, sourceID, targetID);
    102102  }
    103103
     
    114114  bool Host::isServer()
    115115  {
    116     for (std::vector<Host*>::iterator it=instances_s.begin(); it!=instances_s.end(); ++it )
     116    for (auto & instances_ : instances_s)
    117117    {
    118       if( (*it)->isActive() )
     118      if( (instances_)->isActive() )
    119119      {
    120         if( (*it)->isServer_() )
     120        if( (instances_)->isServer_() )
    121121          return true;
    122122      }
Note: See TracChangeset for help on using the changeset viewer.