]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Better and correct filtering, now really only JPG files are shown
authorterencehill <piuntn@gmail.com>
Sun, 8 Aug 2010 19:43:26 +0000 (21:43 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 8 Aug 2010 19:43:26 +0000 (21:43 +0200)
NOTE: this is true only if the engine is patched with my bugfix on match_pattern

Next step is to show TGAs too and one day maybe PNGs too.
PNGs for now are off-limits as _the engine crashes_ opening them!

qcsrc/menu/xonotic/screenshotlist.c

index 1a3907e3e0333bb73fd7bdf62c7322a3a1df4558..175f6149a2eb8079b48298af9f844a9518e72fd1 100644 (file)
@@ -60,7 +60,7 @@ void XonoticScreenshotList_getScreenshots(entity me)
 
        if(me.filterString)
                //subdirectory in filterString allowed  
-               s=strcat("screenshots/*", me.filterString, "*.jpg");
+               s=strcat("screenshots/", me.filterString, ".jpg");
        else
                s="screenshots/*.jpg";
 
@@ -114,7 +114,12 @@ void ScreenshotList_Filter_Change(entity box, entity me)
                strunzone(me.filterString);
 
        if(box.text != "")
-               me.filterString = strzone(box.text);
+       {
+               if (strstrofs(box.text, "*", 0) >= 0 || strstrofs(box.text, "?", 0) >= 0)
+                       me.filterString = strzone(box.text);
+               else
+                       me.filterString = strzone(strcat("*", box.text, "*"));
+       }
        else
                me.filterString = string_null;