SRL Archive - MSI Suggestions

MSI_SortColors


Sir R. M8gic1an

2010-05-27 08:11:02


{******************************************************************************}
{ procedure MSI_SortColors(var Colors: tIntegerArray; col: Integer); }
{ By: Blumblebee }
{ Description: Sorts an array of colors }
{******************************************************************************}
procedure MSI_SortColors(var Colors: tIntegerArray; col: Integer);
var
tempB: tIntegerArray;
Tol: ShortInt;
I: Integer;
timer, L: LongInt;
begin
timer := getsystemtime;
tempB := Colors;
SetArrayLength(Colors, 0);
Tol := 0;
while Length(Colors) < (Length(tempB)/2 or 5) do //huh?
begin
if Getsystemtime-timer > 100 then Break; //why this?
for i := 0 to High(tempB) do
begin
if SimilarColors(tempB[i], col, Tol) then
begin
L := GetArrayLength(Colors);
SetArrayLength(Colors, L+1);
Colors[L] := tempB[i];
end;
if Tol > 10 then Break;
Inc(Tol);
end;
end;
end;

This line specifically leaves me very curious:
while Length(Colors) < (Length(tempB)/2 or 5) do

2 or 5 ?

As for the timer breaker, I don't find it necessary as you already have the tolerance breaker and the length breaker. The timer if anything will mess it up.

~RM

Blumblebee

2010-05-27 11:43:09

From: Rasta Magician

{******************************************************************************}
{ procedure MSI_SortColors(var Colors: tIntegerArray; col: Integer); }
{ By: Blumblebee }
{ Description: Sorts an array of colors }
{******************************************************************************}
procedure MSI_SortColors(var Colors: tIntegerArray; col: Integer);
var
tempB: tIntegerArray;
Tol: ShortInt;
I: Integer;
timer, L: LongInt;
begin
timer := getsystemtime;
tempB := Colors;
SetArrayLength(Colors, 0);
Tol := 0;
while Length(Colors) < (Length(tempB)/2 or 5) do //huh?
begin
if Getsystemtime-timer > 100 then Break; //why this?
for i := 0 to High(tempB) do
begin
if SimilarColors(tempB[i], col, Tol) then
begin
L := GetArrayLength(Colors);
SetArrayLength(Colors, L+1);
Colors[L] := tempB[i];
end;
if Tol > 10 then Break;
Inc(Tol);
end;
end;
end;

This line specifically leaves me very curious:
while Length(Colors) < (Length(tempB)/2 or 5) do

2 or 5 ?

As for the timer breaker, I don't find it necessary as you already have the tolerance breaker and the length breaker. The timer if anything will mess it up.

~RM


I was getting a weird error. And I forgot a () it should've been (Length(tempB)/2) or 5. It was because my timer wasn't working haha and I was looking for a quick fix. I forgot about it when it was working it's good you revisited it. I'll fix it when I get a chance in the next few days, I'm having some IRL problems atm so I might be inactive for a bit.

Coh3n

2010-05-29 08:05:21

I haven't talked to anyone about this, but if I can get the autcolors released to the public, would we want to switch to SRL's or keep what we currently have?

Sir R. M8gic1an

2010-05-29 11:45:17

From: Coh3n
I haven't talked to anyone about this, but if I can get the autcolors released to the public, would we want to switch to SRL's or keep what we currently have?


I'd say use SRLs whenever we can.

or…

if not SRL_Autocolor then
MSI_Autocolor;

And to answer your question : No, I haven't comitted anything.

~RM

Coh3n

2010-05-29 11:48:26

From: Rasta Magician
I'd say use SRLs whenever we can.

or…

if not SRL_Autocolor then
MSI_Autocolor;

And to answer your question : No, I haven't comitted anything.

~RM

Okay I'll get some things committed later if I get my homework done. I'm pretty sure the DDTMs need to be updated. The logs and pickaxes have changed shape. Not sure about hatchets.

E: Committed this, along with a few other things.