static int text_h=-1, columns=-1;
static OcrReader *rd;
+char *archipelago, *island;
+
#define OTHERCOORD_x y
#define OTHERCOORD_y x
if (!rd)
rd= ocr_init(text_h);
+ progress("Scanning page %d...",page);
+
for (tryrect= +cim->h; tryrect >= -cim->h; tryrect--) {
find_commodity(tryrect, &thisr);
if (thisr.tl.x < 0)
sysassert(!fflush(tsv_output));
}
}
+ progress("Commodity table scan complete.");
}
//static Rect islandnamer;
debug_rect("sunshiner",1, sunshiner);
identify_rgbimage(ri, sunshiner, sunshine, "sunshine widget");
- fprintf(stderr,"sunshine: `%s'\n",sunshine);
- if (!memcmp(sunshine,"Ship ",5)) {
+ if (!memcmp(sunshine,"Vessel ",5)) {
Rect islandnamer;
islandnamer.tl.x= cim->w - 1034 + 885;
islandnamer.tl.y= 128;
islandnamer.br.y= 156;
-#define IR_VSHRINK_MUST(CONDMUST,PRWHY) \
- do{ if (!(CONDMUST)) goto not_in_radar; }while(0)
-
- ADJUST_BOX(islandnamer,"o",5, 0, IR_VSHRINK_MUST, tl,y,+1);
- ADJUST_BOX(islandnamer,"o",5, cim->h, IR_VSHRINK_MUST, br,y,-1);
+ ADJUST_BOX(islandnamer,"o",5, 0, MUST, tl,y,+1);
+ ADJUST_BOX(islandnamer,"o",5, cim->h, MUST, br,y,-1);
debug_rect("islandnamer",0, islandnamer);
// int larger_islandnamebry= islandnamer.tl.y + 25;
}
identify_rgbimage(ri, islandnamer, archisland, "island");
- fprintf(stderr,"radar: `%s'\n",archisland);
-
- assert(!"radar ok");
-
- not_in_radar:
- assert(!"not in radar?");
} else {
assert(!"not vessel");
}
+ char *delim= strstr(archisland," - ");
+ assert(delim);
+ archipelago= masprintf("%.*s", delim-archisland, archisland);
+ island= masprintf("%s", delim+3);
+
free(ri);
}