From 9c6030567137675ee83ed810652a6c0730d28752 Mon Sep 17 00:00:00 2001 From: Vankata453 <78196474+Vankata453@users.noreply.github.com> Date: Fri, 11 Oct 2024 17:59:15 +0300 Subject: [PATCH] Heavy coins can no longer be collected twice by falling on two hit blocks This commit makes it so coins can only be collected once. The exact issue leading up to this chance is that heavy coins used to be able to be collected twice, when hitting the top of two hit blocks at the same time. This could be reproduced by having one coin explosion bonus block and another block (of any type), as well as a low ceiling. When hitting both blocks at the same time, some coins would fall in between of those 2 blocks, making them be collected twice, essentially duplicating them. The lower the ceiling is, the higher the chance of this occurring was. --- src/object/coin.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/object/coin.cpp b/src/object/coin.cpp index ff81a349f0b..b4a36f04199 100644 --- a/src/object/coin.cpp +++ b/src/object/coin.cpp @@ -164,6 +164,9 @@ Coin::collect() int tile = static_cast(get_pos().y / 32); + if (!is_valid()) + return; + if (!sound_timer.started()) { pitch_one = tile; pitch = 1;