From ffd423331a3cf543a537fa8e3e3adcd7d6c0e145 Mon Sep 17 00:00:00 2001 From: Quinn Date: Thu, 3 Jul 2025 09:49:19 +0200 Subject: [PATCH] add error handling for debugging when id is invalid with shape acquisition --- src/game/tetromino/shapes.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/game/tetromino/shapes.c b/src/game/tetromino/shapes.c index 750ecd8..2286512 100644 --- a/src/game/tetromino/shapes.c +++ b/src/game/tetromino/shapes.c @@ -3,6 +3,7 @@ #include "../../io/colour/colour8.h" #include "../../util/types.h" #include "../../util/vec.h" +#include "../../error.h" void shape_getblocks(u8 id, i8vec2* restrict out) { struct blockdat { @@ -54,6 +55,12 @@ void shape_getblocks(u8 id, i8vec2* restrict out) { case TETROMINO_J | TETROMINO_ROTATED_90: dat = (struct blockdat){0, 0, 0, 1, 1, 1, 2, 1}; break; case TETROMINO_J | TETROMINO_ROTATED_180: dat = (struct blockdat){1, 0, 2, 0, 1, 1, 1, 2}; break; case TETROMINO_J | TETROMINO_ROTATED_270: dat = (struct blockdat){0, 1, 1, 1, 2, 1, 2, 2}; break; + + default: +#ifndef NDEBUG + fatal(1, "something went wrong; couldn't reconise the ID.", ); +#endif + break; } out[0] = (i8vec2){dat.ax, dat.ay};