chiark / gitweb /
routesearch: show route distances
[ypp-sc-tools.db-test.git] / yarrg / structure.c
index 8aae1c4ac853998acf2de388e60af4d1065d040f..46b6853339580cb6df798fc3b28c835b95b7c59b 100644 (file)
@@ -444,11 +444,16 @@ void find_structure(const CanonImage *im,
 }                  
 
 void check_correct_commodities(void) {
-  Rect search= { { 50,39 }, { 130,59 } };
+  Rect search;
 
+  search.tl= s.mr.tl;  search.tl.x +=  34;  search.tl.y -= 44;
+  search.br= s.mr.tl;  search.br.x += 114;  search.br.y -= 23;
+  MUST(search.br.x < cim->w-1 && search.tl.y > 0,
+       MR(search);MI(cim->w);MI(cim->h));
+  
+  debug_rect("commodselr",0, search);
   ADJUST_BOX(search,"_",>=,10, cim->h, MUST, tl,y,+1);
   ADJUST_BOX(search,"_",>=,10, 0,      MUST, br,y,-1);
-
   debug_rect("commodselr",1, search);
 
   static const char *all_small[]= {
@@ -479,6 +484,19 @@ void check_correct_commodities(void) {
     "??____X_____?_X_?X__?X_______________________",
     "???__?_______?__?___?_______________________?",
   };
+  static const char *all_fuzzy[]= {
+    "???___________________________________???",
+    "??_______???___X__X____________________??",
+    "?_______????__?X_?X_____XXXXXXXXXXX_____?",
+    "________?????_?X_?X______XXXXXXXXX_______",
+    "________?????_?X_?X_______XXXXXXX________",
+    "_______??????_?X_?X________XXXXX_________",
+    "_______??_?????X_?X_________XXX__________",
+    "______??XXXXX??X_?X__________X___________",
+    "?_____?????????X_?X______________________",
+    "??___???____???X_?X______________________",
+    "???__??_____???__?______________________?",
+  };
 
 #define COMMOD_SELECTOR_MATCHES(all)                           \
   commod_selector_matches(search, all,                         \
@@ -486,7 +504,8 @@ void check_correct_commodities(void) {
                          strlen((all)[0]))
 
   if (!(COMMOD_SELECTOR_MATCHES(all_small) ||
-       COMMOD_SELECTOR_MATCHES(all_big)))
+       COMMOD_SELECTOR_MATCHES(all_big) ||
+       COMMOD_SELECTOR_MATCHES(all_fuzzy)))
     fatal("Commodities selector not set to `All'.");
 }
 
@@ -1038,7 +1057,7 @@ void check_pager_motion(int first, int stop) {
   if (count <= 1) return; /* only one page */
 
   double firstheight= PH(first);
-  double max= count>2 ? firstheight / (count-2) : 0;
+  double max= count>2 ? firstheight / (count-2) : 1e6;
   double min=           firstheight / (count-1);
   max *= 1.1;
   min /= 1.1;