View Single Post
Important! :P Player Model Search bug fix
Old
  (#1)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Important! :P Player Model Search bug fix - 04-06-2004

Heya

I've been having trouble with my bots not adding ALL of the available player models to their list of available models to select.

I found a "bug" in the FindDirectory code of good ol' botman's directory searching I used from HPB_bot code.

The bug is that it kept skipping some directories with me, and did not work as expected.

this
Code:
      while ( pFindFileData.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY )
      {
         if (FindNextFile(hFile, &pFindFileData) == 0)
         {
            FindClose(hFile);
            hFile = NULL;
            return hFile;
         }	 
      }
should be this
Code:
      while ( (pFindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY )
      {
         if (FindNextFile(hFile, &pFindFileData) == 0)
         {
            FindClose(hFile);
            hFile = NULL;
            return hFile;
         }	 
      }
it didn't take into account that a directory could have several more flags set on it (e.g. Read only/Archived etc)

ps you need to update two of these in the FindDirectory() function...


() 8D

Last edited by Cheeseh; 04-06-2004 at 00:54.. Reason: bit more info..
  
Reply With Quote