chiark
/
gitweb
/
~ian
/
sgt-puzzles.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use a proper union in struct config_item.
[sgt-puzzles.git]
/
unfinished
/
sokoban.c
diff --git
a/unfinished/sokoban.c
b/unfinished/sokoban.c
index 2f0af35bc2e1fba70c23c324decf4714ccb35e8d..edd0f28672ed504c41241615b5355925ab6de1c1 100644
(file)
--- a/
unfinished/sokoban.c
+++ b/
unfinished/sokoban.c
@@
-210,19
+210,15
@@
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].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].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 = NULL;
ret[2].type = C_END;
ret[2].name = NULL;
ret[2].type = C_END;
- ret[2].sval = NULL;
- ret[2].ival = 0;
return ret;
}
return ret;
}
@@
-231,8
+227,8
@@
static game_params *custom_params(const config_item *cfg)
{
game_params *ret = snew(game_params);
{
game_params *ret = snew(game_params);
- ret->w = atoi(cfg[0].sval);
- ret->h = atoi(cfg[1].sval);
+ ret->w = atoi(cfg[0].
u.string.
sval);
+ ret->h = atoi(cfg[1].
u.string.
sval);
return ret;
}
return ret;
}