SRL Archive - SRL Bugs

FindNewRoadColor fix'ish


Naum

2008-12-11 12:19:44

We need to remove ActivateClient; before it, as it was causing the client to de-activate. This harms people who use radial walk and people who use IE7. The activateclient stops the RS compass from turning unless you click on the client.

Replace the current one with this:

{*******************************************************************************
function GetNewRoadColor(xs, ys, xe, ye, tol: Integer): Boolean;
By: Wizzup? / WT-Fakawi and modified by Ron,Activate Fix by NaumanAkhlaQ
Description: Copies and compares a Bitmap of 20* 20 around Flag with known RoadColor.
Results the new global RoadColor.
*******************************************************************************}

function GetNewRoadColor(xs, ys, xe, ye, tol: Integer): Boolean;
var
DebugCanvas, ClientCanvas, MMCanvas: TCanvas;
fpx, fpy, bmp, w, h: Integer;
TC: TColor;
bmp1: Integer;
begin
if (DebugRadialRoad) then
begin
if (XS > XE) then
WriteLn('Error with RadialRoadWalk XS : ' + IntToStr(XS) + ' XE : ' +
IntToStr(XE));
if (YS > YE) then
WriteLn('Error with RadialRoadWalk YS : ' + IntToStr(YS) + ' YE : ' +
IntToStr(YE));
end;
w := xe - xs;
h := ye - ys;
if (not (LoggedIn)) then Exit;
if (DebugRadialRoad) then
begin
DisplayDebugImgWindow(w, h);
DebugCanvas := GetDebugCanvas;
ClientCanvas := GetClientCanvas;
SafeCopyCanvas(ClientCanvas, DebugCanvas, xs, ys, xe, ye, 0, 0, w, h);
end;
bmp1 := BitmapFromString(w, h, '');
Wait(1);
MMCanvas := GetBitmapCanvas(bmp1);
Wait(1);
try
bmp := BitmapFromString(w, h, '');
Wait(1);
SafeCopyCanvas(getclientcanvas, GetBitmapCanvas(bmp), xs, ys, xe, ye, 0, 0,
w, h)
except
WriteLn('Error with RadialRoadWalk');
WriteLn('Should be fixed though, so lets debug.');
WriteLn('xs = ' + IntToStr(xs) + ' ys = ' + IntToStr(ys) + ' xe = ' +
IntToStr(xe) + ' ye = ' + IntToStr(ye));
GetClientDimensions(w, h);
WriteLn('and client area is 0, 0, ' + IntToStr(w) + ', ' + IntToStr(h));
SaveBitmap(bmp, 'RoadWalkBMP');
SaveBitmap(bmp1, 'RoadWalkBMP1');
repeat
Wait(1000);
until (not (LoggedIn));
FreeBitmap(bmp);
FreeBitmap(bmp1);
Exit;
end;
Wait(1);
for fpy := 1 to h do
for fpx := 1 to w do
begin
TC := FastGetPixel(bmp, fpx, fpy);
if SimilarColors(TC, RoadColor, tol) then
begin
RoadColor := TC;
StoreToRoadColorArray;
Result := True;
Exit;
end
end;
FreeBitmap(bmp1);
end;

D1zl3

2008-12-11 21:32:24

Looks pretty good, if I ever need to use getnewroadcolor Ill be sure to use this one, Good Job!:)

Naum

2008-12-12 11:34:44

What?? Its not a function, its a fix. ActivateClient in that procedure, which was used in RRW which is used in RW so on.., Was causing the client (IE especially) to de-activate - Meaning that you couldn't turn the compass until you clicked on the client..

TViYH

2008-12-12 15:57:12

So, if we use firefox, we don't really need to change this?

Naum

2008-12-13 10:41:29

No not really, but as 1/4 of people here use IE then its a big prob :)