chiark / gitweb /
Remove extraneous underscores at start and end of Rectangles seeds.
authorSimon Tatham <anakin@pobox.com>
Tue, 17 Aug 2004 11:51:20 +0000 (11:51 +0000)
committerSimon Tatham <anakin@pobox.com>
Tue, 17 Aug 2004 11:51:20 +0000 (11:51 +0000)
[originally from svn r4473]

rect.c

diff --git a/rect.c b/rect.c
index b9d7cda1fbe336c45f124464b79850b70ca7b6c4..06ccff6d2ffc90c58ea590e24b26301b6e3325a9 100644 (file)
--- a/rect.c
+++ b/rect.c
@@ -881,7 +881,13 @@ char *new_game_seed(game_params *params, random_state *rs)
                     run -= c - ('a' - 1);
                 }
             } else {
-                *p++ = '_';
+                /*
+                 * If there's a number in the very top left or
+                 * bottom right, there's no point putting an
+                 * unnecessary _ before or after it.
+                 */
+                if (p > seed && n > 0)
+                    *p++ = '_';
             }
             if (n > 0)
                 p += sprintf(p, "%d", n);