From f8a12a4fbecc49d161e2d30ca642112d8ebd5dbc Mon Sep 17 00:00:00 2001 From: girst Date: Mon, 3 Dec 2018 21:41:02 +0100 Subject: [PATCH] fix spider:foundation-overlap for unicode_small_mono (req. cleanup) --- schemes.h | 7 ++++++- sol.c | 7 ++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/schemes.h b/schemes.h index 7ff231b..fbb34bd 100644 --- a/schemes.h +++ b/schemes.h @@ -12,6 +12,8 @@ struct scheme { char** placeholder; char** halfstack; /* left half of stack (for spider) */ int* halfcard; /* byte offset of right half of cards (for spider) */ + int halfwidth[3]; /* printed width of halfstack([0]) and halfcard([1]), + byte width of halfcard([2]) */ }; #define ULCARD(s, r) (char*[]) \ @@ -77,6 +79,7 @@ const struct scheme unicode_large_mono = { "╰─" }, .halfcard = (int[]){6, 6, 4, 6}, + .halfwidth = {2, 3, 999}, }; const struct scheme unicode_large_color = { .width = 5, @@ -130,6 +133,7 @@ const struct scheme unicode_large_color = { "╰─" }, .halfcard = (int[]){6, 16, 4, 6}, + .halfwidth = {2, 3, 999}, }; const struct scheme unicode_small_mono = { .width = 2, @@ -166,7 +170,8 @@ const struct scheme unicode_small_mono = { }, .facedown = (char*[]){"🂠 "}, .placeholder = (char*[]){"❲❳"}, - .halfstack = (char*[]){"🂠 "}, + .halfstack = (char*[]){"🂠"}, .halfcard = (int[]){0}, + .halfwidth = {1, 1, 4}, }; #endif diff --git a/sol.c b/sol.c index 2a9d15f..713d529 100644 --- a/sol.c +++ b/sol.c @@ -517,8 +517,9 @@ void print_table(int highlight) { //{{{ else printf ("%s", op.s->halfstack[line]); } /* spacer: */ //TODO: urgh! cleanup! also breaks on unicode_small_mono! - int xx = 0; for(int i=0;ihalfwidth[0]; //TODO: magic values! + int RIGHTWIDTH = op.s->halfwidth[1]; //TODO: magic values! for (int i = f.z?(f.z/10-1)*HALFWIDTH + op.s->width:0; i < NUM_PILES*op.s->width - ((xx?(xx-1)*RIGHTWIDTH:0)+op.s->width); i++) @@ -526,7 +527,7 @@ void print_table(int highlight) { //{{{ /* foundation (overlapping): */ for (int i = 0; i < NUM_DECKS*NUM_SUITS; i++) { int overlap = i? op.s->halfcard[line]: 0; - if (f.f[i][RANK_K]) printf ("%s", + if (f.f[i][RANK_K]) printf ("%.*s", op.s->halfwidth[2], op.s->card[f.f[i][RANK_K]][line]+overlap); } printf("\n"); -- 2.39.3