shithub: puzzles

Download patch

ref: 64e6afdeedcf3f22282524ebd36e3393736fed65
parent: e96f53452ac06e6b533a30d4caad30dd0dbe46fb
author: Simon Tatham <anakin@pobox.com>
date: Wed Apr 28 13:46:04 EDT 2004

Have each game declare a name which is used for window titles etc.

[originally from svn r4167]

--- a/cube.c
+++ b/cube.c
@@ -10,6 +10,8 @@
 
 #include "puzzles.h"
 
+const char *const game_name = "Cube";
+
 #define MAXVERTICES 20
 #define MAXFACES 20
 #define MAXORDER 4
--- a/gtk.c
+++ b/gtk.c
@@ -314,6 +314,7 @@
     midend_new_game(fe->me, NULL);
 
     fe->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    gtk_window_set_title(GTK_WINDOW(fe->window), game_name);
 #if 0
     gtk_window_set_resizable(GTK_WINDOW(fe->window), FALSE);
 #else
--- a/net.c
+++ b/net.c
@@ -11,6 +11,8 @@
 #include "puzzles.h"
 #include "tree234.h"
 
+const char *const game_name = "Net";
+
 #define PI 3.141592653589793238462643383279502884197169399
 
 #define MATMUL(xr,yr,m,x,y) do { \
--- a/puzzles.h
+++ b/puzzles.h
@@ -93,6 +93,7 @@
 /*
  * Game-specific routines
  */
+extern const char *const game_name;
 game_params *default_params(void);
 int game_fetch_preset(int i, char **name, game_params **params);
 void free_params(game_params *params);
--- a/windows.c
+++ b/windows.c
@@ -234,7 +234,7 @@
 		       (WS_THICKFRAME | WS_MAXIMIZEBOX | WS_OVERLAPPED),
 		       TRUE, 0);
 
-    fe->hwnd = CreateWindowEx(0, "puzzle", "puzzle",
+    fe->hwnd = CreateWindowEx(0, game_name, game_name,
 			      WS_OVERLAPPEDWINDOW &~
 			      (WS_THICKFRAME | WS_MAXIMIZEBOX),
 			      CW_USEDEFAULT, CW_USEDEFAULT,
@@ -489,7 +489,7 @@
 	wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
 	wndclass.hbrBackground = NULL;
 	wndclass.lpszMenuName = NULL;
-	wndclass.lpszClassName = "puzzle";
+	wndclass.lpszClassName = game_name;
 
 	RegisterClass(&wndclass);
     }