SRL Archive - Bugs

Infinite loop in R_WebWalk


Coh3n

2011-03-08 18:21:07

Happened to me a couple times in my private fighter. It only breaks if Result := True, which doesn't always happen. Fix:

Function r_WebWalk(T: TTile): Boolean;
Var
I, T: Integer;
M, P: TPoint;
CTRLPoints: TPointArray;
Begin
P := TileToPoint(T);
T := (GetSystemTime + (5 * 60000));
Repeat
M := GetMyPos;
CtrlPoints := r_WindPath(M.x, M.y, P.X, P.Y, 5.0, 2.5, 0.0, 0.0, 4.5, 2.5);
For I:= High(CtrlPoints) DownTo 0 Do
if WalkToTile(Tile(CtrlPoints[i].x, CtrlPoints[i].y),0, 10) Then
Begin
Result := I = High(CtrlPoints);
Break;
End;
Until(Result or (GetSystemTime > T));
End;
You can change the 5 minutes to whatever you want.

Harry

2011-03-08 18:23:32

I got this today. It happens if you're standing on the destination point. (i.e., if you r_webwalk to 1000,1000; and you are standing on 1000,1000; it infinite loops).

P := TileToPoint(T);
if DistanceFrom(P) < 4 then
begin
WriteLn('Located close enough to tile, unable to webwalk!');
Exit;
end;

was the simple "fix" I used.

On the subject of this function, it should have some way to check for randoms. You sometimes get them when walking, and it'll cause the function to also infinite loop clicking at walls of the random Minimap. I throw it into my personal copy, but I don't think it's "proper" to have antirandom calls inside the include.

kitchenrange

2011-03-08 19:06:52

I think it would be proper to have it in include walking functions considering that would be the best way now that we know for sure you get randoms when walking.

I think it was done that way a long time ago because people felt like we didnt ever get randoms when walking.

Coh3n

2011-03-09 02:30:58

It should definitely look for randoms when walking. WalkToTile should also check if the player is already near the tile. I don't have a lot of time now since playoffs started, but if I get some, I'll send a pull request if no one else does.

Nava2

2011-03-09 04:00:18

Path walking should not be in the core include, but in a separate section. That way, you can include other core things.

The setup of Reflection is silly right now.. I need to be more active with developing in general.. I just do not have time :(