Skip to content

Commit

Permalink
Fix ship switch retry
Browse files Browse the repository at this point in the history
  • Loading branch information
XVs32 committed Feb 15, 2024
1 parent d9df6e7 commit 8db91ea
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions kcauto/fleet_switcher/fleet_switcher_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,9 @@ def switch_to_costom_fleet(self, fleet_id, ship_list):
empty_slot_count = 0

size = max(len(flt.fleets.fleets[fleet_id].ship_ids), len(ship_list))

any_vaild_switch = False
retry = False
for i in range(1,size + 1):
if i > len(ship_list):
id = EMPTY #remove this slot
Expand All @@ -506,21 +509,23 @@ def switch_to_costom_fleet(self, fleet_id, ship_list):

if not ssw.ship_switcher.switch_slot_by_id(i-empty_slot_count,id):
#fleet data update
retry += 1
break
if any_vaild_switch == True:
Log.log_msg(f"retrying...")
nav.navigate.to('home')
self.goto()
retry = True
break
else:
return False

else:
retry = 0
any_vaild_switch = True

if id == EMPTY:
empty_slot_count += 1

if retry == 1:
Log.log_msg(f"retrying...")
nav.navigate.to('home')
self.goto()
if retry == True:
continue
elif retry > 1:
return False
else:
break

Expand Down

0 comments on commit 8db91ea

Please sign in to comment.