chiark / gitweb /
WIP routesearch; route high table
[ypp-sc-tools.main.git] / yarrg / rscommon.h
index 79f38a4d05eca36e718365758a55e7d234c78c7d..bdcc15759705bb5667d26583bdbd63315536d642 100644 (file)
 #define COUNTER_LIST                           \
    CTR(commodities_loaded)                     \
    CTR(trades_loaded)                          \
+   CTR(islands_arbitrage)                      \
+   CTR(ipairs_relevant)                                \
    CTR(quantities_loaded)                      \
    CTR(routes_considered)                      \
-   CTR(routes_eliminated)                      \
+   CTR(routes_quickelim)                       \
+   CTR(routes_stratelim)                       \
    CTR(routes_valued)                          \
+   CTR(newbests_strat_absolute)                        \
+   CTR(newbests_strat_perleague)                       \
    CTR(subroute_tails_valued)                  \
    CTR(subroutes_valued)                       \
    CTR(subroutes_nonempty)
@@ -123,9 +128,40 @@ extern char **archnames;
 extern int *islandid2arch;
 
 
+#define NEW(ptr) ((ptr)= mmalloc(sizeof(*ptr)))
+
+#define MCALLOC(array, count) ((array)= mcalloc(sizeof(*(array)) * (count)))
+
+#define MCALLOC_INITEACH(array, count, init_this) ({                   \
+    MCALLOC((array), (count));                                         \
+    int initi;                                                         \
+    typeof(&(array)[0]) this;                                          \
+    for (initi=0, this=(array); initi<(count); initi++, this++) {      \
+      init_this;                                                       \
+    }                                                                  \
+  })
+
+
+typedef struct {
+  double value;
+  PotentialResult *pr;
+} HighScoreEntry;
+
+extern int nhighscores_absolute, nhighscores_perleague;
+extern HighScoreEntry *highscores_absolute;
+extern HighScoreEntry *highscores_perleague;
+
+
 #define ONDEMAND(pointer_lvalue, calloc_size_count)                         \
   ((pointer_lvalue) ? :                                                             \
    ((pointer_lvalue) = mcalloc(sizeof(*(pointer_lvalue)) * calloc_size_count)))
 
 
+static inline int isle2arch(int isle) {
+  int arch= islandid2arch[isle];
+  assert(arch>=0);
+  return arch;
+}
+
+
 #endif /*RSCOMMON_H*/