chiark / gitweb /
Use a proper union in struct config_item.
[sgt-puzzles.git] / flip.c
diff --git a/flip.c b/flip.c
index 68979fee9dacdac6e5c58cccc6e274003965c618..fc96329d4ce3bb1b173605387d8f6c7d83e28c84 100644 (file)
--- a/flip.c
+++ b/flip.c
@@ -149,24 +149,20 @@ static config_item *game_configure(const game_params *params)
     ret[0].name = "Width";
     ret[0].type = C_STRING;
     sprintf(buf, "%d", params->w);
-    ret[0].sval = dupstr(buf);
-    ret[0].ival = 0;
+    ret[0].u.string.sval = dupstr(buf);
 
     ret[1].name = "Height";
     ret[1].type = C_STRING;
     sprintf(buf, "%d", params->h);
-    ret[1].sval = dupstr(buf);
-    ret[1].ival = 0;
+    ret[1].u.string.sval = dupstr(buf);
 
     ret[2].name = "Shape type";
     ret[2].type = C_CHOICES;
-    ret[2].sval = ":Crosses:Random";
-    ret[2].ival = params->matrix_type;
+    ret[2].u.choices.choicenames = ":Crosses:Random";
+    ret[2].u.choices.selected = params->matrix_type;
 
     ret[3].name = NULL;
     ret[3].type = C_END;
-    ret[3].sval = NULL;
-    ret[3].ival = 0;
 
     return ret;
 }
@@ -175,9 +171,9 @@ static game_params *custom_params(const config_item *cfg)
 {
     game_params *ret = snew(game_params);
 
-    ret->w = atoi(cfg[0].sval);
-    ret->h = atoi(cfg[1].sval);
-    ret->matrix_type = cfg[2].ival;
+    ret->w = atoi(cfg[0].u.string.sval);
+    ret->h = atoi(cfg[1].u.string.sval);
+    ret->matrix_type = cfg[2].u.choices.selected;
 
     return ret;
 }