Use assert() for a condition that should never happen in fairland

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.
This commit is contained in:
Markus Armbruster 2010-05-23 18:04:23 +02:00
parent 4613c6d8f2
commit 17a559b3a5

View file

@ -66,6 +66,7 @@ static int quiet = 0;
/* lower URAN_MIN for more uranium */ /* lower URAN_MIN for more uranium */
#define URAN_MIN 56 #define URAN_MIN 56
#include <assert.h>
#include <errno.h> #include <errno.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
@ -688,11 +689,7 @@ new_try(int c)
return i; return i;
i = (i + 1) % secs; i = (i + 1) % secs;
} while (i != starti); } while (i != starti);
if (c < nc) { assert(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; return -1;
} }
return -1; return -1;