]> git.mxchange.org Git - quix0rs-blobwars.git/blobdiff - src/init.cpp
Do not use DESTDIR in PREFIX, but only in the install target.
[quix0rs-blobwars.git] / src / init.cpp
index 7fe79c0717e1e2e7388ea3b9898ab424601b0ce5..b12cba6398dfa2be5c7a38547e9f7e3c75ca9304 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2004 Parallel Realities
+Copyright (C) 2004-2010 Parallel Realities
 
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
@@ -144,7 +144,10 @@ bool loadConfig()
                return true;
        }
 
-       fscanf(fp, "%f %d", &version, &release);
+       if (fscanf(fp, "%10f %10d", &version, &release) != 2)
+       {
+               rtn = true;
+       }
 
        debug(("Version = %.2f - Expected %.2f\n", version, VERSION));
        debug(("Release = %d - Expected %d\n", release, RELEASE));
@@ -154,7 +157,10 @@ bool loadConfig()
                rtn = true;
        }
 
-       fscanf(fp, "%d %d %d %d %d %d %d", &engine.fullScreen, &game.musicVol, &game.soundVol, &game.output, &game.brightness, &engine.extremeAvailable, &game.gore);
+       if (fscanf(fp, "%10d %10d %10d %10d %10d %10d %10d", &engine.fullScreen, &game.musicVol, &game.soundVol, &game.output, &game.brightness, &engine.extremeAvailable, &game.gore) != 7)
+       {
+               rtn = true;
+       }
 
        fclose(fp);
 
@@ -223,7 +229,13 @@ int initMedalService(void *data)
                return 0;
        }
        
-       fscanf(fp, "%s", privateKey);
+       if (fscanf(fp, "%19s", privateKey) != 1)
+       {
+               graphics.showMedalMessage(-1, "Medal Key file corrupt - Online functions disabled");
+               SDL_mutexV(medalServer.lock);
+               fclose(fp);
+               return 0;
+       }
        
        fclose(fp);
                
@@ -340,8 +352,6 @@ void initSystem()
                snprintf(tempPath, sizeof tempPath, "%sfont.ttf", engine.userHomeDirectory);    
                remove(tempPath);
                
-               SDL_Delay(1000); // wait one second, just to be sure!
-               
                if (!engine.unpack("data/vera.ttf", PAK_FONT))
                {
                        engine.reportFontFailure();
@@ -360,8 +370,8 @@ void initSystem()
        debug(("Font sizes all loaded!!\n"));
 
        audio.loadSound(SND_CHEAT, "sound/Lock And Load!!!");
-       audio.loadSound(SND_HIGHLIGHT, "sound/menu.wav");
-       audio.loadSound(SND_SELECT, "sound/select.wav");
+       audio.loadSound(SND_HIGHLIGHT, "sound/menu");
+       audio.loadSound(SND_SELECT, "sound/select");
        
        graphics.medal[0] = graphics.loadImage("gfx/main/medal_bronze_1.png");
        graphics.medal[1] = graphics.loadImage("gfx/main/award_star_silver_3.png");