chiark / gitweb /
Fix default parameter assignment in Light Up when validating an
authorSimon Tatham <anakin@pobox.com>
Mon, 23 Jan 2012 18:56:04 +0000 (18:56 +0000)
committerSimon Tatham <anakin@pobox.com>
Mon, 23 Jan 2012 18:56:04 +0000 (18:56 +0000)
incomplete parameter string: if the user hand-types a game ID along
the lines of '18x10:stuff', we should not assume SYMM_ROT4 in the
resulting game_params, since it'll be failed by validate_params.

[originally from svn r9386]

lightup.c

index 5fe95b063ecaf9764c01e4ace6fac3a9f75f9bca..3747ec1cc7a19c4e268a1382e469834c6283da8e 100644 (file)
--- a/lightup.c
+++ b/lightup.c
@@ -215,6 +215,11 @@ static void decode_params(game_params *params, char const *string)
     if (*string == 's') {
         string++;
         EATNUM(params->symm);
+    } else {
+        /* cope with user input such as '18x10' by ensuring symmetry
+         * is not selected by default to be incompatible with dimensions */
+        if (params->symm == SYMM_ROT4 && params->w != params->h)
+            params->symm = SYMM_ROT2;
     }
     params->difficulty = 0;
     /* cope with old params */