SRL Archive - Research & Development Lounge

Fixed WalkToTileEx(reflection)


weequ

2008-08-20 11:56:40

It didn't work becouse WalkToTile now uses TPoints so i decided to fix it :)

Function WalkToTileEx(TileX, TileY, XTRandom, YTRandom, FFlag : Integer): Boolean;
Var
T1l : Tpoint;
Begin
T1l.X := TileX+random(XTRandom)
T1l.Y := TileY+random(YTRandom)
Walktotile(T1l,0,0);
R_FFlag(FFlag);
end;

Naum

2008-08-20 12:22:38

umm ok :cartman: .. May want other people to check but I dont think that an 'Ex' uses the other version I think it may be some compatibility issues

weequ

2008-08-20 13:47:13

From: NaumanAkhlaQ
umm ok :cartman: .. May want other people to check but I dont think that an 'Ex' uses the other version I think it may be some compatibility issues


It does and it works with me.

Shuttleu

2008-08-20 14:28:21

here you go fixed it up a bit :D
Function WalkToTileEx(Tiles : Tpoint; XTRandom, YTRandom, FlagDis : Integer): Boolean;
Begin
Tiles.X := Tiles.X+random(XTRandom)
Tiles.Y := Tiles.Y+random(YTRandom)
if TileOnMM(Tiles) then
if Walktotile(Tiles,0,0) then
begin
FFlag(FlagDis);
Result:= True;
end;
end;


~shut

EDIT: oh wait you wanted it to NOT use TPA's
here you go
Function WalkToTileEx(TileX, TileY, XTRandom, YTRandom, FlagDis : Integer): Boolean;
var
Tiles: Tpoint;
Begin
Tiles.X := TileX+random(XTRandom)
Tiles.Y := TileY+random(YTRandom)
if TileOnMM(Tiles) then
if Walktotile(Tiles,0,0) then
begin
FFlag(FlagDis);
Result:= True;
end;
end;

weequ

2008-08-20 15:52:48

From: Shuttleu

Function WalkToTileEx(TileX, TileY, XTRandom, YTRandom, FlagDis : Integer): Boolean;
var
Tiles: Tpoint;
Begin
Tiles.X := TileX+random(XTRandom)
Tiles.Y := TileY+random(YTRandom)
if TileOnMM(Tiles) then
if Walktotile(Tiles,0,0) then
begin
FFlag(FlagDis);
Result:= True;
end;
end;

Now it looks quite much same as mine :)

Shuttleu

2008-08-20 16:11:52

whoops forgot something
Function WalkToTileEx(TileX, TileY, XTRandom, YTRandom, FlagDis : Integer): Boolean;
var
Tiles: Tpoint;
Begin
Tiles.X := TileX+random(XTRandom)
Tiles.Y := TileY+random(YTRandom)
if TileOnMM(Tiles) then
if Walktotile(Tiles,0,FlagDis) then
Result:= True;
end;
there you go fixed

~shut

EDIT:
From: antti mies
Now it looks quite much same as mine :)
mines more reliable though