X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_grid.pas;h=475cb68d7ec3b961c324f504bcf802230ae2bbfc;hb=4d64aecc835437d733321a8497b4c872c2b1c085;hp=442a776ea831b8fc1a103001c51331cecf7e4a3b;hpb=12091923618f35554e5b21cd088d39f202a770d0;p=d2df-sdl.git diff --git a/src/game/g_grid.pas b/src/game/g_grid.pas index 442a776..475cb68 100644 --- a/src/game/g_grid.pas +++ b/src/game/g_grid.pas @@ -178,7 +178,7 @@ type // no callback: return object on the first hit or nil function forEachAtPoint (x, y: Integer; cb: TGridQueryCB; tagmask: Integer=-1; exittag: PInteger=nil): ITP; - function atPoint (x, y: Integer): TAtPointEnumerator; + function atCellInPoint (x, y: Integer): TAtPointEnumerator; //WARNING: don't modify grid while any query is in progress (no checks are made!) // you can set enabled/disabled flag, tho (but iterator can still return objects disabled inside it) @@ -1162,7 +1162,7 @@ end; // ////////////////////////////////////////////////////////////////////////// // -function TBodyGridBase.atPoint (x, y: Integer): TAtPointEnumerator; +function TBodyGridBase.atCellInPoint (x, y: Integer): TAtPointEnumerator; var cidx: Integer = -1; begin @@ -2039,7 +2039,7 @@ var temp: Integer; ccidx, curci: Integer; lastGA: Integer = -1; - ga, x, y: Integer; + ga: Integer; gw, gh, minx, miny, maxx, maxy: Integer; cc: PGridCell; px: PBodyProxyRec; @@ -2254,23 +2254,20 @@ begin if dbgShowTraceLog then e_LogWritefln('optimized htrace; wklen=%d', [wklen]); {$ENDIF} ga := (yptr^ div tsize)*gw+(xptr^ div tsize); - // one of those will never change - x := xptr^+minx; - y := yptr^+miny; {$IF DEFINED(D2F_DEBUG)} if hopt then begin - if (y <> ay0) then raise Exception.Create('htrace fatal internal error'); + if (yptr^ <> ay0) then raise Exception.Create('htrace fatal internal error'); end else begin - if (x <> ax0) then raise Exception.Create('vtrace fatal internal error'); + if (xptr^ <> ax0) then raise Exception.Create('vtrace fatal internal error'); end; {$ENDIF} while (wklen > 0) do begin {$IF DEFINED(D2F_DEBUG)} - if dbgShowTraceLog then e_LogWritefln(' htrace; ga=%d; x=%d, y=%d; y=%d; y=%d', [ga, xptr^+minx, yptr^+miny, y, ay0]); + if dbgShowTraceLog then e_LogWritefln(' htrace; ga=%d; x=%d, y=%d; ay0=%d', [ga, xptr^+minx, yptr^+miny, ay0]); {$ENDIF} // new tile? if (ga <> lastGA) then @@ -2278,7 +2275,6 @@ begin lastGA := ga; ccidx := mGrid[lastGA]; // convert coords to map (to avoid ajdusting coords inside the loop) - if hopt then x := xptr^+minx else y := yptr^+miny; while (ccidx <> -1) do begin cc := @mCells[ccidx]; @@ -2395,9 +2391,6 @@ begin begin // process cell curci := ccidx; - // convert coords to map (to avoid ajdusting coords inside the loop) - x := xptr^+minx; - y := yptr^+miny; // process cell list while (curci <> -1) do begin