From: Ash Tyndall Date: Sat, 8 Oct 2011 05:44:22 +0000 (+0800) Subject: (no commit message) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=17cb701324fd442c5c9cc9ea6b662bf829d92ff2;p=atyndall%2Fcits2231.git --- diff --git a/scene.c b/scene.c index 8fddc81..2733cf8 100644 --- a/scene.c +++ b/scene.c @@ -269,10 +269,13 @@ void makeMenu() { // Construct add object submenus int addObjectSubmenu[6]; + int objectMenuEntriesSize = sizeof(objectMenuEntries) / sizeof(objectMenuEntries[0]); + int menuNumber = objectMenuEntriesSize / 10 + 1; - for( int i = 0; i < 6; i++ ) { + for( int i = 0; i < menuNumber; i++ ) { addObjectSubmenu[i] = glutCreateMenu(processObjectEvents); for ( int j = i; j < (i+9); j++ ) { + if ( !objectMenuEntries[j] ) break; // Detect if we've reached the end of the array glutAddMenuEntry( objectMenuEntries[j], j ); } }