mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 09:39:43 +01:00
Fix coordinates being allowed in the wrong order
This commit is contained in:
parent
54b2aaae96
commit
2875af0492
1 changed files with 14 additions and 0 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue