From ba7338b599d39440f2378ffed523b7e927e092f4 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Mon, 5 Sep 2011 19:02:23 +0200 Subject: [PATCH] it FINALLY works right! --- radiant/texwindow.cpp | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 5438cece..19bbc115 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -139,7 +139,7 @@ namespace else { if(s) - s[1] = 0; + s[0] = 0; else n[0] = 0; } @@ -149,6 +149,13 @@ namespace } CopiedString Texture_getCategoryDirectory(const char *cat) { + if(!softGroups()) + { + StringOutputStream o(64); + if(string_length(cat)) + o << cat << "/"; + return o.c_str(); + } char *n = string_clone(cat); int l = string_length(n); if(l == 0) @@ -156,27 +163,13 @@ namespace string_release(n, l); return ""; } - if(cat[l-1] == '/') - { - string_release(n, l); - return cat; - } CopiedString cs; - if(softGroups()) - { - char *p = strrchr(n, '/'); - if(p) - cs = StringRange(n, p+1); - else - cs = ""; - string_release(n, l); - } + char *p = strrchr(n, '/'); + if(p) + cs = StringRange(n, p+1); else - { - globalErrorStream() << "category name " << cat << " doesn't end with slash?\n"; cs = ""; - string_release(n, l); - } + string_release(n, l); return cs; } bool Texture_matchCategory(const char *matchcat, const char *texcat) @@ -195,6 +188,7 @@ namespace void TextureGroups_addShader(TextureGroups& groups, const char* shaderName) { const char* texture = path_make_relative(shaderName, "textures/"); + globalErrorStream() << texture << "\n"; if(texture != shaderName) { CopiedString n = Texture_getCategoryByName(texture); @@ -239,9 +233,7 @@ void TextureGroups_addDirectory(TextureGroups& groups, const char* directory) } else { - StringOutputStream dirstring(64); - dirstring << directory << "/"; - groups.insert(dirstring.c_str()); + groups.insert(directory); } } typedef ReferenceCaller1 TextureGroupsAddDirectoryCaller; -- 2.39.2