Bug 35477 - Gnibbles tries to load level 0
Summary: Gnibbles tries to load level 0
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gnome-games
Version: 7.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jonathan Blandford
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-04-10 18:13 UTC by Jeff Ozvold
Modified: 2013-04-02 04:15 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-04-11 18:33:51 UTC
Embargoed:


Attachments (Terms of Use)

Description Jeff Ozvold 2001-04-10 18:13:58 UTC
There's a bug in the random level code.  One time that it checks

       rand() % MAXLEVEL

       it forgets to add one.  Here is a patch:


diff -ur gnome-games-1.1.90/gnibbles/main.c gnome-games-1.1.90-jjo/gnibbles/main.c
--- gnome-games-1.1.90/gnibbles/main.c  Tue Apr  3 13:54:25 2001
+++ gnome-games-1.1.90-jjo/gnibbles/main.c      Tue Apr  3 13:52:41 2001
@@ -488,7 +488,7 @@
               if ((current_level < MAXLEVEL) && !properties->random)
                       current_level++;
               else if (properties->random) {
-                       tmp = rand () % MAXLEVEL;
+                       tmp = rand () % MAXLEVEL + 1;
                       while (tmp == current_level)
                               tmp = rand () % MAXLEVEL + 1;
                       current_level = tmp;

Comment 1 Jonathan Blandford 2001-07-10 00:00:55 UTC
fixed


Note You need to log in before you can comment on or make changes to this bug.