]> git.pond.sub.org Git - empserver/commitdiff
Use assert() for a condition that should never happen in fairland
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 23 May 2010 16:04:23 +0000 (18:04 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 24 May 2010 16:23:32 +0000 (18:23 +0200)
If it does happen, assertion failure isn't very nice, but it beats
asking the user to report the bug to an inappropriate e-mail address
that most probably ceased to work years ago.

src/util/fairland.c

index 7d5c43aba047ac05b12af3c712bde397dc361b2c..83ee883a113a2dec86e7dc9e4fd8888b96d460a4 100644 (file)
@@ -66,6 +66,7 @@ static int quiet = 0;
 /* lower URAN_MIN for more uranium */
 #define URAN_MIN   56
 
+#include <assert.h>
 #include <errno.h>
 #include <stdarg.h>
 #include <stdio.h>
@@ -688,12 +689,8 @@ new_try(int c)
                return i;
            i = (i + 1) % secs;
        } while (i != starti);
-       if (c < nc) {
-           printf("fairland: BUG -- couldn't find coast for continent %c, sector %d.\nPlease mail stevens@math.utoronto.ca.\n",
-                  c + 'a', secs);
-           exit(1);
-       } else
-           return -1;
+       assert(c >= nc);
+       return -1;
     }
     return -1;
 }