SRL Archive - Discussions and Debates

ItemCoordsDtm Problem and Fix


Fizzi

2007-09-03 01:40:48

This is just a very minor error in coding, but it makes a big difference on whether it works or not, heh. I don't know if it has been seen yet, but here is the current problem, and then the fix.

Here is the current function.


{*******************************************************************************
function ItemCoordsDtm(area: String; dtm: Integer): TPointArray;
By: masquerader
Description: Returns the coordinates of items found with a dtm in an area.
*******************************************************************************}

function ItemCoordsDtm(area: string; dtm: Integer): TPointArray;
var
startx, starty, rowsize, colsize, colnumber, rownumber, col, row: Integer;
x1, y1, x2, y2: Integer;
itemx, itemy: Integer;
i: Integer;
begin
SetArrayLength(Result, 0);
if (CheckArea(area)) then
begin
AreaInfo(area, startx, starty, rowsize, colsize, colnumber, rownumber);
for row := 0 to rownumber - 1 do
for col := 0 to colnumber - 1 do
begin
x1 := startx + col * colsize;
y1 := starty + row * rowsize;
x2 := x1 + colsize;
y2 := y1 + rowsize;
if (FindDTM(itemx, itemy, dtm, x1, y1, x2, y2)) then
begin
i := GetArrayLength(Result);
SetArrayLength(Result, i + 1);
Result[i].x := x1;
Result[i].y := y1;
end;
end;
end;
end;

The problem is with this line:
if (FindDTM(itemx, itemy, dtm, x1, y1, x2, y2)) then

FindDTM is supposed to be (dtm, itemx, itemy, x1, y1, x2, y2).

Just posting this to make the devs aware of the problem.

Boreas

2007-09-03 01:46:02

Yay for betas and yay for Fizzi!!

Bobarkinator

2007-09-03 01:48:10

Very nice Fizzi.

SKy Scripter

2007-09-03 01:58:40

Dhar Fixed it :)

The Claw

2007-09-03 04:50:49

Nice pickup. I saw one or two of these a while ago, but forgot where unfortunately

Rikje

2007-09-03 05:50:47

ty :). thats why its srl 4 beta :P

BobboHobbo

2007-09-03 07:17:39

Nice find. Thnx.

Santa_Clause

2007-09-03 07:29:45

Haha. The parameters are messed up. We should go shoot Masquerader :p

Nice find Fizzi.