SRL Archive - Reflection Help

Tracking a TPA


bbri06

2010-05-20 20:36:01

So I was attempting to track a TPA by using reflection. The function

Function TrackTPA(TPA: TPointArray): TPointArray;
var
SPS: Array of TTile;
i: integer;
p: tpoint;
begin
SetLength(SPS, Length(TPA));
SetLength(Result, Length(SPS));
for i := 0 to High(SPS) do
begin
SPS[i] := Tile(TPA[i].x, TPA[i].y);
end;
R_Flag;
for i := 0 to High(SPS) do
begin
Result[i] := TileToMS(SPS[i], 0);
end;
writeln('TrackTPA finished');
end;

Every point in the Result array is always equal to (-1, -1). Now the thing is, if I test the TPA that I input before making it into Tiles, it comes out as all valid points, so that is not the problem. Then, if I test the values of SPS, it comes out as what looks to be all valid tiles.

Finally, when I test the values of Result, they all come out to (-1, -1). Now my question is, where the hell is the problem.

bbri06

2010-05-20 20:40:14

OH WAIT. I think I got it…

edit: No, nvm I didn't.

TRiLeZ

2010-05-20 20:42:17

From: bbri06
SPS := Tile(TPA.x, TPA.y);


TPA isn't a tile, its a TPoint (on the mainscreen I'm assuming). You must use an actual tile. However, a function hasn't been made to turn a mainscreen TPoint to a Tile.

bbri06

2010-05-20 20:45:42

Oh.. I see. Thanks.

NCDS

2010-05-21 00:01:50

It shouldn't bee very complicated though if you can return coords from Tiles.

Persoanlly I'm not too familiar with reflection though,so I don't know if it does or not.

masterBB

2010-05-21 04:13:26

It is possible to get close to that tile. Done before…

Drakan

2010-05-22 08:33:01

I'll look into that function.

bbri06

2010-05-23 15:25:27

It would be great if you could get it working, thanks.