mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-22 16:32:13 -07:00
Added an automatic `Solve' feature to most games. This is useful for
various things: - if you haven't fully understood what a game is about, it gives you an immediate example of a puzzle plus its solution so you can understand it - in some games it's useful to compare your solution with the real one and see where you made a mistake - in the rearrangement games (Fifteen, Sixteen, Twiddle) it's handy to be able to get your hands on a pristine grid quickly so you can practise or experiment with manoeuvres on it - it provides a good way of debugging the games if you think you've encountered an unsolvable grid! [originally from svn r5731]
This commit is contained in:
23
windows.c
23
windows.c
@ -28,11 +28,12 @@
|
||||
#define IDM_UNDO 0x0030
|
||||
#define IDM_REDO 0x0040
|
||||
#define IDM_COPY 0x0050
|
||||
#define IDM_QUIT 0x0060
|
||||
#define IDM_CONFIG 0x0070
|
||||
#define IDM_SEED 0x0080
|
||||
#define IDM_HELPC 0x0090
|
||||
#define IDM_GAMEHELP 0x00A0
|
||||
#define IDM_SOLVE 0x0060
|
||||
#define IDM_QUIT 0x0070
|
||||
#define IDM_CONFIG 0x0080
|
||||
#define IDM_SEED 0x0090
|
||||
#define IDM_HELPC 0x00A0
|
||||
#define IDM_GAMEHELP 0x00B0
|
||||
#define IDM_PRESETS 0x0100
|
||||
|
||||
#define HELP_FILE_NAME "puzzles.hlp"
|
||||
@ -487,6 +488,10 @@ static frontend *new_window(HINSTANCE inst, char *game_id, char **error)
|
||||
AppendMenu(menu, MF_SEPARATOR, 0, 0);
|
||||
AppendMenu(menu, MF_ENABLED, IDM_COPY, "Copy");
|
||||
}
|
||||
if (thegame.can_solve) {
|
||||
AppendMenu(menu, MF_SEPARATOR, 0, 0);
|
||||
AppendMenu(menu, MF_ENABLED, IDM_SOLVE, "Solve");
|
||||
}
|
||||
AppendMenu(menu, MF_SEPARATOR, 0, 0);
|
||||
AppendMenu(menu, MF_ENABLED, IDM_QUIT, "Exit");
|
||||
if (fe->help_path) {
|
||||
@ -930,6 +935,14 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
MessageBeep(MB_ICONWARNING);
|
||||
}
|
||||
break;
|
||||
case IDM_SOLVE:
|
||||
{
|
||||
char *msg = midend_solve(fe->me);
|
||||
if (msg)
|
||||
MessageBox(hwnd, msg, "Unable to solve",
|
||||
MB_ICONERROR | MB_OK);
|
||||
}
|
||||
break;
|
||||
case IDM_QUIT:
|
||||
if (!midend_process_key(fe->me, 0, 0, 'q'))
|
||||
PostQuitMessage(0);
|
||||
|
Reference in New Issue
Block a user