Added some guards against setting an invalid NKI. It just happened!
authorDavid Griffith <dave@661.org>
Wed, 19 Jan 2022 07:48:32 +0000 (23:48 -0800)
committerDavid Griffith <dave@661.org>
Thu, 20 Jan 2022 08:04:05 +0000 (00:04 -0800)
The default reply from lookup_msg() is "Unknown NKI (this should not happen)"

If that does happen, it means that a number less than 1 or greater than
MESSAGE_NUM was given.  There may be something wacky going on with
Inform's random() function.

kitten.inf

index e99fd21ccba8b2cb2e5595ddf95ddee25556d5a6..d756519300226bdfa63a0146055888fc42ee99cc 100644 (file)
@@ -819,7 +819,7 @@ Global last_right = false;
 
 [ get_random_msg num;
        num = random(MESSAGE_NUM);
-       while (is_duplicate_msg(num) == true) {
+       while (is_duplicate_msg(num) == true || num > MESSAGE_NUM || num < 1) {
                num = random(MESSAGE_NUM);
        }
        return num;