]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
fixing last commit :P
authordivverent <divverent@61c419a2-8eb2-4b30-bcec-8cead039b335>
Sun, 24 May 2009 18:43:09 +0000 (18:43 +0000)
committerdivverent <divverent@61c419a2-8eb2-4b30-bcec-8cead039b335>
Sun, 24 May 2009 18:43:09 +0000 (18:43 +0000)
git-svn-id: svn://svn.icculus.org/netradiant/trunk@378 61c419a2-8eb2-4b30-bcec-8cead039b335

radiant/texwindow.cpp

index 6070f8db3cc71f94238e648a149c6881406a7dbf..c0f2eab6f620216098342ead25cb623479619fed 100644 (file)
@@ -685,24 +685,34 @@ NOTE: for texture window layout:
   ( the GL textures are not flushed though)
 ==============
 */
+
+bool endswith(const char *haystack, const char *needle)
+{
+       size_t lh = strlen(haystack);
+       size_t ln = strlen(needle);
+       if(lh < ln)
+               return false;
+       return !memcmp(haystack + (lh - ln), needle, ln);
+}
+
 bool texture_name_ignore(const char* name)
 {
   StringOutputStream strTemp(string_length(name));
   strTemp << LowerCase(name);
 
   return
-         strstr(strTemp.c_str(), ".specular.") != 0 ||
-         strstr(strTemp.c_str(), ".glow.") != 0 ||
-         strstr(strTemp.c_str(), ".bump.") != 0 ||
-         strstr(strTemp.c_str(), ".diffuse.") != 0 ||
-         strstr(strTemp.c_str(), ".blend.") != 0 ||
-         strstr(strTemp.c_str(), ".alpha.") != 0 ||
-         strstr(strTemp.c_str(), "_norm.") != 0 ||
-         strstr(strTemp.c_str(), "_bump.") != 0 ||
-         strstr(strTemp.c_str(), "_glow.") != 0 ||
-         strstr(strTemp.c_str(), "_gloss.") != 0 ||
-         strstr(strTemp.c_str(), "_pants.") != 0 ||
-         strstr(strTemp.c_str(), "_shirt.") != 0 ||
+         endswith(strTemp.c_str(), ".specular") ||
+         endswith(strTemp.c_str(), ".glow") ||
+         endswith(strTemp.c_str(), ".bump") ||
+         endswith(strTemp.c_str(), ".diffuse") ||
+         endswith(strTemp.c_str(), ".blend") ||
+         endswith(strTemp.c_str(), ".alpha") ||
+         endswith(strTemp.c_str(), "_norm") ||
+         endswith(strTemp.c_str(), "_bump") ||
+         endswith(strTemp.c_str(), "_glow") ||
+         endswith(strTemp.c_str(), "_gloss") ||
+         endswith(strTemp.c_str(), "_pants") ||
+         endswith(strTemp.c_str(), "_shirt") ||
          0;
 }