diff --git a/src/game/g_grid.pas b/src/game/g_grid.pas
index 5b2f8b135d27583c5a849aaec6ab3e46f5d4ef7e..81974570c4e201bd52d550e2b556fed261e8ffd6 100644 (file)
--- a/src/game/g_grid.pas
+++ b/src/game/g_grid.pas
GridCellBucketSize = 8; // WARNING! can't be less than 2!
type
- TGridQueryCB = function (obj: TObject; objx, objy, objw, objh: Integer; tag: Integer): Boolean is nested; // return `true` to stop
+ TGridQueryCB = function (obj: TObject; tag: Integer): Boolean is nested; // return `true` to stop
type
TBodyGrid = class;
next: Integer; // in this cell; index in mCells
end;
- GridInternalCB = function (grida: Integer): Boolean is nested; // return `true` to stop
+ TGridInternalCB = function (grida: Integer): Boolean is nested; // return `true` to stop
TBodyGrid = class(TObject)
private
procedure insert (body: TBodyProxy);
procedure remove (body: TBodyProxy);
- function forGridRect (x, y, w, h: Integer; cb: GridInternalCB): Boolean;
+ function forGridRect (x, y, w, h: Integer; cb: TGridInternalCB): Boolean;
public
constructor Create (aMinPixX, aMinPixY, aPixWidth, aPixHeight: Integer; aTileSize: Integer=GridDefaultTileSize);
end;
-function TBodyGrid.forGridRect (x, y, w, h: Integer; cb: GridInternalCB): Boolean;
+function TBodyGrid.forGridRect (x, y, w, h: Integer; cb: TGridInternalCB): Boolean;
var
gx, gy: Integer;
begin
@@ -474,7 +474,7 @@ function TBodyGrid.forEachInAABB (x, y, w, h: Integer; cb: TGridQueryCB; tagmask
begin
//e_WriteLog(Format(' query #%d body hit: (%d,%d)-(%dx%d) tag:%d', [mLastQuery, mCells[idx].body.mX, mCells[idx].body.mY, mCells[idx].body.mWidth, mCells[idx].body.mHeight, mCells[idx].body.mTag]), MSG_NOTIFY);
px.mQueryMark := mLastQuery;
- if (cb(px.mObj, px.mX, px.mY, px.mWidth, px.mHeight, px.mTag)) then begin result := true; exit; end;
+ if (cb(px.mObj, px.mTag)) then begin result := true; exit; end;
end;
end;
idx := pi.next;
@@ -486,7 +486,7 @@ function TBodyGrid.forEachInAABB (x, y, w, h: Integer; cb: TGridQueryCB; tagmask
begin
//e_WriteLog(Format(' query #%d body hit: (%d,%d)-(%dx%d) tag:%d', [mLastQuery, mCells[idx].body.mX, mCells[idx].body.mY, mCells[idx].body.mWidth, mCells[idx].body.mHeight, mCells[idx].body.mTag]), MSG_NOTIFY);
px.mQueryMark := mLastQuery;
- if (cb(px.mObj, px.mX, px.mY, px.mWidth, px.mHeight, px.mTag)) then begin result := true; exit; end;
+ if (cb(px.mObj, px.mTag)) then begin result := true; exit; end;
end;
end;
idx := mCells[idx].next;