Skip to content

Commit 07cc1f3

Browse files
committed
fix: Small bug in TRSSlotInterface.RandomNear
1 parent fdbe5e5 commit 07cc1f3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

osrs/interfaces/slotinterface.simba

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ begin
194194
if removeSlot then
195195
slots.Remove(slot);
196196

197-
if Length(slots) = 0 then
197+
if slots = [] then
198198
raise GetDebugLn(Self.Name, 'RandomSlotNearby: No slots to choose from');
199199

200200
boxes := Self.Boxes();
@@ -237,6 +237,11 @@ var
237237
boxes: TBoxArray;
238238
center: TPoint;
239239
begin
240+
case Length(slots) of
241+
0: Exit;
242+
1: Exit(slots.First);
243+
end;
244+
240245
near := Self.Near(slot, slots, maxDist, removeSlot);
241246

242247
if distribution = ERandomDistribution.RANDOM then

0 commit comments

Comments
 (0)