X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-test.git;a=blobdiff_plain;f=pctb%2Fstructure.c;h=35cf0d9507da3335dbe47df403e9992808bc8e85;hp=0c9750c5f5bd45c4222db71686816dee5b86b464;hb=f8488ba218ce448dc5c02c8d83e85b6c551332eb;hpb=9c4bd3b7b5dde4ec8f37ffde2793437a299b3f2b diff --git a/pctb/structure.c b/pctb/structure.c index 0c9750c..35cf0d9 100644 --- a/pctb/structure.c +++ b/pctb/structure.c @@ -46,6 +46,8 @@ static int colrightx[INTERESTING_COLUMNS]; static int text_h=-1, columns=-1; static OcrReader *rd; +char *archipelago, *island; + #define OTHERCOORD_x y #define OTHERCOORD_y x @@ -468,6 +470,8 @@ void analyse(FILE *tsv_output) { 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) @@ -490,6 +494,7 @@ void analyse(FILE *tsv_output) { sysassert(!fflush(tsv_output)); } } + progress("Commodity table scan complete."); } //static Rect islandnamer; @@ -528,7 +533,6 @@ void find_islandname(void) { debug_rect("sunshiner",1, sunshiner); identify_rgbimage(ri, sunshiner, sunshine, "sunshine widget"); - fprintf(stderr,"sunshine: `%s'\n",sunshine); if (!memcmp(sunshine,"Ship ",5)) { Rect islandnamer; @@ -538,11 +542,8 @@ void find_islandname(void) { 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; @@ -562,15 +563,14 @@ void find_islandname(void) { } 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); }