DEADSOFTWARE

loading game now properly fixes enabled/disabled state for proxy
[d2df-sdl.git] / src / game / g_grid.pas
index 049868c7821e7784afa08dbe18e68ab97c0d6a31..17ad2fceed471807171d121fac437b57837e099c 100644 (file)
@@ -685,13 +685,13 @@ end;
 // ////////////////////////////////////////////////////////////////////////// //
 function TBodyGridBase.getProxyEnabled (pid: TBodyProxyId): Boolean; inline;
 begin
-  if (pid >= 0) then result := ((mProxies[pid].mTag and TagDisabled) = 0) else result := false;
+  if (pid >= 0) and (pid < Length(mProxies)) then result := ((mProxies[pid].mTag and TagDisabled) = 0) else result := false;
 end;
 
 
 procedure TBodyGridBase.setProxyEnabled (pid: TBodyProxyId; val: Boolean); inline;
 begin
-  if (pid >= 0) then
+  if (pid >= 0) and (pid < Length(mProxies)) then
   begin
     if val then
     begin
@@ -707,7 +707,7 @@ end;
 
 function TBodyGridBase.getProxyById (idx: TBodyProxyId): PBodyProxyRec; inline;
 begin
-  if (idx >= 0) and (idx < High(mProxies)) then result := @mProxies[idx] else result := nil;
+  if (idx >= 0) and (idx < Length(mProxies)) then result := @mProxies[idx] else result := nil;
 end;