From 82133085fcb63b05c24d48038458063299ac0f60 Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Wed, 4 Aug 2021 09:27:05 +0200 Subject: [PATCH] themes: add BUGFIX for Theme_Treasure --- Source/themes.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/themes.cpp b/Source/themes.cpp index ded3f1bf6..629979556 100644 --- a/Source/themes.cpp +++ b/Source/themes.cpp @@ -698,6 +698,13 @@ void Theme_Treasure(int t) CreateRndItem(xp, yp, FALSE, FALSE, TRUE); ItemNoFlippy(); } + // BUGFIX: the following code is likely not working as intended. + // + // `rv == 0` has no effect. + // + // `rv >= treasrnd[leveltype - 1] - 2` is not connected to either + // of the item creation branches above, thus the last (unrelated) + // item spawned/dropped on ground would be halved in value. if (rv == 0 || rv >= treasrnd[leveltype - 1] - 2) { i = ItemNoFlippy(); if (rv >= treasrnd[leveltype - 1] - 2 && leveltype != DTYPE_CATHEDRAL) {