shithub: puzzles

Download patch

ref: ee171498221e701d446fd1bf18c5e1c5771ef128
parent: 44ff00665b271ffc789d750d8ad2e5cf25e5327d
author: Simon Tatham <anakin@pobox.com>
date: Sun May 2 06:43:46 EDT 2004

`BOOLEAN' is a term already used by Win32. Bah. Change terminology.

[originally from svn r4183]

--- a/cube.c
+++ b/cube.c
@@ -450,24 +450,24 @@
     char buf[80];
 
     ret[0].name = "Type of solid";
-    ret[0].type = CHOICES;
+    ret[0].type = C_CHOICES;
     ret[0].sval = ":Tetrahedron:Cube:Octahedron:Icosahedron";
     ret[0].ival = params->solid;
 
     ret[1].name = "Width / top";
-    ret[1].type = STRING;
+    ret[1].type = C_STRING;
     sprintf(buf, "%d", params->d1);
     ret[1].sval = dupstr(buf);
     ret[1].ival = 0;
 
     ret[2].name = "Height / bottom";
-    ret[2].type = STRING;
+    ret[2].type = C_STRING;
     sprintf(buf, "%d", params->d2);
     ret[2].sval = dupstr(buf);
     ret[2].ival = 0;
 
     ret[3].name = NULL;
-    ret[3].type = ENDCFG;
+    ret[3].type = C_END;
     ret[3].sval = NULL;
     ret[3].ival = 0;
 
--- a/fifteen.c
+++ b/fifteen.c
@@ -80,19 +80,19 @@
     ret = snewn(3, config_item);
 
     ret[0].name = "Width";
-    ret[0].type = STRING;
+    ret[0].type = C_STRING;
     sprintf(buf, "%d", params->w);
     ret[0].sval = dupstr(buf);
     ret[0].ival = 0;
 
     ret[1].name = "Height";
-    ret[1].type = STRING;
+    ret[1].type = C_STRING;
     sprintf(buf, "%d", params->h);
     ret[1].sval = dupstr(buf);
     ret[1].ival = 0;
 
     ret[2].name = NULL;
-    ret[2].type = ENDCFG;
+    ret[2].type = C_END;
     ret[2].sval = NULL;
     ret[2].ival = 0;
 
--- a/gtk.c
+++ b/gtk.c
@@ -495,11 +495,11 @@
                      table, FALSE, FALSE, 0);
     gtk_widget_show(table);
 
-    for (i = fe->cfg; i->type != ENDCFG; i++) {
+    for (i = fe->cfg; i->type != C_END; i++) {
 	gtk_table_resize(GTK_TABLE(table), y+1, 2);
 
 	switch (i->type) {
-	  case STRING:
+	  case C_STRING:
 	    /*
 	     * Edit box with a label beside it.
 	     */
@@ -524,7 +524,7 @@
 
 	    break;
 
-	  case BOOLEAN:
+	  case C_BOOLEAN:
 	    /*
 	     * Simple checkbox.
 	     */
@@ -539,7 +539,7 @@
 	    gtk_widget_show(w);
 	    break;
 
-	  case CHOICES:
+	  case C_CHOICES:
 	    /*
 	     * Drop-down list (GtkOptionMenu).
 	     */
--- a/net.c
+++ b/net.c
@@ -191,30 +191,30 @@
     ret = snewn(5, config_item);
 
     ret[0].name = "Width";
-    ret[0].type = STRING;
+    ret[0].type = C_STRING;
     sprintf(buf, "%d", params->width);
     ret[0].sval = dupstr(buf);
     ret[0].ival = 0;
 
     ret[1].name = "Height";
-    ret[1].type = STRING;
+    ret[1].type = C_STRING;
     sprintf(buf, "%d", params->height);
     ret[1].sval = dupstr(buf);
     ret[1].ival = 0;
 
     ret[2].name = "Walls wrap around";
-    ret[2].type = BOOLEAN;
+    ret[2].type = C_BOOLEAN;
     ret[2].sval = NULL;
     ret[2].ival = params->wrapping;
 
     ret[3].name = "Barrier probability";
-    ret[3].type = STRING;
+    ret[3].type = C_STRING;
     sprintf(buf, "%g", params->barrier_probability);
     ret[3].sval = dupstr(buf);
     ret[3].ival = 0;
 
     ret[4].name = NULL;
-    ret[4].type = ENDCFG;
+    ret[4].type = C_END;
     ret[4].sval = NULL;
     ret[4].ival = 0;
 
@@ -228,7 +228,7 @@
     ret->width = atoi(cfg[0].sval);
     ret->height = atoi(cfg[1].sval);
     ret->wrapping = cfg[2].ival;
-    ret->barrier_probability = atof(cfg[3].sval);
+    ret->barrier_probability = (float)atof(cfg[3].sval);
 
     return ret;
 }
--- a/puzzles.h
+++ b/puzzles.h
@@ -52,7 +52,7 @@
  * Structure used to pass configuration data between frontend and
  * game
  */
-enum { STRING, CHOICES, BOOLEAN, ENDCFG };
+enum { C_STRING, C_CHOICES, C_BOOLEAN, C_END };
 struct config_item {
     /*
      * `name' is never dynamically allocated.
@@ -63,17 +63,17 @@
      */
     int type;
     /*
-     * For STRING, `sval' is always dynamically allocated and
-     * non-NULL. For BOOLEAN and ENDCFG, `sval' is always NULL. For
-     * CHOICES, `sval' is non-NULL, _not_ dynamically allocated,
-     * and contains a set of option strings separated by a
-     * delimiter. The delimeter is also the first character in the
-     * string, so for example ":Foo:Bar:Baz" gives three options
-     * `Foo', `Bar' and `Baz'.
+     * For C_STRING, `sval' is always dynamically allocated and
+     * non-NULL. For C_BOOLEAN and C_END, `sval' is always NULL.
+     * For C_CHOICES, `sval' is non-NULL, _not_ dynamically
+     * allocated, and contains a set of option strings separated by
+     * a delimiter. The delimeter is also the first character in
+     * the string, so for example ":Foo:Bar:Baz" gives three
+     * options `Foo', `Bar' and `Baz'.
      */
     char *sval;
     /*
-     * For BOOLEAN, this is TRUE or FALSE. For CHOICES, it
+     * For C_BOOLEAN, this is TRUE or FALSE. For C_CHOICES, it
      * indicates the chosen index from the `sval' list. In the
      * above example, 0==Foo, 1==Bar and 2==Baz.
      */
--- a/sixteen.c
+++ b/sixteen.c
@@ -100,19 +100,19 @@
     ret = snewn(3, config_item);
 
     ret[0].name = "Width";
-    ret[0].type = STRING;
+    ret[0].type = C_STRING;
     sprintf(buf, "%d", params->w);
     ret[0].sval = dupstr(buf);
     ret[0].ival = 0;
 
     ret[1].name = "Height";
-    ret[1].type = STRING;
+    ret[1].type = C_STRING;
     sprintf(buf, "%d", params->h);
     ret[1].sval = dupstr(buf);
     ret[1].ival = 0;
 
     ret[2].name = NULL;
-    ret[2].type = ENDCFG;
+    ret[2].type = C_END;
     ret[2].sval = NULL;
     ret[2].ival = 0;