From 58c6022ebc22e88397f4ac85788b02dafa679b7d Mon Sep 17 00:00:00 2001 From: Uneven Prankster Date: Sat, 12 Aug 2023 13:32:39 -0300 Subject: Replaced checks with trap asserts, it's 2023, you can use gdb, we have technology --- src/shader_sys.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/shader_sys.c') diff --git a/src/shader_sys.c b/src/shader_sys.c index 2686f5f..d19e64b 100644 --- a/src/shader_sys.c +++ b/src/shader_sys.c @@ -111,18 +111,15 @@ i32 load_new_shader(const char* path) } } //TODO: Handle slots a bit better. - if(current_idx == BLANK_DEFAULT) - TRACELOG(LOG_WARNING, "Warning: No more empty shader slots.\n"); + assert(current_idx != BLANK_DEFAULT); return current_idx; } void set_active_shader(i32 idx) { - if(idx < 0 || idx >= MAX_SHADER_SIZE) - TRACELOG(LOG_WARNING,"Bounds check: Attempted to set shader at non-existent index %i.\n", idx); - else - BeginShaderMode(shader_slots[idx]); + assert(idx >= 0 && idx < MAX_SHADER_SIZE); + BeginShaderMode(shader_slots[idx]); } void update_shaders(void) @@ -148,10 +145,7 @@ void reset_active_shader(void) void unload_shader(i32 idx) { - if(idx < 0 || idx >= MAX_SHADER_SIZE){ - TRACELOG(LOG_WARNING,"Bounds check: Attempted to unload shader at non-existent index %i.\n", idx); - return; - } + assert(idx >= 0 && idx < MAX_SHADER_SIZE); UnloadShader(shader_slots[idx]); shader_slots[idx] = (Shader){0}; -- cgit v1.2.3