diff --git a/src/cursor.c b/src/cursor.c index 0f08a0a..a1a3fa8 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -44,7 +44,6 @@ void move_cursor(struct cursor *cursor, enum movement movement) { switch (movement) { case LEFT: if (cursor->x > CURSOR_BEGIN_X) { - erase_cursor(cursor); cursor->x = cursor->x - 8; if (cursor->y > CURSOR_BEGIN_Y) { move_cursor(cursor, UP); @@ -54,7 +53,6 @@ void move_cursor(struct cursor *cursor, enum movement movement) { break; case DOWN: if (cursor->y == CURSOR_BEGIN_Y) { - erase_cursor(cursor); switch (cursor->x - 3) { case MANEUVRE_0_BEGIN_X: cursor->y = cursor->y + 7 + length(deck->maneuvre[0]); @@ -82,7 +80,6 @@ void move_cursor(struct cursor *cursor, enum movement movement) { break; case RIGHT: if (cursor->x < 49) { - erase_cursor(cursor); cursor->x = cursor->x + 8; if (cursor->y > CURSOR_BEGIN_Y) { move_cursor(cursor, UP); @@ -92,7 +89,6 @@ void move_cursor(struct cursor *cursor, enum movement movement) { break; case UP: if (cursor->y > 1) { - erase_cursor(cursor); cursor->y = CURSOR_BEGIN_Y; } break; diff --git a/src/keyboard.c b/src/keyboard.c index c301d40..0b6e865 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -72,21 +72,25 @@ static void handle_card_movement(struct cursor *cursor) { return; case 'h': case KEY_LEFT: + erase_cursor(cursor); move_cursor(cursor, LEFT); draw_cursor(cursor); break; case 'j': case KEY_DOWN: + erase_cursor(cursor); move_cursor(cursor, DOWN); draw_cursor(cursor); break; case 'k': case KEY_UP: + erase_cursor(cursor); move_cursor(cursor, UP); draw_cursor(cursor); break; case 'l': case KEY_RIGHT: + erase_cursor(cursor); move_cursor(cursor, RIGHT); draw_cursor(cursor); break; @@ -97,6 +101,11 @@ static void handle_card_movement(struct cursor *cursor) { move_card(origin, destination); draw_stack(*origin); draw_stack(*destination); + if (maneuvre_stack(*destination) && length(*destination) > 1) { + erase_cursor(cursor); + cursor->y++; + draw_cursor(cursor); + } } unmark_cursor(cursor); draw_cursor(cursor); @@ -114,21 +123,25 @@ void handle_keyboard_event(int key) { switch (key) { case 'h': case KEY_LEFT: + erase_cursor(cursor); move_cursor(cursor, LEFT); draw_cursor(cursor); break; case 'j': case KEY_DOWN: + erase_cursor(cursor); move_cursor(cursor, DOWN); draw_cursor(cursor); break; case 'k': case KEY_UP: + erase_cursor(cursor); move_cursor(cursor, UP); draw_cursor(cursor); break; case 'l': case KEY_RIGHT: + erase_cursor(cursor); move_cursor(cursor, RIGHT); draw_cursor(cursor); break;