summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2022-08-31 21:13:10 -0400
committerJune McEnroe <june@causal.agency>2022-08-31 21:13:10 -0400
commited0b67bfde7c4762d95c6132fad8d3fa66c6c76c (patch)
tree4643082f1a2a3fd989844b8b9904ee28ae4b15be
parentFill in some Info.plist fields (diff)
downloadwep-ed0b67bfde7c4762d95c6132fad8d3fa66c6c76c.tar.gz
wep-ed0b67bfde7c4762d95c6132fad8d3fa66c6c76c.zip
Add F5 to restart game
Diffstat (limited to '')
-rw-r--r--freecell.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/freecell.c b/freecell.c
index 28b277e..a346277 100644
--- a/freecell.c
+++ b/freecell.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019  C. McEnroe <june@causal.agency>
+/* Copyright (C) 2019  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
@@ -340,12 +340,14 @@ static enum Choice chooseMove(void) {
 	return choice;
 }
 
+static uint currentGame;
 static void newGame(uint game) {
 	if (!game) game = 1 + randUniform(32000);
 	deal(game);
 	char buf[sizeof("FreeCell Game #32000")];
 	snprintf(buf, sizeof(buf), "FreeCell Game #%u", game);
 	SDL_SetWindowTitle(window, buf);
+	currentGame = game;
 }
 
 static Card hiliteRank;
@@ -355,6 +357,7 @@ static uint fromStack = StacksLen;
 static bool keyDown(SDL_KeyboardEvent key) {
 	switch (key.keysym.sym) {
 		case SDLK_F2: newGame(0); return true;
+		case SDLK_F5: newGame(currentGame); return true;
 		case SDLK_BACKSPACE: return undo();
 	}
 	if (key.repeat) return false;