diff --git a/src/engine/InterestManagement/RealmMap.java b/src/engine/InterestManagement/RealmMap.java index eda74ef8..a1a037ec 100644 --- a/src/engine/InterestManagement/RealmMap.java +++ b/src/engine/InterestManagement/RealmMap.java @@ -37,11 +37,13 @@ public enum RealmMap { // a player is currently located within. public static int[][] _realmImageMap; - private static final HashMap _rgbToIDMap = new HashMap<>(); + private static final HashMap _rgbToIDMap = new HashMap<>(); - public static int getRealmIDByRGB(int realmRGB) { + public static int getRealmIDByColor(Color color) { - return _rgbToIDMap.get(realmRGB); + int realmID = _rgbToIDMap.get(color); + + return realmID; } @@ -60,7 +62,7 @@ public enum RealmMap { } public static void addToColorMap(Color color, int realmID) { - _rgbToIDMap.put(color.getRGB(), realmID); + _rgbToIDMap.put(color, realmID); } public static Realm getRealmForCity(City city) { diff --git a/src/engine/util/MapLoader.java b/src/engine/util/MapLoader.java index e13eb553..efbbbf46 100644 --- a/src/engine/util/MapLoader.java +++ b/src/engine/util/MapLoader.java @@ -50,16 +50,16 @@ public enum MapLoader { for (int i = 0; i < MBServerStatics.SPATIAL_HASH_BUCKETSY; i++) { for (int j = 0; j < MBServerStatics.SPATIAL_HASH_BUCKETSX; j++) { try { - int rgb = image.getRGB(j, i); - realmUUID = RealmMap.getRealmIDByRGB(rgb); - - realmMap[j][i] = realmUUID; - bytesRead++; + Color pixelColor = new Color(image.getRGB(j, i)); + realmUUID = RealmMap.getRealmIDByColor(pixelColor); - if (realmUUID != 0) - realmsWritten++; + realmMap[j][i] = realmUUID; + bytesRead++; - }catch (Exception e){ + if (realmUUID != 0) + realmsWritten++; + + }catch (Exception e){ continue; }