Skip to content

Commit

Permalink
Fix coordinates being allowed in the wrong order
Browse files Browse the repository at this point in the history
  • Loading branch information
mothbeanie committed Nov 4, 2024
1 parent 94b903a commit 2cbb593
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions desktop_version/src/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2296,6 +2296,20 @@ void mapclass::setregion(int id, int rx, int ry, int rx2, int ry2)
{
if (INBOUNDS_ARR(id, region) && id > 0)
{
// swap the variables if they're entered in the wrong order
if (rx2 > rx)
{
int temp = rx;
rx = rx2;
rx2 = temp;
}
if (ry2 > ry)
{
int temp = ry;
ry = ry2;
ry2 = temp;
}

region[id].isvalid = true;
region[id].rx = SDL_clamp(rx, 0, cl.mapwidth - 1);
region[id].ry = SDL_clamp(ry, 0, cl.mapheight - 1);
Expand Down

0 comments on commit 2cbb593

Please sign in to comment.