![]() |
Important! :P Player Model Search bug fix
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 ) Code:
while ( (pFindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY ) ps you need to update two of these in the FindDirectory() function... (w00t) 8D |
Re: Important! :P Player Model Search bug fix
Thanks!
That's been marked to be put into the next HPB_bot update (if ever there is one...) :) |
Re: Important! :P Player Model Search bug fix
Quote:
It MAY work but this would be by-chance. dwFileAttributes is a bit mask and we are testing for the bit FILE_ATTRIBUTE_DIRECTORY, Thus we AND them but then TEST FOR 0 OR NON 0. if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) //code looking for files go here.. if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) // code looking for dirs go here.. >edit< Yup, yup, you guys are correct. Either way will work, but if you want to use positive logic you have to do it your way. |
Re: Important! :P Player Model Search bug fix
Actually Austin...
Code:
while ( (pFindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY ) Code:
while (!(pFindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) |
Re: Important! :P Player Model Search bug fix
Yup. When you use bitwise operators you don't get a boolean, you get the resulting bitmask. It just so happens that the resulting bit mask is also a number :P And if the one thing you were testing it against was found then it should equal the same thing.
|
All times are GMT +2. The time now is 10:12. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.