From fe82240f95853426750fcd751e72f739d466b7d7 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Tue, 23 Jan 2018 21:52:53 -0500 Subject: Add autoFound Still messy though. --- bin/klon.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/klon.c b/bin/klon.c index 8267b25a..0e0e3d4c 100644 --- a/bin/klon.c +++ b/bin/klon.c @@ -155,6 +155,13 @@ static bool canTable(const struct Stack *table, uint8_t card) { return (card & MASK_RANK) == (get(table, 0) & MASK_RANK) - 1; } +static struct Stack *autoFound(uint8_t card) { + for (int i = 0; i < 4; ++i) { + if (canFound(&g.found[i], card)) return &g.found[i]; + } + return NULL; +} + enum { PAIR_EMPTY = 1, PAIR_BACK, @@ -241,7 +248,7 @@ static void render(void) { x = 2; for (int i = 0; i < 7; ++i) { y = 5; - // FIXME: Render empty. + renderCard(y, x, 0); for (int j = len(&g.table[i]); j > 0; --j) { renderCard(y, x, get(&g.table[i], j - 1)); y++; @@ -275,8 +282,6 @@ static void cancel(void) { depth = 0; } -#define ESC (0x1B) - int main() { curse(); @@ -299,6 +304,15 @@ int main() { } else { cancel(); } + } else if ((c == 'f' || c == '\n') && depth == 1) { + struct Stack *found = autoFound(get(src, 0)); + if (found) { + transfer(found, src, depth); + src = NULL; + depth = 0; + } else { + cancel(); + } } else if (c >= '1' && c <= '7') { if (src == &g.table[c - '1']) { deepen(); -- cgit 1.4.1 d' value='babd3b0a6c4715bba573ffdf7bd07eac62b8cd0f'/>
path: root/chat.c (unfollow)
Commit message (Expand)Author
2020-02-10Synthesize a QUIT message to handle on exitJune McEnroe
2020-02-10Factor out XDG base directory codeJune McEnroe
2020-02-10Leave a blank line after loaded bufferJune McEnroe
2020-02-10Add -s to save and load buffersJune McEnroe
2020-02-10Show heat and other unread in titleJune McEnroe
2020-02-10Eliminate array in hashJune McEnroe
2020-02-10Add -HJune McEnroe
2020-02-10Hash to colors in the range 2-75June McEnroe
2020-02-10Improve color fudgingJune McEnroe
2020-02-10Support all 99 IRC colorsJune McEnroe
2020-02-10Avoid coloring mentions if there are control codesJune McEnroe
2020-02-10Recalculate unreadLines on reflowJune McEnroe
2020-02-10Only make windows hotterJune McEnroe
2020-02-10Always increase unreadLinesJune McEnroe
2020-02-10Move scroll marker on resizeJune McEnroe
2020-02-10Update line count for words longer than linesJune McEnroe
2020-02-10Simplify mark, heat, unread trackingJune McEnroe
2020-02-10Update prompt when own nick changesJune McEnroe
2020-02-10Match URLs surrounded by parenthesesJune McEnroe
2020-02-10Fix M-a so it properly cycles back to where it startedJune McEnroe
2020-02-09Add M-lJune McEnroe
2020-02-09Add /whoisJune McEnroe
2020-02-09Add /msgJune McEnroe