From c325085ddbb0c86d6a599f156560d880d7f015db Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 9 Sep 2020 22:40:15 -0700 Subject: [PATCH] Fix up trinket and coin ID bounds checks Trinket IDs weren't being bounds-checked upon creation, and coin IDs weren't being bounds-checked upon pickup. But now they both are. --- desktop_version/src/Entity.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/Entity.cpp b/desktop_version/src/Entity.cpp index 94d679b7..3f9d29ab 100644 --- a/desktop_version/src/Entity.cpp +++ b/desktop_version/src/Entity.cpp @@ -1434,7 +1434,7 @@ void entityclass::createentity( float xp, float yp, int t, float vx /*= 0*/, flo //Check if it's already been collected entity.para = vx; - if (collect[(int) vx]) return; + if (!INBOUNDS_ARR(vx, collect) || collect[(int) vx]) return; break; case 10: //Savepoint entity.rule = 3; @@ -2581,7 +2581,10 @@ bool entityclass::updateentities( int i ) if (entities[i].state == 1) { music.playef(4); - collect[(int) entities[i].para] = true; + if (INBOUNDS_ARR(entities[i].para, customcollect)) + { + collect[(int) entities[i].para] = true; + } return removeentity(i); }