chiark / gitweb /
show a message in the resultSummary if PCTB is lacking commods
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 5 Sep 2010 13:06:48 +0000 (14:06 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 5 Sep 2010 13:06:48 +0000 (14:06 +0100)
src/com/tedpearson/ypp/market/MarketUploader.java

index f8437f9..5fb927a 100644 (file)
@@ -40,6 +40,7 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
        private JButton findMarket = null;
        private JLabel resultSummary = null;
        private JLabel arbitrageResult = null;
+        private int unknownPCTBcommods = 0;
         private long startTime = 0;
 
        private final static String PCTB_LIVE_HOST_URL = "http://pctb.crabdance.com/";
@@ -297,6 +298,7 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
                                                startTime = new Date().getTime();
                                                resultSummary.setText("");
                                                arbitrageResult.setText("");
+                                               unknownPCTBcommods = 0;
                                                try {
                                                        runUpload();
                                                } catch(Exception e) {
@@ -607,6 +609,8 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
                if ((uploadToPCTB && !donepctb) ||
                    (uploadToYarrg && !doneyarrg)) {
                        resultSummary.setText("trouble");
+               } else if (unknownPCTBcommods != 0) {
+                       resultSummary.setText("PCTB lacks "+unknownPCTBcommods+" commod");
                } else if (donepctb || doneyarrg) {
                        resultSummary.setText("Done " + islandName);
                } else {
@@ -810,6 +814,7 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
                                        buySellCount[1]++;
                                }
                        } catch(IllegalArgumentException e) {
+                               unknownPCTBcommods++;
                                if (dtxt!=null) dtxt.println("Error: Unsupported Commodity \"" + offer.get(0) + "\"");
                        }
                }