diff options
author | Thilo Schulz <arny@ats.s.bawue.de> | 2011-05-02 15:53:20 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-09 20:50:35 +0000 |
commit | 37f94685f3c64f9b2578049796cf8ccf75c83bad (patch) | |
tree | aea1f5a1721724d713687313437ffa9f4da8b5cd | |
parent | 5d081049e208bfb983a850b8e0b83711c74d75ca (diff) |
Do not retry image loader for image that failed, patch by Zack Middleton (#4968)
-rw-r--r-- | src/renderer/tr_image.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/renderer/tr_image.c b/src/renderer/tr_image.c index 1fa8042d..c40add48 100644 --- a/src/renderer/tr_image.c +++ b/src/renderer/tr_image.c @@ -861,8 +861,7 @@ static imageExtToLoaderMap_t imageLoaders[ ] = { "bmp", R_LoadBMP } }; -static int numImageLoaders = sizeof( imageLoaders ) / - sizeof( imageLoaders[ 0 ] ); +static int numImageLoaders = ARRAY_LEN( imageLoaders ); /* ================= @@ -875,9 +874,11 @@ Loads any of the supported image types into a cannonical void R_LoadImage( const char *name, byte **pic, int *width, int *height ) { qboolean orgNameFailed = qfalse; + int orgLoader = -1; int i; char localName[ MAX_QPATH ]; const char *ext; + char *altName; *pic = NULL; *width = 0; @@ -908,6 +909,7 @@ void R_LoadImage( const char *name, byte **pic, int *width, int *height ) // Loader failed, most likely because the file isn't there; // try again without the extension orgNameFailed = qtrue; + orgLoader = i; COM_StripExtension( name, localName, MAX_QPATH ); } else @@ -922,7 +924,10 @@ void R_LoadImage( const char *name, byte **pic, int *width, int *height ) // the image formats supported for( i = 0; i < numImageLoaders; i++ ) { - char *altName = va( "%s.%s", localName, imageLoaders[ i ].ext ); + if (i == orgLoader) + continue; + + altName = va( "%s.%s", localName, imageLoaders[ i ].ext ); // Load imageLoaders[ i ].ImageLoader( altName, pic, width, height ); |