From 9f8ef935fc308ef8bc144c40eda5fcc1e23c1e47 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Fri, 18 Jul 2008 19:37:25 +0100 Subject: [PATCH] Fix high score location --- po/en_GB.po | 52 +++++++++++++++++++++++----------------------- po/lander.pot | 46 ++++++++++++++++++++-------------------- src/HighScores.cpp | 10 ++++++--- src/HighScores.hpp | 5 +++-- 4 files changed, 59 insertions(+), 54 deletions(-) diff --git a/po/en_GB.po b/po/en_GB.po index 5efde50..b23a000 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-07-18 19:14+0100\n" +"POT-Creation-Date: 2008-07-18 19:28+0100\n" "PO-Revision-Date: 2008-04-19 01:09+0100\n" "Last-Translator: Nick Gasson \n" "Language-Team: English (British)\n" @@ -16,11 +16,6 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: src/Main.cpp:121 -#, c-format -msgid "Runtime Error: %s\n" -msgstr "Runtime Error: %s\n" - #: src/Game.cpp:109 src/Game.cpp:659 #, c-format msgid "Score: %d" @@ -44,26 +39,6 @@ msgstr "Level %d" msgid "Paused" msgstr "Paused" -#: src/HighScores.cpp:178 -#, fuzzy -msgid "Press SPACE or FIRE to return" -msgstr "Press SPACE or FIRE to return" - -#: src/HighScores.cpp:193 -#, fuzzy -msgid "Well done - You got a high score" -msgstr "Well done - You got a high score" - -#: src/HighScores.cpp:198 -#, fuzzy -msgid "Press ENTER or FIRE to continue" -msgstr "Press ENTER or FIRE to continue" - -#: src/HighScores.cpp:204 -#, c-format -msgid "Name? %s" -msgstr "Name? %s" - #: src/Options.cpp:226 msgid "Use UP and DOWN to select options" msgstr "" @@ -105,6 +80,31 @@ msgstr "" msgid "Collect the spinning rings to unlock the landing pads" msgstr "" +#: src/HighScores.cpp:178 +#, fuzzy +msgid "Press SPACE or FIRE to return" +msgstr "Press SPACE or FIRE to return" + +#: src/HighScores.cpp:193 +#, fuzzy +msgid "Well done - You got a high score" +msgstr "Well done - You got a high score" + +#: src/HighScores.cpp:198 +#, fuzzy +msgid "Press ENTER or FIRE to continue" +msgstr "Press ENTER or FIRE to continue" + +#: src/HighScores.cpp:204 +#, c-format +msgid "Name? %s" +msgstr "Name? %s" + +#: src/Main.cpp:121 +#, c-format +msgid "Runtime Error: %s\n" +msgstr "Runtime Error: %s\n" + #~ msgid "LUNAR LANDER" #~ msgstr "LUNAR LANDER" diff --git a/po/lander.pot b/po/lander.pot index 941e9bf..fde1d5b 100644 --- a/po/lander.pot +++ b/po/lander.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: lander 0.4\n" "Report-Msgid-Bugs-To: nick@cakesniffer.co.uk\n" -"POT-Creation-Date: 2008-07-18 19:14+0100\n" +"POT-Creation-Date: 2008-07-18 19:28+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,11 +16,6 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: src/Main.cpp:121 -#, c-format -msgid "Runtime Error: %s\n" -msgstr "" - #: src/Game.cpp:109 src/Game.cpp:659 #, c-format msgid "Score: %d" @@ -43,23 +38,6 @@ msgstr "" msgid "Paused" msgstr "" -#: src/HighScores.cpp:178 -msgid "Press SPACE or FIRE to return" -msgstr "" - -#: src/HighScores.cpp:193 -msgid "Well done - You got a high score" -msgstr "" - -#: src/HighScores.cpp:198 -msgid "Press ENTER or FIRE to continue" -msgstr "" - -#: src/HighScores.cpp:204 -#, c-format -msgid "Name? %s" -msgstr "" - #: src/Options.cpp:226 msgid "Use UP and DOWN to select options" msgstr "" @@ -99,3 +77,25 @@ msgstr "" #: src/Menu.cpp:250 msgid "Collect the spinning rings to unlock the landing pads" msgstr "" + +#: src/HighScores.cpp:178 +msgid "Press SPACE or FIRE to return" +msgstr "" + +#: src/HighScores.cpp:193 +msgid "Well done - You got a high score" +msgstr "" + +#: src/HighScores.cpp:198 +msgid "Press ENTER or FIRE to continue" +msgstr "" + +#: src/HighScores.cpp:204 +#, c-format +msgid "Name? %s" +msgstr "" + +#: src/Main.cpp:121 +#, c-format +msgid "Runtime Error: %s\n" +msgstr "" diff --git a/src/HighScores.cpp b/src/HighScores.cpp index 106d2c9..a018992 100644 --- a/src/HighScores.cpp +++ b/src/HighScores.cpp @@ -283,6 +283,11 @@ ScoreFile::~ScoreFile() Save(); } +string ScoreFile::GetHighScoreFile() +{ + return GetConfigDir() + ".lander.scores"; +} + bool operator<(const ScoreFile::ScoreEntry &a, const ScoreFile::ScoreEntry &b) { return a.GetScore() > b.GetScore(); @@ -296,7 +301,7 @@ void ScoreFile::Sort() void ScoreFile::Load() { // Check for file's existence - string hsname = GetConfigDir() + ".lander.scores"; + string hsname(GetHighScoreFile()); if (!FileExists(hsname)) { // Write a dummy score file Save(); @@ -316,8 +321,7 @@ void ScoreFile::Save() if (!needsWrite) return; - const char *fname = LocateResource("Highscores.dat"); - ofstream fout(fname); + ofstream fout(GetHighScoreFile().c_str()); for (ScoreEntryVecIt it = scores.begin(); it != scores.end(); ++it) (*it).WriteOnStream(fout); } diff --git a/src/HighScores.hpp b/src/HighScores.hpp index b877a50..23ca1be 100644 --- a/src/HighScores.hpp +++ b/src/HighScores.hpp @@ -65,6 +65,8 @@ private: void Sort(); void SwapScores(int a, int b); + static string GetHighScoreFile(); + bool needsWrite; typedef vector ScoreEntryVec; typedef ScoreEntryVec::iterator ScoreEntryVecIt; @@ -84,8 +86,7 @@ public: void DisplayScores(); void CheckScore(int score); -private: - +private: enum HighScoreState { hssDisplay, hssEnterName }; int newscore; -- 2.39.2