[Tux4kids-commits] r158 - in tuxtype/trunk: . tuxtype tuxtype/data/images

David Bruce dbruce-guest at alioth.debian.org
Sat Apr 21 13:13:11 UTC 2007


Author: dbruce-guest
Date: 2007-04-21 13:13:11 +0000 (Sat, 21 Apr 2007)
New Revision: 158

Modified:
   tuxtype/trunk/ChangeLog
   tuxtype/trunk/tuxtype/data/images/Makefile.am
   tuxtype/trunk/tuxtype/data/images/Makefile.in
   tuxtype/trunk/tuxtype/loaders.c
Log:
work-around for bug in checkFile()


Modified: tuxtype/trunk/ChangeLog
===================================================================
--- tuxtype/trunk/ChangeLog	2007-04-19 00:15:32 UTC (rev 157)
+++ tuxtype/trunk/ChangeLog	2007-04-21 13:13:11 UTC (rev 158)
@@ -1,6 +1,11 @@
+[ David Bruce ] 21 Apr 2007
+       - (mostly) removed used of checkFile() as it doesn't work
+         reliably on Windows and isn't really necessary. 
+
+
 v.1.5.7
 
-[ David Bruce]
+[ David Bruce ]
        - Changed font to Andika (hopefully will have this in Debian
          and other OS in future so we don't have to bundle it
          indefinitely)

Modified: tuxtype/trunk/tuxtype/data/images/Makefile.am
===================================================================
--- tuxtype/trunk/tuxtype/data/images/Makefile.am	2007-04-19 00:15:32 UTC (rev 157)
+++ tuxtype/trunk/tuxtype/data/images/Makefile.am	2007-04-21 13:13:11 UTC (rev 158)
@@ -32,7 +32,6 @@
 kcas3_4.png\
 left.png\
 line2.png\
-lessons_bkg.png\
 main_bkg.png\
 num_0.png\
 nosound.png\
@@ -61,18 +60,6 @@
 tux2.png\
 tux3.png\
 up.png\
-wcas1_1.png\
-wcas1_2.png\
-wcas1_3.png\
-wcas1_4.png\
-wcas2_1.png\
-wcas2_2.png\
-wcas2_3.png\
-wcas2_4.png\
-wcas3_1.png\
-wcas3_2.png\
-wcas3_3.png\
-wcas3_4.png\
 world.png
 
 install-data-local:
@@ -123,8 +110,6 @@
 	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
 	$(INSTALL_DATA) $(srcdir)/line2.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/line2.png
 	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/lessons_bkg.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/lessons_bkg.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
 	$(INSTALL_DATA) $(srcdir)/main_bkg.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/main_bkg.png
 	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
 	$(INSTALL_DATA) $(srcdir)/num_0.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/num_0.png
@@ -181,30 +166,6 @@
 	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
 	$(INSTALL_DATA) $(srcdir)/up.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/up.png
 	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas1_1.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas1_1.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas1_2.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas1_2.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas1_3.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas1_3.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas1_4.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas1_4.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas2_1.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas2_1.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas2_2.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas2_2.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas2_3.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas2_3.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas2_4.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas2_4.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas3_1.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas3_1.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas3_2.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas3_2.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas3_3.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas3_3.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas3_4.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas3_4.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
 	$(INSTALL_DATA) $(srcdir)/world.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/world.png
 
 uninstall-local:
@@ -231,7 +192,6 @@
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/kcas3_4.png
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/left.png
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/line2.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/lessons_bkg.png
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/main_bkg.png
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/num_0.png
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/nosound.png
@@ -260,16 +220,4 @@
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/tux2.png
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/tux3.png
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/up.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas1_1.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas1_2.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas1_3.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas1_4.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas2_1.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas2_2.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas2_3.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas2_4.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas3_1.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas3_2.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas3_3.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas3_4.png
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/world.png

Modified: tuxtype/trunk/tuxtype/data/images/Makefile.in
===================================================================
--- tuxtype/trunk/tuxtype/data/images/Makefile.in	2007-04-19 00:15:32 UTC (rev 157)
+++ tuxtype/trunk/tuxtype/data/images/Makefile.in	2007-04-21 13:13:11 UTC (rev 158)
@@ -194,7 +194,6 @@
 kcas3_4.png\
 left.png\
 line2.png\
-lessons_bkg.png\
 main_bkg.png\
 num_0.png\
 nosound.png\
@@ -223,18 +222,6 @@
 tux2.png\
 tux3.png\
 up.png\
-wcas1_1.png\
-wcas1_2.png\
-wcas1_3.png\
-wcas1_4.png\
-wcas2_1.png\
-wcas2_2.png\
-wcas2_3.png\
-wcas2_4.png\
-wcas3_1.png\
-wcas3_2.png\
-wcas3_3.png\
-wcas3_4.png\
 world.png
 
 all: all-recursive
@@ -593,8 +580,6 @@
 	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
 	$(INSTALL_DATA) $(srcdir)/line2.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/line2.png
 	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/lessons_bkg.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/lessons_bkg.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
 	$(INSTALL_DATA) $(srcdir)/main_bkg.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/main_bkg.png
 	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
 	$(INSTALL_DATA) $(srcdir)/num_0.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/num_0.png
@@ -651,30 +636,6 @@
 	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
 	$(INSTALL_DATA) $(srcdir)/up.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/up.png
 	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas1_1.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas1_1.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas1_2.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas1_2.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas1_3.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas1_3.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas1_4.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas1_4.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas2_1.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas2_1.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas2_2.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas2_2.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas2_3.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas2_3.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas2_4.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas2_4.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas3_1.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas3_1.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas3_2.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas3_2.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas3_3.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas3_3.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
-	$(INSTALL_DATA) $(srcdir)/wcas3_4.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas3_4.png
-	$(mkinstalldirs) $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images
 	$(INSTALL_DATA) $(srcdir)/world.png $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/world.png
 
 uninstall-local:
@@ -701,7 +662,6 @@
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/kcas3_4.png
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/left.png
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/line2.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/lessons_bkg.png
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/main_bkg.png
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/num_0.png
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/nosound.png
@@ -730,18 +690,6 @@
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/tux2.png
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/tux3.png
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/up.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas1_1.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas1_2.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas1_3.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas1_4.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas2_1.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas2_2.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas2_3.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas2_4.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas3_1.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas3_2.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas3_3.png
-	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/wcas3_4.png
 	rm -f $(DESTDIR)$(prefix)/share/$(PACKAGE)/data/images/world.png
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.

Modified: tuxtype/trunk/tuxtype/loaders.c
===================================================================
--- tuxtype/trunk/tuxtype/loaders.c	2007-04-19 00:15:32 UTC (rev 157)
+++ tuxtype/trunk/tuxtype/loaders.c	2007-04-21 13:13:11 UTC (rev 158)
@@ -20,14 +20,21 @@
 #include "globals.h"
 #include "funcs.h"
 
-/* check to see if file exists, if so return true */
+/* check to see if file exists, if so return true            */
+/* FIXME this sometimes erroneously returns false on some    */
+/* Windows versions - hence below hackware. We don't really  */
+/* need this function anyway - it is only an optimization to */
+/* keep from wasting time preparing to do things with files  */
+/* that don't exist.                                         */
 int checkFile( const char *file ) {
 	static struct stat fileStats;
 
-	fileStats.st_mode = 0;
+#ifdef WIN32
+        return 1; 
+#endif
 
+	fileStats.st_mode = 0;
 	stat( file, &fileStats );
-		
 	return (S_IFREG & fileStats.st_mode);
 }
 
@@ -157,28 +164,18 @@
 }
 
 TTF_Font *LoadFont( char *fontfile, int fontsize ) {
-	TTF_Font *loadedFont;
+	TTF_Font *loadedFont = NULL;
 	char fn[FNLEN];
 	int i;
 /* char themeName[FNLEN]; */
 
 
-	/* 
-	 *
-	 *
-	 * this will fail now, as those fonts have been removed
-	 * 
-	 *
-	 * this routine is only left here for reference
-	 * 
-	 *
-	 *
-	 */
+
 	/* try to find font first in theme dir, then in default */
 	for (i=useEnglish; i<2; i++) {
 		sprintf( fn, "%s/fonts/%s", realPath[i], fontfile );
 	DEBUGCODE { fprintf(stderr, "LoadFont(): looking for %s using data paths\n", fn ); }
-		if ( checkFile(fn) ) {
+		{
 			/* try to load the font, if successful, return font*/
 
 			loadedFont = TTF_OpenFont( fn, fontsize );
@@ -190,21 +187,17 @@
 
 		
 
-	/* this works only on debian */ 
+	/* this will work only on debian once Andika is included: */ 
 	/* "fallback" (the above _will_ fall): load the font with fixed-path */
-	
-	sprintf( fn, "%s/%s", "/usr/share/fonts/truetype/ttf-gentium/", fontfile );
+	sprintf( fn, "%s/%s", "/usr/share/fonts/truetype/ttf-andika/", fontfile );
 	DEBUGCODE { fprintf(stderr, "LoadFont(): looking for %s\n in OS' font path\n", fn ); }
 
-	if ( checkFile(fn) ) {
-		/* try to load the font, if successful, return font*/
+	/* try to load the font, if successful, return font*/
+	loadedFont = TTF_OpenFont( fn, fontsize );
+	if (loadedFont != NULL)
+		return loadedFont;
 
-		loadedFont = TTF_OpenFont( fn, fontsize );
 
-		if (loadedFont != NULL)
-			return loadedFont;
-	}
-
 	fprintf(stderr, "FATAL ERROR: couldn't load font: %s\n", fontfile);
 	exit(1);
 
@@ -235,15 +228,13 @@
 		sprintf( fn, "%s/images/%s", realPath[i], datafile );
 		DEBUGCODE { fprintf(stderr, "LoadImage: looking in %s\n", fn); }
 
-		if ( checkFile( fn ) ) {
-			LOG ("file found\n");
+		{
 			tmp_pic = IMG_Load( fn );
 			if (tmp_pic != NULL)
 				break; 
 			else
 				fprintf(stderr, "Warning: graphics file %s is corrupt\n", fn);
 		}
-		else LOG ("file NOT found\n");
 	}
 
 	if (tmp_pic == NULL) {
@@ -350,11 +341,9 @@
 
 	for (i = useEnglish; i<2; i++) {
 		sprintf(fn , "%s/sounds/%s", realPath[i], datafile);
-		if ( checkFile(fn) ) {
-			tempChunk = Mix_LoadWAV(fn);
-			if (tempChunk)
-				return tempChunk;
-		}
+		tempChunk = Mix_LoadWAV(fn);
+		if (tempChunk)
+			return tempChunk;
 	}
 
 	/* didn't find anything... fail peacefully */
@@ -374,11 +363,9 @@
 
 	for (i = useEnglish; i<2; i++) {
 		sprintf( fn , "%s/sounds/%s", realPath[i], datafile );
-		if ( checkFile(fn) ) {
-			tempMusic = Mix_LoadMUS(fn);
-			if (tempMusic)
-				return tempMusic;
-		}
+		tempMusic = Mix_LoadMUS(fn);
+		if (tempMusic)
+			return tempMusic;
 	}
 
 	/* didn't find anything... fail peacefully */




More information about the Tux4kids-commits mailing list