mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 09:28:15 +03:00
Fix coordinates being allowed in the wrong order
This commit is contained in:
committed by
Misa Elizabeth Kai
parent
54b2aaae96
commit
2875af0492
@@ -2306,6 +2306,20 @@ void mapclass::setregion(int id, int rx, int ry, int rx2, int ry2)
|
|||||||
{
|
{
|
||||||
if (INBOUNDS_ARR(id, region) && id > 0)
|
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].isvalid = true;
|
||||||
region[id].rx = SDL_clamp(rx, 0, cl.mapwidth - 1);
|
region[id].rx = SDL_clamp(rx, 0, cl.mapwidth - 1);
|
||||||
region[id].ry = SDL_clamp(ry, 0, cl.mapheight - 1);
|
region[id].ry = SDL_clamp(ry, 0, cl.mapheight - 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user