From ea9288748517f0851c7a36b8e8d397b4a4e3e8e8 Mon Sep 17 00:00:00 2001 From: Jesper Madsen Date: Mon, 3 Aug 2015 22:20:11 +0200 Subject: [PATCH] Fixed errors regarding two identical galaxies not being identical. Updated to version 0.0.8 --- SWGAide-version.TXT | 4 ++-- swg/SWGConstants.java | 2 +- swg/crafting/resources/SWGResourceCache.java | 8 ++++---- swg/crafting/resources/SWGResourceList.java | 2 +- swg/crafting/resources/SWGResourceMgr.java | 2 +- swg/crafting/resources/SWGResourceSet.java | 2 +- swg/gui/resources/SWGCurrentTab.java | 2 +- swg/gui/resources/SWGInventoryDialog.java | 2 +- swg/gui/resources/SWGInventoryTab.java | 4 ++-- swg/gui/resources/SWGResController.java | 2 +- swg/gui/schematics/SWGTodays.java | 2 +- swg/model/mail/SWGISDroidReport.java | 4 ++-- swg/swgcraft/SWGResourceManager.java | 4 ++-- 13 files changed, 20 insertions(+), 20 deletions(-) diff --git a/SWGAide-version.TXT b/SWGAide-version.TXT index e3b0884..f060a3b 100644 --- a/SWGAide-version.TXT +++ b/SWGAide-version.TXT @@ -1,2 +1,2 @@ -0.9.8-Sobuno-0.0.7 -Wed April 8 23:00:00 CET 2015 +0.9.8-Sobuno-0.0.8 +Mon August 3 22:20:00 CET 2015 diff --git a/swg/SWGConstants.java b/swg/SWGConstants.java index f793e58..618d511 100644 --- a/swg/SWGConstants.java +++ b/swg/SWGConstants.java @@ -70,7 +70,7 @@ public class SWGConstants { /** * The version number of the SWGAide that is available for download. */ - public static final String version = "0.9.8-Sobuno-0.0.7"; + public static final String version = "0.9.8-Sobuno-0.0.8"; /** * Indicates whether we are operating in NGE mode or pre-CU mode diff --git a/swg/crafting/resources/SWGResourceCache.java b/swg/crafting/resources/SWGResourceCache.java index 0db57a6..9cb25fa 100644 --- a/swg/crafting/resources/SWGResourceCache.java +++ b/swg/crafting/resources/SWGResourceCache.java @@ -164,7 +164,7 @@ SWGKnownResource getInstance(String name, SWGCGalaxy galaxy) { throw new NullPointerException("An argument is null"); for (SWGKnownResource kr : cache) { - if (kr.galaxy() == galaxy && kr.getName().equals(name)) + if (kr.galaxy().equals(galaxy) && kr.getName().equals(name)) return kr; } return null; @@ -225,7 +225,7 @@ SWGResourceSet getSet(SWGCGalaxy galaxy) { SWGResourceSet ret = new SWGResourceSet(cache.size()); for (SWGKnownResource kr : cache) { - if (kr.galaxy() == galaxy) + if (kr.galaxy().equals(galaxy)) ret.privateAdd(kr); // we are sure kr is valid } return ret.get(); @@ -283,7 +283,7 @@ SWGResourceSet getType(SWGResourceClass type, SWGCGalaxy galaxy) { SWGResourceSet ret = new SWGResourceSet(cache.size()); Class c = type.getClass(); for (SWGKnownResource kr : cache) { - if (kr.galaxy() == galaxy && kr.rc().isSub(c)) + if (kr.galaxy().equals(galaxy) && kr.rc().isSub(c)) ret.privateAdd(kr); // we are sure kr is valid } return ret.get(); @@ -347,7 +347,7 @@ private static SWGKnownResource contains(SWGResource res) { return kr; if (id > 0 && id == kr.id()) return kr; - if (gx == kr.galaxy() && name.equals(kr.getName())) + if (gx.equals(kr.galaxy()) && name.equals(kr.getName())) return kr; } return null; diff --git a/swg/crafting/resources/SWGResourceList.java b/swg/crafting/resources/SWGResourceList.java index f5e40ef..fc99e1a 100644 --- a/swg/crafting/resources/SWGResourceList.java +++ b/swg/crafting/resources/SWGResourceList.java @@ -246,7 +246,7 @@ public SWGResource getByNameAndGalaxy(String name, SWGCGalaxy galaxy) { + galaxy); for (SWGResource r : storage) - if (r.galaxy() == galaxy && r.getName().equals(name)) + if (r.galaxy().equals(galaxy) && r.getName().equals(name)) return r; return null; diff --git a/swg/crafting/resources/SWGResourceMgr.java b/swg/crafting/resources/SWGResourceMgr.java index f7f4809..c8f9fb0 100644 --- a/swg/crafting/resources/SWGResourceMgr.java +++ b/swg/crafting/resources/SWGResourceMgr.java @@ -680,7 +680,7 @@ else if (isTrusted) // finally, if the former instance is --replaced-- at SWGCraft if (isTrusted && known.getName().equals(other.getName()) - && known.galaxy() == other.galaxy() + && known.galaxy().equals(other.galaxy()) && other.id() > 0 && known.id() < other.id()) { // is-trusted: name and galaxy equals but known is older than other diff --git a/swg/crafting/resources/SWGResourceSet.java b/swg/crafting/resources/SWGResourceSet.java index 5dc385e..7e834ee 100644 --- a/swg/crafting/resources/SWGResourceSet.java +++ b/swg/crafting/resources/SWGResourceSet.java @@ -228,7 +228,7 @@ public SWGKnownResource getBy(String name, SWGCGalaxy galaxy) { + galaxy); for (SWGKnownResource kr : storage) - if (kr.galaxy() == galaxy && kr.getName().equals(name)) + if (kr.galaxy().equals(galaxy) && kr.getName().equals(name)) return kr; return null; diff --git a/swg/gui/resources/SWGCurrentTab.java b/swg/gui/resources/SWGCurrentTab.java index 890704b..b0db346 100644 --- a/swg/gui/resources/SWGCurrentTab.java +++ b/swg/gui/resources/SWGCurrentTab.java @@ -2786,7 +2786,7 @@ private void updateCurrent() { currentResourcesModel.fireTableDataChanged(); // retain the selection, if possible - if (sr != null && sr.galaxy() == SWGFrame.getSelectedGalaxy()) { + if (sr != null && sr.galaxy().equals(SWGFrame.getSelectedGalaxy())) { selectedResource = sr; SWGResourceSet cl = currentGet(); for (int i = 0; i < cl.size(); ++i) { diff --git a/swg/gui/resources/SWGInventoryDialog.java b/swg/gui/resources/SWGInventoryDialog.java index d33b705..7beb65a 100644 --- a/swg/gui/resources/SWGInventoryDialog.java +++ b/swg/gui/resources/SWGInventoryDialog.java @@ -1134,7 +1134,7 @@ private boolean save() { SWGKnownResource kr = wrap.getResource(); if (!kr.rc().isSpaceOrRecycled()) { SWGCGalaxy gxy = getGalaxy(); - if (kr.id() <= 0 && gxy != null && kr.galaxy() != gxy) { + if (kr.id() <= 0 && gxy != null && kr.galaxy().equals(gxy) == false) { SWGMutableResource mr = new SWGMutableResource(kr); mr.galaxy(gxy); SWGResourceManager.updateInstance(kr, mr); diff --git a/swg/gui/resources/SWGInventoryTab.java b/swg/gui/resources/SWGInventoryTab.java index a9e845c..c4f6b8f 100644 --- a/swg/gui/resources/SWGInventoryTab.java +++ b/swg/gui/resources/SWGInventoryTab.java @@ -2313,7 +2313,7 @@ private String notesShaveString(String string) { */ private void notesWrite(SWGInventoryWrapper w, ZString z) { if (!w.getResource().rc().isSpaceOrRecycled() - && w.getResource().galaxy() != recentGalaxy) { + && w.getResource().galaxy().equals(recentGalaxy) == false) { SWGCGalaxy g = w.getResource().galaxy(); z.app("(").app(g != null ? g.getName() @@ -3119,7 +3119,7 @@ public Object getValueAt(int row, int col) { return wrapper.getAssignee(); case 1: { SWGCGalaxy g = kr.galaxy(); - return g != recentGalaxy && g != null + return g.equals(recentGalaxy) == false && g != null ? String.format(gxyfmt, g.getName(), kr.getName()) : kr.getName(); } diff --git a/swg/gui/resources/SWGResController.java b/swg/gui/resources/SWGResController.java index 9417890..336172d 100644 --- a/swg/gui/resources/SWGResController.java +++ b/swg/gui/resources/SWGResController.java @@ -2082,7 +2082,7 @@ static SWGResourceClass resourceClassFrom(String rcName) { */ public static void resourceDetails(SWGKnownResource kr, ZString z) { SWGCGalaxy gxy = SWGFrame.getSelectedGalaxy(); - if (kr.galaxy() != gxy) z.app('(').app(gxy.getName()).app(')'); + if (kr.galaxy().equals(gxy) == false) z.app('(').app(gxy.getName()).app(')'); z.appnl(kr.getName()).app(kr.rc().rcName()); z.app("\tAge: ").appnl( SWGResController.dateString(kr.age())); kr.stats().toString(z, true); diff --git a/swg/gui/schematics/SWGTodays.java b/swg/gui/schematics/SWGTodays.java index de4477a..718f318 100644 --- a/swg/gui/schematics/SWGTodays.java +++ b/swg/gui/schematics/SWGTodays.java @@ -1095,7 +1095,7 @@ private String tripletDetails(Triplet tri) { z.app("").app(FS); z.app("Inventory: ").app(FS); SWGKnownResource kr = tri.inventory.getResource(); - if (kr.galaxy() != SWGFrame.getSelectedGalaxy()) + if (kr.galaxy().equals(SWGFrame.getSelectedGalaxy()) == false) z.app('(').app(kr.galaxy().getName()).app(')'); z.app(kr.getName()).app(" --- "); z.app(tri.inventory.getResource().rc().rcName()); diff --git a/swg/model/mail/SWGISDroidReport.java b/swg/model/mail/SWGISDroidReport.java index 2d418c0..b4245f5 100644 --- a/swg/model/mail/SWGISDroidReport.java +++ b/swg/model/mail/SWGISDroidReport.java @@ -127,7 +127,7 @@ public int compareTo(SWGISDroidReport o) { */ @SuppressWarnings("synthetic-access") public List depleted(SWGResourceSet inSpawn) { - if (!inSpawn.isEmpty() && inSpawn.get(0).galaxy() != gxy()) + if (!inSpawn.isEmpty() && inSpawn.get(0).galaxy().equals(gxy()) == false) throw new IllegalArgumentException("Wrong galaxy"); // reduce the collection -> planet -> resource class @@ -486,7 +486,7 @@ public boolean equals(Object obj) { if (obj instanceof Wrapper) { Wrapper o = (Wrapper) obj; return mutable.getName().equals(o.mutable.getName()) - && mutable.galaxy() == o.mutable.galaxy(); + && mutable.galaxy().equals(o.mutable.galaxy()); } return false; } diff --git a/swg/swgcraft/SWGResourceManager.java b/swg/swgcraft/SWGResourceManager.java index 541ea29..f9ec3f9 100644 --- a/swg/swgcraft/SWGResourceManager.java +++ b/swg/swgcraft/SWGResourceManager.java @@ -789,7 +789,7 @@ private static SWGKnownResource helperKnown(SWGMutableResource mr) { updateInstance(kr, mr, true); return kr; } - if (kr.galaxy() == mr.galaxy()) + if (kr.galaxy().equals(mr.galaxy())) return kr; else if (kr.isDepleted()) SWGResourceMgr.remove(kr); // remove from general map @@ -1243,7 +1243,7 @@ public static SWGSoapStatusResponse sendNew( // from SWGCraft.org kr = getKnown(mr); - if (mr.galaxy() != kr.galaxy()) { + if (mr.galaxy().equals(kr.galaxy()) == false) { // trust the caller to be sending for the proper galaxy kr = getKnownTrusted(mr); }