diff options
| author | Uneven Prankster <unevenprankster@protonmail.com> | 2023-08-12 13:32:39 -0300 |
|---|---|---|
| committer | Uneven Prankster <unevenprankster@protonmail.com> | 2023-08-12 13:32:39 -0300 |
| commit | 58c6022ebc22e88397f4ac85788b02dafa679b7d (patch) | |
| tree | f5069cb935b79ef71c04d0bec7742c28fcbed3b2 /src/texture_sys.c | |
| parent | e7379bed59af0f50126af61953bc4f10af04a4dd (diff) | |
Replaced checks with trap asserts, it's 2023, you can use gdb, we have technology
Diffstat (limited to 'src/texture_sys.c')
| -rw-r--r-- | src/texture_sys.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/texture_sys.c b/src/texture_sys.c index 3254d75..cb7f631 100644 --- a/src/texture_sys.c +++ b/src/texture_sys.c @@ -31,18 +31,14 @@ i32 load_new_tex(const char* path) } } //TODO: Handle slots a bit better. - if(current_idx == BLANK_DEFAULT) - TRACELOG(LOG_WARNING, "Warning: No more empty texture slots.\n"); + assert(current_idx != BLANK_DEFAULT); return current_idx; } void draw_texture(i32 idx, i32 x, i32 y) { - if(idx < 0 || idx >= MAX_TEX_SIZE){ - TRACELOG(LOG_WARNING,"Bounds check: Attempted to draw texture from non-existent index %i.\n", idx); - return; - } + assert(idx >= 0 && idx < MAX_TEX_SIZE); DrawTexture(texture_slots[idx], x, y, WHITE); } @@ -64,10 +60,7 @@ void update_textures(void) void unload_tex(i32 idx) { - if(idx < 0 || idx >= MAX_TEX_SIZE){ - TRACELOG(LOG_WARNING,"Bounds check: Attempted to unload texture from non-existent index %i.\n", idx); - return; - } + assert(idx >= 0 && idx < MAX_TEX_SIZE); UnloadTexture(texture_slots[idx]); texture_slots[idx] = (Texture2D){0}; texture_modtimes[idx] = BLANK_DEFAULT; |
