From ec3642260118f9cc5d9be5fd089406058ca4da33 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sun, 1 Mar 2009 22:03:22 +0000 Subject: [PATCH] Fix segfault if sound disabled Patch thanks to Harry J Mason --- config.h.in | 8 ++++ po/sv.po | 104 ++++++++++++++++++++++++++++++++++++++++++++ src/Game.cpp | 1 - src/SoundEffect.cpp | 8 +++- 4 files changed, 118 insertions(+), 3 deletions(-) create mode 100644 po/sv.po diff --git a/config.h.in b/config.h.in index 59a05b1..76e97a7 100644 --- a/config.h.in +++ b/config.h.in @@ -56,6 +56,10 @@ /* Define to 1 if you have the `sqrt' function. */ #undef HAVE_SQRT +/* Define to 1 if `stat' has the bug that it succeeds when given the + zero-length file name argument. */ +#undef HAVE_STAT_EMPTY_STRING_BUG + /* Define to 1 if stdbool.h conforms to C99. */ #undef HAVE_STDBOOL_H @@ -86,6 +90,10 @@ /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +#undef LSTAT_FOLLOWS_SLASHED_SYMLINK + /* Name of package */ #undef PACKAGE diff --git a/po/sv.po b/po/sv.po new file mode 100644 index 0000000..6c44818 --- /dev/null +++ b/po/sv.po @@ -0,0 +1,104 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Nick Gasson +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: lander 0.5.1\n" +"Report-Msgid-Bugs-To: nick@cakesniffer.co.uk\n" +"POT-Creation-Date: 2009-02-13 22:49+0000\n" +"PO-Revision-Date: 2009-02-23 15:11+0100\n" +"Last-Translator: FULL NAME \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Swedish\n" +"X-Poedit-Country: SWEDEN\n" + +#: src/Main.cpp:131 +#, c-format +msgid "Runtime Error: %s\n" +msgstr "Koerfel: %s\n" + +#: src/Game.cpp:116 +#: src/Game.cpp:753 +#, c-format +msgid "Score: %d" +msgstr "Poaeng: %d" + +#: src/Game.cpp:689 +msgid "Press SPACE to continue" +msgstr "Tryck MELLANSLAG foer att fortsaetta" + +#: src/Game.cpp:747 +msgid "Land now" +msgstr "Landa nu" + +#: src/Game.cpp:769 +#, c-format +msgid "Level %d" +msgstr "Bana %d" + +#: src/Game.cpp:788 +msgid "Paused" +msgstr "Pausat" + +#: src/HighScores.cpp:177 +msgid "Press SPACE or FIRE to return" +msgstr "Tryck MELLANSLAG eller SKJUT foer att aatergaa" + +#: src/HighScores.cpp:192 +msgid "Well done - You got a high score" +msgstr "Bra jobbat - du slog rekord" + +#: src/HighScores.cpp:197 +msgid "Press ENTER or FIRE to continue" +msgstr "Tryck RETUR eller SKJUT foer att fortsaetta" + +#: src/HighScores.cpp:203 +#, c-format +msgid "Name? %s" +msgstr "Namn? %s" + +#: src/Options.cpp:251 +msgid "Use UP and DOWN to select options" +msgstr "Anvaend UPP och NED foer att vaelja alternativ" + +#: src/Options.cpp:256 +msgid "Use LEFT and RIGHT to change values" +msgstr "Anvaend VAENSTER och HOEGER foer att aendra vaerden" + +#: src/Options.cpp:261 +msgid "Press FIRE or RETURN to exit" +msgstr "Tryck SKJUT eller RETUR foer att avsluta" + +#: src/Menu.cpp:245 +msgid "Use the arrow keys to rotate the ship" +msgstr "Anvaend piltangenterna foer att rotera skeppet" + +#: src/Menu.cpp:246 +msgid "Press the up arrow to fire the thruster" +msgstr "Tryck upp-piltagenten foer att anvaenda raketmotorn" + +#: src/Menu.cpp:247 +msgid "Smaller landing pads give you more points" +msgstr "Mindre landningsplattor ger dig fler poaeng" + +#: src/Menu.cpp:248 +msgid "Press P to pause the game" +msgstr "Tryck P för att pausa spelet" + +#: src/Menu.cpp:249 +msgid "Press escape to self destruct" +msgstr "Tryck escape för att tillintetgoera dig sjaelv" + +#: src/Menu.cpp:250 +msgid "You can only land safely when then speed bar is green" +msgstr "Du kan bara landa saekert naer hastighetsmaetaren aer groen" + +#: src/Menu.cpp:251 +msgid "Collect the spinning rings to unlock the landing pads" +msgstr "Samla de snurrande ringarna för att laasa upp landningsplattorna" + diff --git a/src/Game.cpp b/src/Game.cpp index 141f596..9b91180 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -54,7 +54,6 @@ const int Game::SCORE_FUEL_DIV(10); const int Game::SCORE_Y(30); - const float SpeedMeter::LAND_SPEED(2.0f); const int FuelMeter::FUELBAR_Y(15); diff --git a/src/SoundEffect.cpp b/src/SoundEffect.cpp index 8aefeb1..6a2d2d0 100644 --- a/src/SoundEffect.cpp +++ b/src/SoundEffect.cpp @@ -42,7 +42,9 @@ SoundEffect::SoundEffect(const char* filename, Uint8 volume) Mix_QuerySpec(&audioRate, &audioFormat, &audioChannels); } - if (enabled && !(sound = Mix_LoadWAV(filename))) { + if (!enabled) return; + + if (!(sound = Mix_LoadWAV(filename))) { ostringstream ss; ss << "Error loading " << filename << ": "; ss << Mix_GetError(); @@ -57,7 +59,9 @@ SoundEffect::~SoundEffect() if (channel != -1) Mix_HaltChannel(channel); - Mix_FreeChunk(sound); + if (enabled) + Mix_FreeChunk(sound); + if (--loadCount == 0) Mix_CloseAudio(); -- 2.39.2