X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_grid.pas;h=81974570c4e201bd52d550e2b556fed261e8ffd6;hb=51343dcc874e5db55f029b0750892ca2da971c24;hp=5b2f8b135d27583c5a849aaec6ab3e46f5d4ef7e;hpb=31fadda69508ddb1f225a2a471c1be888148ffac;p=d2df-sdl.git diff --git a/src/game/g_grid.pas b/src/game/g_grid.pas index 5b2f8b1..8197457 100644 --- a/src/game/g_grid.pas +++ b/src/game/g_grid.pas @@ -25,7 +25,7 @@ const 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; @@ -68,7 +68,7 @@ type 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 @@ -95,7 +95,7 @@ type 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); @@ -287,7 +287,7 @@ begin 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;