From 088d701f24044dd11b8aed5b4ed4e33bf3f40374 Mon Sep 17 00:00:00 2001 From: Donovan Watteau Date: Mon, 31 Oct 2022 13:08:08 +0100 Subject: [PATCH] ICB: Fix an off-by-one in InitWeather() --- engines/icb/set_pc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/icb/set_pc.cpp b/engines/icb/set_pc.cpp index 735d53b01f7..1de9ccfe77f 100644 --- a/engines/icb/set_pc.cpp +++ b/engines/icb/set_pc.cpp @@ -1338,7 +1338,7 @@ void _set::InitWeather(int32 type, int32 particleQty, int32 lightning, int32 win if (m_wParticleQty > WEATHER_MAX_PARTICLES) m_wParticleQty = WEATHER_MAX_PARTICLES; - for (int32 i = WEATHER_MAX_PARTICLES; i >= 0; i--) { + for (int32 i = WEATHER_MAX_PARTICLES - 1; i >= 0; i--) { m_wParticleX[i] = (int16)((g_icb->getRandomSource()->getRandomNumber(WEATHER_SCREEN_WIDTH - 1)) - WEATHER_HALF_SCREEN_WIDTH); m_wParticleY[i] = (int16)((g_icb->getRandomSource()->getRandomNumber(WEATHER_SCREEN_HEIGHT - 1)) - WEATHER_HALF_SCREEN_HEIGHT); m_wParticleZ[i] = (int16)((g_icb->getRandomSource()->getRandomNumber(WEATHER_SCREEN_DEPTH - 1)) - WEATHER_HALF_SCREEN_DEPTH);