From 7f90f66bfc80d4fa680451d6df27a121a72fcde6 Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 14 Jan 2009 16:08:57 +0000 Subject: [PATCH] Strip all extensions before trying to add new ones to image file names. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3097 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/image.c | 2 +- engine/common/common.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/engine/client/image.c b/engine/client/image.c index 75068fda7..37b52d660 100644 --- a/engine/client/image.c +++ b/engine/client/image.c @@ -1973,7 +1973,7 @@ int Mod_LoadHiResTexture(char *name, char *subpath, qboolean mipmap, qboolean al int i, e; - COM_StripExtension(name, nicename, sizeof(nicename)); + COM_StripAllExtensions(name, nicename, sizeof(nicename)); while((data = strchr(nicename, '*'))) { diff --git a/engine/common/common.c b/engine/common/common.c index 11ab0c66e..7f71bff5f 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -1469,6 +1469,26 @@ void COM_StripExtension (char *in, char *out, int outlen) } } +void COM_StripAllExtensions (char *in, char *out, int outlen) +{ + char *s; + + if (out != in) + Q_strncpyz(out, in, outlen); + + s = out+strlen(out); + + while(*s != '/' && s != out) + { + if (*s == '.') + { + *s = 0; + } + + s--; + } +} + /* ============ COM_FileExtension