stoneharry

Untitled

Apr 22nd, 2012
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1.  
  2. Patch * PatchMgr::FindPatchForClient(uint32 Version, const char * Locality)
  3. {
  4.     Log.Debug("Patch", "Called");
  5.     char tmplocality[5];
  6.     uint32 ulocality;
  7.     uint32 i;
  8.     vector<Patch*>::iterator itr;
  9.     Patch * fallbackPatch = NULL;
  10.     for(i = 0; i < 4; ++i)
  11.         tmplocality[i]= static_cast<char>( tolower(Locality[i]) );
  12.     tmplocality[4]= 0;
  13.     ulocality = *(uint32*)tmplocality;
  14.     for(itr = m_patches.begin(); itr != m_patches.end(); ++itr)
  15.     {
  16.         // since localities are always 4 bytes we can do a simple int compare,
  17.         // saving a string compare ;)
  18.         Log.Debug("Patch", "Stuff %s", (*itr)->Version, (*itr)->uLocality);
  19.         if((*itr)->uLocality==ulocality)
  20.         {
  21.             if(fallbackPatch== NULL && (*itr)->Version== 0)
  22.                 fallbackPatch = (*itr);
  23.            
  24.             if((*itr)->Version == Version)
  25.                 return (*itr);
  26.         }
  27.     }
  28.  
  29.     return fallbackPatch;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment