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.
This commit is contained in:
Misa 2022-11-30 13:42:10 -08:00
parent de38b6b55c
commit 6e583d949b
1 changed files with 10 additions and 0 deletions

View File

@ -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;