Skip to content

Commit 28608e7

Browse files
committed
fix: some more form utils wrappers
- also some misc tweaks
1 parent 8ae6119 commit 28608e7

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

osrs/interfaces/mainscreen/anvil.simba

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ begin
183183
if Target.HasColor(RSFonts.BLACK, 0, 1, Self.QuantityButtons[i].Bounds) then
184184
btns += Self.QuantityButtons[i];
185185

186-
if btns = [] then Exit;
186+
if btns = [] then
187+
Exit;
187188

188189
case value of
189190
-1, 0: str := 'All';
@@ -344,7 +345,7 @@ begin
344345
Exit;
345346

346347
obj.Walker^.WaitMoving();
347-
Result := Self.WaitOpen(3000);
348+
Result := Self.WaitOpen(6*TICK);
348349
end;
349350

350351
function TRSAnvil.Open(walk: Boolean = True): Boolean; overload;

osrs/position/map/mapdebugger.simba

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ begin
6767
for i := 0 to High(Self.Graph.ObjectClusters) do
6868
canvas.DrawPoints(Self.Graph.ObjectClusters[i], Self.ColorArray[i]);
6969

70-
if Self.ShowGraph then
70+
if Self.ShowGraph and (Self.Graph.Nodes <> []) then
7171
begin
7272
Self.Graph.Draw(canvas);
7373
if Self.Selected > -1 then
@@ -126,7 +126,7 @@ begin
126126

127127
Self.Selected := Self.Graph.Nodes.NearestIndex(pt);
128128

129-
if pt.InRange(Self.Graph.Nodes[Self.Selected].Node, 4) then
129+
if (Self.Graph.Nodes <> []) and pt.InRange(Self.Graph.Nodes[Self.Selected].Node, 4) then
130130
begin
131131
g := Self.GetGlobal(Self.Graph.Nodes[Self.Selected].Node);
132132

osrs/position/map/maploader.simba

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ If no .bmp file exists, the .png file is loaded instead, it's saved as .bmp for
316316
function TRSMapLoader.GetFile(chunk: TPoint; plane: Integer; map: ERSMap): TImage;
317317
var
318318
filename, cachename: String;
319-
created: Boolean;
320319
begin
321320
filename := ToStr(chunk.X) + '-' + ToStr(chunk.Y);
322321
Result := new TImage();
@@ -331,12 +330,13 @@ begin
331330
begin
332331
if not FileExists(cachename + '.png') then
333332
begin
334-
created := True;
335333
Result.SetSize(RSTranslator.Map.ChunkSide, RSTranslator.Map.ChunkSide);
336-
end;
337-
338-
if not created then
334+
if not DirCreate(PathExtractDir(cachename)) then
335+
raise GetDebugLn('MapLoader', 'Failed to create path: ' + PathExtractDir(cachename));
336+
end
337+
else
339338
Result.Load(cachename + '.png');
339+
340340
Result.Save(cachename + '.bmp');
341341
FileDelete(cachename + '.png');
342342
Exit;

utils/forms/formutils.simba

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,17 @@ begin
222222
end;
223223

224224

225+
property TLazControl.Right: Integer;
226+
begin
227+
Result := Self.Left+Self.Width;
228+
end;
229+
230+
property TLazControl.Bottom: Integer;
231+
begin
232+
Result := Self.Top+Self.Height;
233+
end;
234+
235+
225236

226237
property TLazSizeConstraints.MinWidth(value: Integer); override;
227238
begin

utils/ocr.simba

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ var
5454
colors: TColorArray;
5555
begin
5656
img := Target.GetImage(bounds);
57-
shadows := img.FindColor(0, 2.5, [1, 1, img.Width - 1, img.Height - 1]);
58-
shadows := Shadows.Offset([-1,-1]).ExcludePoints(shadows);
57+
shadows := img.FindColor($0, 2.5, [1, 1, img.Width - 1, img.Height - 1]);
58+
shadows := shadows.Offset([-1,-1]).ExcludePoints(shadows);
5959

6060
colors := img.GetColors(shadows).Unique();
6161
img.ReplaceColorBinary(False, colors, tolerance);

0 commit comments

Comments
 (0)