[Tux4kids-commits] r51 - in tuxmath/trunk: nsis src
dbruce at alioth.debian.org
dbruce at alioth.debian.org
Thu Mar 8 21:19:11 CET 2007
Author: dbruce
Date: 2006-10-14 02:03:56 +0000 (Sat, 14 Oct 2006)
New Revision: 51
Modified:
tuxmath/trunk/nsis/tuxmath.nsi
tuxmath/trunk/nsis/tuxmath.nsi.in
tuxmath/trunk/src/fileops.c
tuxmath/trunk/src/game.c
tuxmath/trunk/src/setup.c
Log:
minor fixes
Modified: tuxmath/trunk/nsis/tuxmath.nsi
===================================================================
--- tuxmath/trunk/nsis/tuxmath.nsi 2006-10-08 12:07:51 UTC (rev 50)
+++ tuxmath/trunk/nsis/tuxmath.nsi 2006-10-14 02:03:56 UTC (rev 51)
@@ -63,8 +63,8 @@
SetShellVarContext all
SetOutPath $INSTDIR
CreateDirectory "$SMPROGRAMS\${APP_NAME}"
- CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME} (Full Screen).lnk" "$INSTDIR\${APP_EXE}" "-f" "$INSTDIR\${APP_EXE}" 0 "" "" "Start TuxPaint in Fullscreen mode"
- CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME} (Windowed).lnk" "$INSTDIR\${APP_EXE}" "" "$INSTDIR\${APP_EXE}" 0 "" "" "Start TuxPaint in a Window"
+ CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME} (Full Screen).lnk" "$INSTDIR\${APP_EXE}" "-f" "$INSTDIR\${APP_EXE}" 0 "" "" "Start TuxMath in Fullscreen mode"
+ CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME} (Windowed).lnk" "$INSTDIR\${APP_EXE}" "-w" "$INSTDIR\${APP_EXE}" 0 "" "" "Start TuxMath in a Window"
CreateShortCut "$SMPROGRAMS\${APP_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 "" "" "Remove Tux of Math Command"
SectionEnd
Modified: tuxmath/trunk/nsis/tuxmath.nsi.in
===================================================================
--- tuxmath/trunk/nsis/tuxmath.nsi.in 2006-10-08 12:07:51 UTC (rev 50)
+++ tuxmath/trunk/nsis/tuxmath.nsi.in 2006-10-14 02:03:56 UTC (rev 51)
@@ -63,8 +63,8 @@
SetShellVarContext all
SetOutPath $INSTDIR
CreateDirectory "$SMPROGRAMS\${APP_NAME}"
- CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME} (Full Screen).lnk" "$INSTDIR\${APP_EXE}" "-f" "$INSTDIR\${APP_EXE}" 0 "" "" "Start TuxPaint in Fullscreen mode"
- CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME} (Windowed).lnk" "$INSTDIR\${APP_EXE}" "" "$INSTDIR\${APP_EXE}" 0 "" "" "Start TuxPaint in a Window"
+ CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME} (Full Screen).lnk" "$INSTDIR\${APP_EXE}" "-f" "$INSTDIR\${APP_EXE}" 0 "" "" "Start TuxMath in Fullscreen mode"
+ CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME} (Windowed).lnk" "$INSTDIR\${APP_EXE}" "-w" "$INSTDIR\${APP_EXE}" 0 "" "" "Start TuxMath in a Window"
CreateShortCut "$SMPROGRAMS\${APP_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 "" "" "Remove Tux of Math Command"
SectionEnd
Modified: tuxmath/trunk/src/fileops.c
===================================================================
--- tuxmath/trunk/src/fileops.c 2006-10-08 12:07:51 UTC (rev 50)
+++ tuxmath/trunk/src/fileops.c 2006-10-14 02:03:56 UTC (rev 51)
@@ -424,6 +424,8 @@
char buf[PATH_MAX];
char *parameter, *param_begin, *param_end, *value, *value_end;
+ parameter = malloc(sizeof(char) * PATH_MAX);
+
#ifdef TUXMATH_DEBUG
printf("\nEntering read_config_file()\n");
#endif
@@ -484,8 +486,9 @@
}
/* copy chars from start of non-whitespace up to '=': */
- parameter = strndup(param_begin, (param_end - param_begin));
+// parameter = strndup(param_begin, (param_end - param_begin));
+ strncpy(parameter, param_begin, (param_end - param_begin));
/* Now get value string: */
/* set value to first '=' in line: */
value = strchr(buf, '=');
@@ -983,9 +986,9 @@
printf("parameter not recognized: %s\n", parameter);
#endif
}
- free(parameter);
+
}
-
+ free(parameter);
#ifdef TUXMATH_DEBUG
printf("\nAfter file read in:\n");
print_game_options(stdout, 0);
Modified: tuxmath/trunk/src/game.c
===================================================================
--- tuxmath/trunk/src/game.c 2006-10-08 12:07:51 UTC (rev 50)
+++ tuxmath/trunk/src/game.c 2006-10-14 02:03:56 UTC (rev 51)
@@ -156,8 +156,9 @@
if (!game_initialize())
{
fprintf(stderr, "\ngame_initialize() failed!");
- /* return 1 so program exits: */
- return 1;
+ /* return 0 so we go back to Options screen - maybe */
+ /* player simply has all operations deselected */
+ return 0;
}
/* --- MAIN GAME LOOP: --- */
@@ -417,6 +418,8 @@
/* Start MathCards backend: */
/* FIXME may need to move this into tuxmath.c to accomodate option */
/* to use MC_StartUsingWrongs() */
+ /* NOTE MC_StartGame() will return 0 if the list length is zero due */
+ /* (for example) to all math operations being deselected */
if (!MC_StartGame())
{
#ifdef TUXMATH_DEBUG
@@ -529,8 +532,10 @@
}
/* Demo mode! */
- int demo_answer, answer_digit;
+ int demo_answer = 0;
+ int answer_digit = 0;
static int picked_comet;
+
if (picked_comet == -1 && (rand() % 10) < 3)
{
/* Demo mode! Randomly pick a comet to destroy: */
Modified: tuxmath/trunk/src/setup.c
===================================================================
--- tuxmath/trunk/src/setup.c 2006-10-08 12:07:51 UTC (rev 50)
+++ tuxmath/trunk/src/setup.c 2006-10-14 02:03:56 UTC (rev 51)
@@ -181,6 +181,7 @@
"--nosound - to disable sound/music\n"
"--nobackground - to disable background photos (for slower systems)\n"
"--fullscreen - to run in fullscreen, if possible (vs. windowed)\n"
+ "--windowed - to run in a window rather than fullscreen\n"
"--keypad - to enable the on-sceen numeric keypad\n"
"--demo - to run the program as a cycling demonstration\n"
"--speed S - set initial speed of the game\n"
@@ -248,6 +249,11 @@
{
game_options->fullscreen = 1;
}
+ else if (strcmp(argv[i], "--windowed") == 0 ||
+ strcmp(argv[i], "-w") == 0)
+ {
+ game_options->fullscreen = 0;
+ }
else if (strcmp(argv[i], "--nosound") == 0 ||
strcmp(argv[i], "-s") == 0 ||
strcmp(argv[i], "--quiet") == 0 ||
More information about the Tux4kids-commits
mailing list