diff options
Diffstat (limited to 'bin/freecell.c')
-rw-r--r-- | bin/freecell.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/bin/freecell.c b/bin/freecell.c index 762b5552..fbc0fe22 100644 --- a/bin/freecell.c +++ b/bin/freecell.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019, 2021 C. McEnroe <june@causal.agency> +/* Copyright (C) 2019, 2021 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -173,10 +173,9 @@ static void moveSingle(uint dst, uint src) { enq(dst, src); } -static uint freeCells(uint cells[static Stacks], uint dst) { +static uint freeCells(uint cells[static 4]) { uint len = 0; - for (uint i = Cell; i < Stacks; ++i) { - if (i == dst) continue; + for (uint i = Cell; i < Tableau; ++i) { if (!stacks[i].len) cells[len++] = i; } return len; @@ -195,8 +194,8 @@ static uint moveDepth(uint src) { static void moveColumn(uint dst, uint src) { uint depth; - uint cells[Stacks]; - uint free = freeCells(cells, dst); + uint cells[4]; + uint free = freeCells(cells); for (depth = moveDepth(src); depth; --depth) { if (free < depth-1) continue; if (valid(dst, stacks[src].cards[stacks[src].len-depth])) break; @@ -285,7 +284,7 @@ static void draw(void) { char key; if (i < Cell) { y = FoundationY; - x = FoundationX + (i-Foundation) * (CardWidth+Padding); + x = FoundationX + (3-(i-Foundation)) * (CardWidth+Padding); key = '_'; } else if (i < Tableau) { y = CellY; |