From 79b1628dd8d738e06c8ae8a43454cfc381a40541 Mon Sep 17 00:00:00 2001 From: Prince Frizzy Date: Wed, 29 Mar 2023 06:05:06 -0400 Subject: [PATCH] Fix iteration of players for paintings. Causes undefined behavior otherwise. (#333) --- src/game/paintings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/paintings.c b/src/game/paintings.c index 56ba219d..4d863b21 100644 --- a/src/game/paintings.c +++ b/src/game/paintings.c @@ -839,7 +839,7 @@ void painting_update_floors(struct Painting *painting) { painting->ripples.enteredMarioIndex = -1; painting->ripples.underMarioIndex = -1; - for (int i = 0; i < MAX_PLAYERS + 1; i++) { + for (int i = 0; i < MAX_PLAYERS; i++) { // If the painting was entered (and not a floor painting) no need to look at everyone else this frame if (painting->floorEntered && !floorPainting) { continue; } struct MarioState* m = &gMarioStates[i];