1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-05 10:49:41 +01:00

Fix coordinates being allowed in the wrong order

This commit is contained in:
mothbeanie 2024-11-03 17:48:11 -08:00 committed by Misa Elizabeth Kai
parent 54b2aaae96
commit 2875af0492

View file

@ -2306,6 +2306,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);