Neat idea from Gareth: if you put a % on the end of the mine count
[sgt/puzzles] / mines.c
diff --git a/mines.c b/mines.c
index 3c06b53..db98cc9 100644 (file)
--- a/mines.c
+++ b/mines.c
@@ -232,6 +232,8 @@ static game_params *custom_params(config_item *cfg)
     ret->w = atoi(cfg[0].sval);
     ret->h = atoi(cfg[1].sval);
     ret->n = atoi(cfg[2].sval);
+    if (strchr(cfg[2].sval, '%'))
+       ret->n = ret->n * (ret->w * ret->h) / 100;
     ret->unique = cfg[3].ival;
 
     return ret;