From 1b14dff0e9cb7cea73866a4a6abf51927d507606 Mon Sep 17 00:00:00 2001 From: ashifolfi Date: Sun, 20 Nov 2022 16:06:47 -0500 Subject: [PATCH] add comments + better checktexturename if statement --- src/r_textures.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/r_textures.c b/src/r_textures.c index 2a9fc9953..34b2f0637 100644 --- a/src/r_textures.c +++ b/src/r_textures.c @@ -1662,21 +1662,30 @@ INT32 R_CheckTextureNumForName(const char *name) return -1; } -// i was fully expecting this to take like an hour to figure out not 2 mintues and 5 lines of c - ashi +// +// R_CheckTextureNameForNum +// +// because sidedefs use numbers and sometimes you want names +// returns no texture marker if no texture was found +// const char *R_CheckTextureNameForNum(INT32 num) { - if (textures[num] && textures[num]->name) - { + if (num > 0 && num < numtextures) return textures[num]->name; - } + return "-"; } +// +// R_TextureNameForNum +// +// calls R_CheckTextureNameForNum and returns REDWALL if result is a no texture marker +// const char *R_TextureNameForNum(INT32 num) { const char *result = R_CheckTextureNameForNum(num); - if (strcmp(result, "-")) + if (strcmp(result, "-") == 0) return "REDWALL"; return result;