Skip to content

Commit 5771951

Browse files
committed
fix: Fixed bug reported by @rubix: if editing existing account, world generation filters did not work as expected
1 parent 22faad6 commit 5771951

File tree

1 file changed

+19
-23
lines changed

1 file changed

+19
-23
lines changed

utils/forms/profile_form.simba

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -502,27 +502,27 @@ Filters the current world list based on selected specific activity checkboxes.
502502
procedure TProfileForm.ApplyActivityFilters();
503503
var
504504
i, j, checkboxIndex: Integer;
505-
hasSpecificActivity: Boolean;
505+
anyChecked: Boolean;
506506
begin
507507
if Length(Self.ActivityCheckboxes) = 0 then
508508
Exit;
509509

510-
j := 0;
511-
for i := 0 to High(Self.FilteredWorlds) do
512-
begin
513-
// Check if world has a specific activity
514-
hasSpecificActivity := (Self.FilteredWorlds[i].ActivityString <> '') and
515-
(Self.FilteredWorlds[i].ActivityString <> '-');
516-
517-
// If no specific activity, include it (it passed the main activity type filters)
518-
if not hasSpecificActivity then
510+
// Check if ANY activity checkbox is selected
511+
anyChecked := False;
512+
for i := 0 to High(Self.ActivityCheckboxes) do
513+
if Self.ActivityCheckboxes[i].IsChecked() then
519514
begin
520-
Self.FilteredWorlds[j] := Self.FilteredWorlds[i];
521-
Inc(j);
522-
Continue;
515+
anyChecked := True;
516+
Break;
523517
end;
524-
525-
// If has specific activity, check if its checkbox is checked
518+
519+
// If none selected, no filtering needed (show all)
520+
if not anyChecked then
521+
Exit;
522+
523+
// Filter to ONLY include worlds matching checked activities
524+
j := 0;
525+
for i := 0 to High(Self.FilteredWorlds) do
526526
for checkboxIndex := 0 to High(Self.ActivityCheckboxes) do
527527
if (Self.ActivityCheckboxes[checkboxIndex].Hint = Self.FilteredWorlds[i].ActivityString) and
528528
Self.ActivityCheckboxes[checkboxIndex].IsChecked() then
@@ -531,7 +531,7 @@ begin
531531
Inc(j);
532532
Break;
533533
end;
534-
end;
534+
535535
SetLength(Self.FilteredWorlds, j);
536536
end;
537537

@@ -871,6 +871,8 @@ begin
871871
Self.AllWorldsCache := WorldFetcher.GetFilteredWorlds();
872872
end;
873873

874+
WorldFetcher.Worlds := Self.AllWorldsCache;
875+
874876
Self.RefreshActivities();
875877

876878
Self.FilteredWorlds := WorldFetcher.FilterBySettings(settings);
@@ -1094,11 +1096,9 @@ end;
10941096
```pascal
10951097
procedure TProfileForm.LoadSavedWorlds(worldsStr: String);
10961098
```
1097-
Loads a comma-separated list of world numbers and displays them. Disables all filter checkboxes when showing saved worlds.
1099+
Loads saved world numbers and displays them. Unchecks filter checkboxes but keeps activity options visible.
10981100
*)
10991101
procedure TProfileForm.LoadSavedWorlds(worlds: TIntegerArray);
1100-
var
1101-
i: Integer;
11021102
begin
11031103
if worlds = [] then Exit;
11041104

@@ -1119,10 +1119,6 @@ begin
11191119
Self.RestrictedCheckbox.SetChecked(False);
11201120
Self.SkillTotalCheckbox.SetChecked(False);
11211121
Self.SelectAllActivitiesCheckbox.SetChecked(False);
1122-
1123-
for i := 0 to High(Self.ActivityCheckboxes) do
1124-
Self.ActivityCheckboxes[i].Free();
1125-
SetLength(Self.ActivityCheckboxes, 0);
11261122
end;
11271123
end;
11281124

0 commit comments

Comments
 (0)