From 6e583d949bccca82d949f65f4efd1f08ad618242 Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 30 Nov 2022 13:42:10 -0800 Subject: [PATCH] Don't set legends if out of bounds Trinket and teleporter legends would be drawn even if they were out of bounds. Trinket legends in particular were easy to do because you can just place a trinket in a custom level and resize the map to not include the room of the trinket. Now, there are checks added so they won't be added if they are out of bounds. This is in line with the fact that, since 2.3, if a trinket exists outside of the map in custom levels, it won't count towards the number of trinkets. --- desktop_version/src/Map.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index 78a4cd72..d278c28c 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -139,6 +139,11 @@ int mapclass::intpol(int a, int b, float c) void mapclass::setteleporter(int x, int y) { + if (x < 0 || x >= getwidth() || y < 0 || y >= getheight()) + { + return; + } + point temp; temp.x = x; temp.y = y; @@ -147,6 +152,11 @@ void mapclass::setteleporter(int x, int y) void mapclass::settrinket(int x, int y) { + if (x < 0 || x >= getwidth() || y < 0 || y >= getheight()) + { + return; + } + point temp; temp.x = x; temp.y = y;