Sanity limits.
authornemo
Sun, 24 Jun 2012 13:18:33 -0400
changeset 7277 b817a478dcfb
parent 7276 e570bc0df33c
child 7279 18a620394623
child 7284 24c6fa591866
Sanity limits.
hedgewars/uLandPainted.pas
--- a/hedgewars/uLandPainted.pas	Sun Jun 24 09:12:53 2012 -0400
+++ b/hedgewars/uLandPainted.pas	Sun Jun 24 13:18:33 2012 -0400
@@ -27,7 +27,7 @@
 procedure freeModule;
 
 implementation
-uses uLandGraphics, uConsts, uUtils, SDLh, uCommands, uDebug;
+uses uLandGraphics, uConsts, uVariables, uUtils, SDLh, uCommands, uDebug;
 
 type PointRec = packed record
     X, Y: SmallInt;
@@ -57,6 +57,10 @@
         rec:= prec^;
         rec.X:= SDLNet_Read16(@rec.X);
         rec.Y:= SDLNet_Read16(@rec.Y);
+        if rec.X < -323 then rec.X:= -323;
+        if rec.X > LAND_WIDTH+323 then rec.X:= LAND_WIDTH+323;
+        if rec.Y < -323 then rec.Y:= -323;
+        if rec.Y > LAND_HEIGHT+323 then rec.Y:= LAND_HEIGHT+323;
 
         new(pe);
         if pointsListLast = nil then