diff options
author | syeyoung <cyong06@naver.com> | 2021-07-26 11:18:24 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-07-26 11:18:24 +0900 |
commit | 132378adb3407b1238c3958070c584fdb3adb6cd (patch) | |
tree | fd3216b4279c79a8afd6f129661c8612ff77fee1 /src/main/java/kr/syeyoung/dungeonsguide/dungeon | |
parent | f3626ed31e844393da1a293eab8e4aa760a8de06 (diff) | |
download | Skyblock-Dungeons-Guide-132378adb3407b1238c3958070c584fdb3adb6cd.tar.gz Skyblock-Dungeons-Guide-132378adb3407b1238c3958070c584fdb3adb6cd.tar.bz2 Skyblock-Dungeons-Guide-132378adb3407b1238c3958070c584fdb3adb6cd.zip |
Fix tabbed pane not setting parent
Fix RoomMatcher only detecting for rotation=1
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon')
-rwxr-xr-x | src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java | 4 | ||||
-rwxr-xr-x | src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java | 24 |
2 files changed, 15 insertions, 13 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java index 479762cb..fd659596 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java @@ -119,6 +119,7 @@ public class DungeonRoomInfoRegistry { fis.close(); register(dri); } catch (Exception e) { + System.out.println(name); e.printStackTrace(); } } @@ -132,7 +133,8 @@ public class DungeonRoomInfoRegistry { ois.close(); fis.close(); register(dri); - } catch (Exception e) {e.printStackTrace();} + } catch (Exception e) { + System.out.println(f.getName());e.printStackTrace();} } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java index 9c20bdf9..9052ba3e 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java @@ -60,6 +60,9 @@ public class RoomMatcher { } triedMatch = true; + int lowestcost = 10; + int lowestRot = 0; + DungeonRoomInfo bestMatch = null; for (int rotation = 0; rotation < 4; rotation++) { short shape = dungeonRoom.getShape(); for (int j = 0; j<rotation; j++) @@ -67,26 +70,23 @@ public class RoomMatcher { shape = ShortUtils.topLeftifyInt(shape); List<DungeonRoomInfo> roomInfoList = DungeonRoomInfoRegistry.getByShape(shape); - int lowestcost = Integer.MAX_VALUE; - DungeonRoomInfo bestMatch = null; for (DungeonRoomInfo roomInfo : roomInfoList) { int cost = tryMatching(roomInfo, rotation); -// if () { -// match = roomInfo; -// this.rotation = rotation; -// return match; -// } + if (cost == 0) { + match = roomInfo; + this.rotation = rotation; + return match; + } if (cost < lowestcost) { lowestcost = cost; bestMatch = roomInfo; - if (cost == 0) break; + lowestRot = rotation; } } - match = bestMatch; - this.rotation = rotation; - return bestMatch; } - return null; + match = bestMatch; + this.rotation = lowestRot; + return bestMatch; } private int tryMatching(DungeonRoomInfo dungeonRoomInfo, int rotation) { |