File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ static int maneuvre_begin_x(int x) {
5656 }
5757}
5858
59- static bool waste_pile_stack (struct stack * stack ) {
59+ bool waste_pile_stack (struct stack * stack ) {
6060 return ((stack -> card -> frame -> begin_y == WASTE_PILE_BEGIN_Y ) &&
6161 (stack -> card -> frame -> begin_x == WASTE_PILE_BEGIN_X ));
6262}
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ struct game {
3838extern struct deck * deck ;
3939extern struct cursor * cursor ;
4040
41+ bool waste_pile_stack (struct stack * );
4142bool maneuvre_stack (struct stack * );
4243bool stock_stack (struct stack * );
4344bool valid_move (struct stack * , struct stack * );
Original file line number Diff line number Diff line change @@ -167,6 +167,19 @@ static void handle_card_movement(struct cursor *cursor) {
167167 move_card (origin , destination );
168168 }
169169 }
170+
171+ /* If they only had one card selected... */
172+ if (* origin == * destination && ((maneuvre_stack (* origin ) && _marked_cards_count == 1 ) || waste_pile_stack (* origin ))) {
173+ /* see if we can automatically move card to foundation */
174+ for (int i = 0 ; i <= 3 ; ++ i ) {
175+ destination = (& (deck -> foundation [i ]));
176+ if (valid_move (* origin , * destination )) {
177+ move_card (origin , destination );
178+ break ;
179+ }
180+ }
181+ }
182+
170183 draw_stack (* origin );
171184 draw_stack (* destination );
172185 if (maneuvre_stack (* origin ) && * origin == * destination ) {
You can’t perform that action at this time.
0 commit comments