[AD] Bugfix for demo when the screen size is small

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Moved the screen size check inside load_credits(), otherwise
title_text would not be loaded and the demo would crash trying to
use a NULL pointer.

Index: demo/title.c
===================================================================
RCS file: /cvsroot/alleg/allegro/demo/title.c,v
retrieving revision 1.1
diff -u -p -r1.1 title.c
--- demo/title.c        7 Jun 2005 11:56:48 -0000       1.1
+++ demo/title.c        15 Oct 2005 19:52:40 -0000
@@ -422,6 +422,10 @@ static void load_credits(void)
 
    load_text();
 
+   /* Don't load top scroller with small screens. */
+   if (SCREEN_W < 640)
+      return;
+
    /* parse thanks._tx */
    get_executable_name(buf, sizeof(buf));
    replace_filename(buf2, buf, "../docs/src/thanks._tx", sizeof(buf2));
@@ -767,9 +771,7 @@ int title_screen(void)
    play_midi(data[TITLE_MUSIC].dat, TRUE);
    play_sample(data[WELCOME_SPL].dat, 255, 127, 1000, FALSE);
 
-   if (SCREEN_W >= 640) {
-      load_credits();
-   }
+   load_credits();
 
    init_starfield_3d();
 





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/