hedgewars/uLandObjects.pas
changeset 1276 281f6aa9afba
parent 1256 2754a6a8c8f1
child 1277 752b53481057
--- a/hedgewars/uLandObjects.pas	Fri Sep 19 19:56:07 2008 +0000
+++ b/hedgewars/uLandObjects.pas	Fri Sep 19 19:58:57 2008 +0000
@@ -371,21 +371,29 @@
 
 Readln(f, ThemeObjects.Count);
 for i:= 0 to Pred(ThemeObjects.Count) do
-    begin
-    Readln(f, s); // filename
-    with ThemeObjects.objs[i] do
-         begin
-         Surf:= LoadImage(Pathz[ptCurrTheme] + '/' + s, false, true, true);
-         Width:= Surf^.w;
-         Height:= Surf^.h;
-         with inland do Read(f, x, y, w, h);
-         Read(f, rectcnt);
-         for ii:= 1 to rectcnt do
-             with outland[ii] do Read(f, x, y, w, h);
-         Maxcnt:= 3;
-         ReadLn(f)
-         end;
-    end;
+	begin
+	Readln(f, s); // filename
+	with ThemeObjects.objs[i] do
+			begin
+			Surf:= LoadImage(Pathz[ptCurrTheme] + '/' + s, false, true, true);
+			Width:= Surf^.w;
+			Height:= Surf^.h;
+			with inland do
+				begin
+				Read(f, x, y, w, h);
+				TryDo((x + w <= Width) and (y + h <=Height), 'Object''s rectangle exceeds image', true)
+				end;
+			Read(f, rectcnt);
+			for ii:= 1 to rectcnt do
+				with outland[ii] do
+					begin
+					Read(f, x, y, w, h);
+					TryDo((x + w <= Width) and (y + h <=Height), 'Object''s rectangle exceeds image', true);
+					end;
+			Maxcnt:= 3;
+			ReadLn(f)
+			end;
+	end;
 
 // sprays
 Readln(f, SprayObjects.Count);