[Tux4kids-commits] r1524 - tuxtype/trunk/src

Matthew Trey treymd-guest at alioth.debian.org
Fri Sep 11 15:56:16 UTC 2009


Author: treymd-guest
Date: 2009-09-11 15:56:16 +0000 (Fri, 11 Sep 2009)
New Revision: 1524

Modified:
   tuxtype/trunk/src/scripting.c
Log:
Changed all the exit calls in scripting.c to returns, exiting on script failure would be viewed as a program crash by the user, this is undesireable.  Better to return to the main menu instead.

Modified: tuxtype/trunk/src/scripting.c
===================================================================
--- tuxtype/trunk/src/scripting.c	2009-09-11 15:02:53 UTC (rev 1523)
+++ tuxtype/trunk/src/scripting.c	2009-09-11 15:56:16 UTC (rev 1524)
@@ -262,7 +262,7 @@
       switch (event.type)
       {
         case SDL_QUIT:
-          exit(0); /* FIXME may need to cleanup memory and exit more cleanly */
+          return 0; /* Return control to the main program so we can exit cleanly */
           break;
 
         case SDL_MOUSEMOTION:
@@ -625,7 +625,7 @@
     {
       if (curScript==NULL)
       {
-        fprintf(stderr, "CRITICAL XML ERROR: <page> should be in a <script> in file %s line (todo)", fn); exit(1);
+        fprintf(stderr, "CRITICAL XML ERROR: <page> should be in a <script> in file %s line (todo)", fn); return 0;
       }
 
       if (curScript->pages==NULL)
@@ -660,7 +660,7 @@
     {
       if (curPage == NULL)
       {
-        fprintf(stderr, "CRITICAL XML ERROR: <text> should be in a <page> in file %s line (todo)", fn); exit(1);
+        fprintf(stderr, "CRITICAL XML ERROR: <text> should be in a <page> in file %s line (todo)", fn); return 0;
       }
 
       if (curPage->items == NULL) 
@@ -747,7 +747,7 @@
         fprintf(stderr,
                 "CRITICAL XML ERROR: <img> should be in a <page> in file %s line (todo)",
                fn);
-        exit(1); //FIXME should call cleanup() or maybe just return without exiting
+        return 0; //Return control to the main program for a clean exit
       }
 
       if (curPage->items == NULL)
@@ -807,7 +807,7 @@
         fprintf(stderr,
                 "CRITICAL XML ERROR: <wav> should be in a <page> in file %s line (todo)",
                 fn);
-        exit(1);  /* FIXME call Cleanup() to exit */
+        return 0;  /* Return control to main program for a clean exit */
       }
 
       if (curPage->items == NULL)
@@ -849,7 +849,7 @@
         fprintf(stderr,
                 "CRITICAL XML ERROR: <prac> should be in a <page> in file %s line (todo)",
                 fn);
-        exit(1); /* FIXME call cleanup() rather than exit() */
+        return 0; /* Return control to the main program for a clean exit */
       }
 
       if (curPage->items == NULL)
@@ -930,7 +930,7 @@
         fprintf(stderr,
                "CRITICAL XML ERROR: <waitforinput> should be in a <page> in file %s line (todo)",
                 fn);
-        exit(1);
+        return 0;
       }
 
       if (curPage->items == NULL)
@@ -954,7 +954,7 @@
         fprintf(stderr,
                "CRITICAL XML ERROR: <waitforchar> should be in a <page> in file %s line (todo)",
                fn);
-        exit(1);
+        return 0;
       }
 
       if (curPage->items == NULL)




More information about the Tux4kids-commits mailing list