Wednesday, August 13, 2008

Latest Updates

Some days I get loads of things done, some days I don't. Other days are weird, either I write loads of code with no real result, or I write very little code with a very good result to show for it. Today was one of the latter; the main thing I did was rewrite my file searcher function as a class, which really really cleaned up a lot of ugly code as well as removed certain (fairly high) hard limits I had on things.

I can now replace several hundred lines of code with something like this:

CFileSearcher *ListSearch = new CFileSearcher (path, mask);

while (1)
{
char *FoundList = ListSearch->GetFile ();
if (!FoundList) break;
Con_Printf ("%s\n", FoundList);
}

delete ListSearch;
Works with the full filesystem search paths, PAK files as well as the raw directory structure, cleans up after itself, and gives me a single place to debug. Very nice.

0 comments: