From 29d983c38fd5427d7bd6c6da40b7be2cbdfb5413 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Fri, 18 Jul 2008 19:23:47 +0100 Subject: [PATCH] Move highscores file to user's home directory --- po/POTFILES.in | 80 ++++++++++++++++++++++++---------------------- po/en_GB.po | 39 +++++++++++----------- po/lander.pot | 38 +++++++++++----------- src/HighScores.cpp | 6 ++-- src/Main.cpp | 8 ++--- src/Platform.hpp | 2 +- 6 files changed, 89 insertions(+), 84 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index 46042d6..08f797f 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,50 +1,54 @@ +src/Surface.hpp +src/Game.cpp +src/Ship.hpp src/Ship.cpp -src/Input.hpp -src/Game.hpp -src/Input.cpp -src/Mechanics.hpp -src/OpenGL.hpp +src/AnimatedImage.hpp +src/LandingPad.cpp +src/Emitter.cpp +src/Image.cpp +src/Key.hpp +src/Mechanics.cpp +src/Fade.cpp src/OpenGL.cpp -src/Key.cpp -src/Options.hpp -src/ElectricGate.hpp +src/SoundEffect.cpp src/Texture.cpp -src/Emitter.hpp -src/LandingPad.cpp -src/Main.cpp -src/Geometry.hpp -src/Mine.cpp -src/ScreenManager.hpp -src/Surface.cpp +src/ElectricGate.hpp src/ObjectGrid.cpp -src/Viewport.cpp -src/Asteroid.hpp +src/ElectricGate.cpp +src/AnimatedImage.cpp +src/Game.hpp +src/Input.hpp src/Viewport.hpp +src/Geometry.hpp +src/SoundEffect.hpp +src/ObjectGrid.hpp +src/Mechanics.hpp +src/ConfigFile.cpp +src/Key.cpp +src/Viewport.cpp +src/Mine.hpp src/Font.cpp -src/LoadOnce.hpp +src/Font.hpp +src/HighScores.hpp +src/Menu.hpp +src/Asteroid.cpp +src/Input.cpp src/Platform.hpp -src/Key.hpp -src/ConfigFile.hpp +src/Asteroid.hpp +src/Options.cpp +src/Emitter.hpp src/LandingPad.hpp -src/ElectricGate.cpp -src/Emitter.cpp +src/Menu.cpp +src/Mine.cpp +src/Fade.hpp +src/LoadOnce.hpp +src/OpenGL.hpp src/ScreenManager.cpp src/Texture.hpp -src/HighScores.hpp -src/Mine.hpp -src/AnimatedImage.hpp -src/Asteroid.cpp -src/Image.cpp -src/Mechanics.cpp -src/Font.hpp -src/Surface.hpp -src/AnimatedImage.cpp -src/ObjectGrid.hpp -src/Menu.hpp -src/Game.cpp +src/ScreenManager.hpp src/HighScores.cpp -src/Options.cpp -src/Menu.cpp -src/Ship.hpp src/Image.hpp -src/ConfigFile.cpp +src/Main.cpp +src/Surface.cpp +src/Options.hpp +src/ConfigFile.hpp diff --git a/po/en_GB.po b/po/en_GB.po index 96c4f67..5efde50 100644 --- a/po/en_GB.po +++ b/po/en_GB.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: lander 0.9\n" "Report-Msgid-Bugs-To: nick@cakesniffer.co.uk\n" -"POT-Creation-Date: 2008-06-13 22:08+0100\n" +"POT-Creation-Date: 2008-07-18 19:14+0100\n" "PO-Revision-Date: 2008-04-19 01:09+0100\n" "Last-Translator: Nick Gasson \n" "Language-Team: English (British)\n" @@ -16,62 +16,63 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: src/Main.cpp:114 +#: src/Main.cpp:121 #, c-format msgid "Runtime Error: %s\n" msgstr "Runtime Error: %s\n" -#: src/Game.cpp:616 -msgid "Press SPACE to continue" +#: src/Game.cpp:109 src/Game.cpp:659 +#, c-format +msgid "Score: %d" +msgstr "Score: %d" + +#: src/Game.cpp:595 +#, fuzzy +msgid "Press SPACE to continue" msgstr "Press SPACE to continue" -#: src/Game.cpp:674 +#: src/Game.cpp:653 msgid "Land now" msgstr "Land now" -#: src/Game.cpp:680 -#, c-format -msgid "Score: %d" -msgstr "Score: %d" - -#: src/Game.cpp:695 +#: src/Game.cpp:675 #, c-format msgid "Level %d" msgstr "Level %d" -#: src/Game.cpp:714 +#: src/Game.cpp:694 msgid "Paused" msgstr "Paused" -#: src/HighScores.cpp:177 +#: src/HighScores.cpp:178 #, fuzzy msgid "Press SPACE or FIRE to return" msgstr "Press SPACE or FIRE to return" -#: src/HighScores.cpp:192 +#: src/HighScores.cpp:193 #, fuzzy msgid "Well done - You got a high score" msgstr "Well done - You got a high score" -#: src/HighScores.cpp:197 +#: src/HighScores.cpp:198 #, fuzzy msgid "Press ENTER or FIRE to continue" msgstr "Press ENTER or FIRE to continue" -#: src/HighScores.cpp:202 +#: src/HighScores.cpp:204 #, c-format msgid "Name? %s" msgstr "Name? %s" -#: src/Options.cpp:213 +#: src/Options.cpp:226 msgid "Use UP and DOWN to select options" msgstr "" -#: src/Options.cpp:218 +#: src/Options.cpp:231 msgid "Use LEFT and RIGHT to change values" msgstr "" -#: src/Options.cpp:223 +#: src/Options.cpp:236 #, fuzzy msgid "Press FIRE or RETURN to exit" msgstr "Press SPACE or FIRE to return" diff --git a/po/lander.pot b/po/lander.pot index 607a48e..941e9bf 100644 --- a/po/lander.pot +++ b/po/lander.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: lander 0.3\n" +"Project-Id-Version: lander 0.4\n" "Report-Msgid-Bugs-To: nick@cakesniffer.co.uk\n" -"POT-Creation-Date: 2008-06-13 22:08+0100\n" +"POT-Creation-Date: 2008-07-18 19:14+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,59 +16,59 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: src/Main.cpp:114 +#: src/Main.cpp:121 #, c-format msgid "Runtime Error: %s\n" msgstr "" -#: src/Game.cpp:616 -msgid "Press SPACE to continue" +#: src/Game.cpp:109 src/Game.cpp:659 +#, c-format +msgid "Score: %d" msgstr "" -#: src/Game.cpp:674 -msgid "Land now" +#: src/Game.cpp:595 +msgid "Press SPACE to continue" msgstr "" -#: src/Game.cpp:680 -#, c-format -msgid "Score: %d" +#: src/Game.cpp:653 +msgid "Land now" msgstr "" -#: src/Game.cpp:695 +#: src/Game.cpp:675 #, c-format msgid "Level %d" msgstr "" -#: src/Game.cpp:714 +#: src/Game.cpp:694 msgid "Paused" msgstr "" -#: src/HighScores.cpp:177 +#: src/HighScores.cpp:178 msgid "Press SPACE or FIRE to return" msgstr "" -#: src/HighScores.cpp:192 +#: src/HighScores.cpp:193 msgid "Well done - You got a high score" msgstr "" -#: src/HighScores.cpp:197 +#: src/HighScores.cpp:198 msgid "Press ENTER or FIRE to continue" msgstr "" -#: src/HighScores.cpp:202 +#: src/HighScores.cpp:204 #, c-format msgid "Name? %s" msgstr "" -#: src/Options.cpp:213 +#: src/Options.cpp:226 msgid "Use UP and DOWN to select options" msgstr "" -#: src/Options.cpp:218 +#: src/Options.cpp:231 msgid "Use LEFT and RIGHT to change values" msgstr "" -#: src/Options.cpp:223 +#: src/Options.cpp:236 msgid "Press FIRE or RETURN to exit" msgstr "" diff --git a/src/HighScores.cpp b/src/HighScores.cpp index df16eef..106d2c9 100644 --- a/src/HighScores.cpp +++ b/src/HighScores.cpp @@ -296,14 +296,14 @@ void ScoreFile::Sort() void ScoreFile::Load() { // Check for file's existence - if (!FileExists(LocateResource("Highscores.dat"))) { + string hsname = GetConfigDir() + ".lander.scores"; + if (!FileExists(hsname)) { // Write a dummy score file Save(); } else { // Open highscores file - const char *fname = LocateResource("Highscores.dat"); - ifstream fin(fname); + ifstream fin(hsname.c_str()); for (ScoreEntryVecIt it = scores.begin(); it != scores.end(); ++it) (*it).ReadFromStream(fin); diff --git a/src/Main.cpp b/src/Main.cpp index 08ab5e1..7c0f92e 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -163,17 +163,17 @@ const char *LocateResource(const char *file) #endif } -bool FileExists(const char *file) +bool FileExists(const string &file) { #ifdef UNIX struct stat buf; - return stat(file, &buf) == 0; + return stat(file.c_str(), &buf) == 0; #else - FILE *f = fopen(file, "r"); + FILE *f = fopen(file.c_str(), "r"); if (NULL == f) return false; else { - fclose(f); + fclose(f.c_str()); return true; } #endif diff --git a/src/Platform.hpp b/src/Platform.hpp index d30561c..01108fb 100644 --- a/src/Platform.hpp +++ b/src/Platform.hpp @@ -164,7 +164,7 @@ using namespace std; void RecreateScreens(); const char *LocateResource(const char *file); -bool FileExists(const char *file); +bool FileExists(const string &file); string GetConfigDir(); #endif /* #ifdef INC_PLATFORM_HPP */ -- 2.39.2