doom0791
2011-09-06 20:53:30
Maybe I'm just not understanding how to pass a 2D array into functions.
I get type mismatch when calling either the FindRock function or the FColorsSpiralTol function and I'm almost positive it's because of my tinMods 2DArray of Extended.
Any suggestions on how to fix this, and maybe an explanation of why what I'm doing is wrong?
Thanks a ton!
-DooM0791
program new;
{$I SRL/SRL.scar}
var
tinColors, copColors : TIntegerArray;
tinMods, copMods : Array of Array[1..2] of Extended;
RockPoints : T2DPointArray;
i : integer;
mp : TPoint;
procedure setupVars;
begin
tinColors := [13750755, 13685220, 12764374, 13684963, 14408686];
copColors := [4621796, 10018559, 4555233, 6403839, 5611519];
end;
procedure debug;
begin
end;
procedure setupHSLmods;
//* HMod = Mods[i][1]
//* SMod = Mods[i][2]
var
HSLColor : Array[1..3] of Extended;
i : Integer;
begin
SetLength(tinMods, Length(tinColors));
for i := 0 to High(tinMods) do
begin
ColorToHSL(tinColors[i], HSLColor[1], HSLColor[2], HSLColor[3]);
tinMods[i][1] := HSLColor[1]/HSLColor[3];
tinMods[i][2] := HSLColor[2]/HSLColor[3];
end;
SetLength(copMods, Length(copColors));
for i:= 0 to High(copMods) do
begin
ColorToHSL(copColors[i], HSLColor[1], HSLColor[2], HSLColor[3]);
copMods[i][1] := HSLColor[1]/HSLColor[3];
copMods[i][2] := HSLColor[2]/HSLColor[3];
end;
end;
function FColorsSpiralTol(colors : TIntegerArray; mods : Array of Array of Extended; var TPA : TPointArray; tol : Integer) : Boolean;
var
i, CTS : Integer;
Temp : TPointArray;
H, S : Extended;
begin
TPA := [];
CTS := GetColorToleranceSpeed;
GetColorSpeed2Modifiers(H, S);
SetColorToleranceSpeed(2);
for i:= 0 to High(colors) do
begin
SetColorSpeed2Modifiers(mods[i][1], mods[i][2]);
FindColorsSpiralTolerance(MSCX, MSCY, Temp, colors[i], MSX1, MSY1, MSX2, MSY2, tol);
TPA := CombineTPA(Temp, TPA);
end;
if High(TPA) > 0 then
Result := true;
SetColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(H, S);
end;
function FindRock(colors : TIntegerArray; mods : Array of Array of Extended) : TPoint;
var
Pts : TPointArray;
TPAs : T2DPointArray;
begin
if FColorsSpiralTol(colors, mods, Pts, 5) then
begin
SortTPAFrom(Pts, Point(MSCX, MSCY));
TPAs := SplitTPA(Pts, 17);
SortATPAFrom(TPAs, Point(MSCX, MSCY));
Result := MiddleTPA(TPAs[High(TPAs)]);
end;
end;
function trackRock(midPoint : TPoint; colors : TIntegerArray) : TPointArray;
begin
end;
var
pts : tpointarray;
begin
SetupSRL;
setupVars;
setupHSLmods;
MarkTime(i);
FindRock(tinColors, tinMods); // Type Mismatch here <-
writeLn(intToStr(TimeFromMark(i)));
end.
I get type mismatch when calling either the FindRock function or the FColorsSpiralTol function and I'm almost positive it's because of my tinMods 2DArray of Extended.
Any suggestions on how to fix this, and maybe an explanation of why what I'm doing is wrong?
Thanks a ton!
-DooM0791