show error if number of NKIs drops below critical level, don't go into infinite loop
authorThomas Thurman <tthurman@gnome.org>
Sat, 22 Aug 2009 01:39:21 +0000 (21:39 -0400)
committerThomas Thurman <tthurman@gnome.org>
Sat, 22 Aug 2009 01:39:21 +0000 (21:39 -0400)
rfk.c

diff --git a/rfk.c b/rfk.c
index 7a62ea8..71079d5 100644 (file)
--- a/rfk.c
+++ b/rfk.c
@@ -456,6 +456,13 @@ main (gint argc,
   place_in_arena_randomly (robot);
   place_in_arena_randomly (kitten);
 
+  if (nki_count < amount_of_random_stuff)
+    {
+      gtk_widget_show_all (window);
+      show_message ("There are too few non-kitten items to play a meaningful game.");
+      exit (EXIT_FAILURE);
+    }
+
   for (x=0; x < amount_of_random_stuff; x++)
     place_in_arena_randomly (random_character (description ()));