From 04a26fce0315ba6f9cf7d7d0d92cb14bbbfede62 Mon Sep 17 00:00:00 2001 From: MysterD Date: Fri, 24 Nov 2023 15:20:27 -0800 Subject: [PATCH] Fix toxbox movement --- src/game/object_helpers.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/game/object_helpers.c b/src/game/object_helpers.c index 8ca352ac..4e81a57f 100644 --- a/src/game/object_helpers.c +++ b/src/game/object_helpers.c @@ -2722,13 +2722,14 @@ s32 cur_obj_progress_direction_table(void) { if (!table) { return 0; } s32 tableLength = 0; - while (table[tableLength] != -1 && tableLength < 50) { + while (table[tableLength] != -1 && tableLength < 150) { tableLength++; } - if (tableLength >= 50 || index >= tableLength) { + if (tableLength < 0 || index < 0 || tableLength >= 150 || index >= tableLength) { ret = table[0]; o->oToxBoxMovementStep = 0; + LOG_ERROR("Exceeded direction table! tableLength %d, index %d\n", tableLength, index); } else if (table[index] != -1) { ret = table[index]; o->oToxBoxMovementStep++;