chiark / gitweb /
show a message in the resultSummary if PCTB is lacking commods
[jarrg-ian.git] / src / com / tedpearson / ypp / market / MarketUploader.java
index f8437f94d85758511f7f1067076cba4f3c56238f..5fb927a358d21b725c925f26f020e3e525aaebe4 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) + "\"");
                        }
                }