fix glitch in map editor that allowed to violate map borders

Also, provide a more detailed error message in case of client fatal due
 to bad map (with non-solid borders).
This commit is contained in:
ac-stef
2015-01-29 15:09:54 +01:00
parent d5763d9f5b
commit 400e7eb9a6
2 changed files with 22 additions and 3 deletions
+19 -2
View File
@@ -175,6 +175,12 @@ COMMANDF(showtagclipfocus, "d", (bool on) { showtagclipfocus = on; } );
VAR(showtagclips, 0, 1, 1);
FVAR(tagcliplinewidth, 0.2, 1, 3);
inline void forceinsideborders(int &xy)
{
if(xy < MINBORD) xy = MINBORD;
if(xy >= ssize - MINBORD) xy = ssize - MINBORD - 1;
}
void cursorupdate() // called every frame from hud
{
flrceil = ((int)(camera1->pitch>=0))*2;
@@ -188,7 +194,13 @@ void cursorupdate() // called every frame fr
cx = (int)x;
cy = (int)y;
if(OUTBORD(cx, cy)) return;
if(OUTBORD(cx, cy))
{
forceinsideborders(cx);
forceinsideborders(cy);
return;
}
sqr *s = S(cx,cy);
if(fabs(sheight(s,s,z)-z)>1) // selected wall
@@ -199,7 +211,12 @@ void cursorupdate() // called every frame fr
cx = (int)x;
cy = (int)y;
if(OUTBORD(cx, cy)) return;
if(OUTBORD(cx, cy))
{
forceinsideborders(cx);
forceinsideborders(cy);
return;
}
}
if(dragging) makesel(false);