From 6aea8859fe2ba9ee57980c2b246b038e33c5ccf8 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 8 May 2023 17:46:25 +0100 Subject: [PATCH] G_MapIntoRoundQueue: Fix infinite loop if Cup has more bonus stages than regular stages --- src/g_game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index c88cca879..2047262e1 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4066,7 +4066,7 @@ void G_MapIntoRoundQueue(UINT16 map, UINT8 setgametype, boolean setencore, boole void G_GPCupIntoRoundQueue(cupheader_t *cup, UINT8 setgametype, boolean setencore) { UINT8 i, levelindex = 0, bonusindex = 0; - UINT8 bonusmodulo = (cup->numlevels+1)/(cup->numbonus+1); + UINT8 bonusmodulo = max(1, (cup->numlevels+1)/(cup->numbonus+1)); UINT16 cupLevelNum; // Levels are added to the queue in the following pattern.