mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-12 00:28:20 +08:00
Fix: Handle random swipe bug during full scan
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import copy
|
||||
|
||||
import numpy as np
|
||||
|
||||
from module.base.utils import location2node, node2location
|
||||
from module.logger import logger
|
||||
from module.map_detection.grid_info import GridInfo
|
||||
from module.map.map_grids import SelectedGrids
|
||||
from module.map_detection.grid_info import GridInfo
|
||||
|
||||
|
||||
def location_ensure(location):
|
||||
@@ -179,14 +181,24 @@ class CampaignMap:
|
||||
"""
|
||||
offset = np.array(camera) - np.array(grids.center_loca)
|
||||
grids.show()
|
||||
|
||||
failed_count = 0
|
||||
for grid in grids.grids.values():
|
||||
loca = tuple(offset + grid.location)
|
||||
if loca in self.grids:
|
||||
success = self.grids[loca].merge(grid, mode=mode)
|
||||
if not success:
|
||||
if not copy.copy(self.grids[loca]).merge(grid, mode=mode):
|
||||
logger.warning(f"Wrong Prediction. {self.grids[loca]} = '{grid.str}'")
|
||||
failed_count += 1
|
||||
|
||||
return True
|
||||
if failed_count < 2:
|
||||
for grid in grids.grids.values():
|
||||
loca = tuple(offset + grid.location)
|
||||
if loca in self.grids:
|
||||
self.grids[loca].merge(grid, mode=mode)
|
||||
return True
|
||||
else:
|
||||
logger.warning('Too many wrong prediction')
|
||||
return False
|
||||
|
||||
def reset(self):
|
||||
for grid in self:
|
||||
|
||||
Reference in New Issue
Block a user