diff options
-rw-r--r-- | src/gui/buysell.cpp | 3 | ||||
-rw-r--r-- | src/main.cpp | 26 | ||||
-rw-r--r-- | src/net/ea/playerhandler.cpp | 113 |
3 files changed, 73 insertions, 69 deletions
diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp index c56f6435..b9a6a1dc 100644 --- a/src/gui/buysell.cpp +++ b/src/gui/buysell.cpp @@ -44,7 +44,8 @@ BuySellDialog::BuySellDialog(Network *network): for (const char **curBtn = buttonNames; *curBtn; curBtn++) { Button *btn = new Button(gettext(*curBtn), *curBtn, this); - if (!buyButton) buyButton = btn; // For focus request + if (!buyButton) + buyButton = btn; // For focus request btn->setPosition(x, y); add(btn); x += btn->getWidth() + 10; diff --git a/src/main.cpp b/src/main.cpp index 2f99b352..e954df4e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,18 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <getopt.h> -#include <iostream> -#include <physfs.h> -#include <unistd.h> -#include <vector> -#include <SDL_image.h> - -#include <guichan/actionlistener.hpp> - -#include <libxml/parser.h> - -#include <SDL/SDL_ttf.h> +#include "main.h" #include "configuration.h" #include "emoteshortcut.h" @@ -42,7 +31,6 @@ #include "lockedarray.h" #include "log.h" #include "logindata.h" -#include "main.h" #ifdef USE_OPENGL #include "openglgraphics.h" #endif @@ -111,6 +99,18 @@ #include "utils/stringutils.h" #include "utils/strprintf.h" +#include <SDL_image.h> + +#include <guichan/actionlistener.hpp> + +#include <libxml/parser.h> + +#include <getopt.h> +#include <iostream> +#include <physfs.h> +#include <unistd.h> +#include <vector> + #ifdef __APPLE__ #include <CoreFoundation/CFBundle.h> #endif diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 54cfde9b..f78d6387 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -56,11 +56,12 @@ OkDialog *deathNotice = NULL; // everything beyond will reset the port hard. static const int MAP_TELEPORT_SCROLL_DISTANCE = 8; -/** - * Listener used for handling the overweigth message. - */ // TODO Move somewhere else namespace { + + /** + * Listener used for handling the overweigth message. + */ struct WeightListener : public gcn::ActionListener { void action(const gcn::ActionEvent &event) @@ -68,13 +69,10 @@ namespace { weightNotice = NULL; } } weightListener; -} -/** - * Listener used for handling death message. - */ -// TODO Move somewhere else -namespace { + /** + * Listener used for handling death message. + */ struct DeathListener : public gcn::ActionListener { void action(const gcn::ActionEvent &event) @@ -96,6 +94,55 @@ namespace { if (storageWindow->isVisible()) storageWindow->close(); } } deathListener; + +} // anonymous namespace + +static const char *randomDeathMessage() +{ + static char const *const deadMsg[] = + { + N_("You are dead."), + N_("We regret to inform you that your character was killed in " + "battle."), + N_("You are not that alive anymore."), + N_("The cold hands of the grim reaper are grabbing for your soul."), + N_("Game Over!"), + N_("Insert coin to continue"), + N_("No, kids. Your character did not really die. It... " + "err... went to a better place."), + N_("Your plan of breaking your enemies weapon by " + "bashing it with your throat failed."), + N_("I guess this did not run too well."), + // NetHack reference: + N_("Do you want your possessions identified?"), + // Secret of Mana reference: + N_("Sadly, no trace of you was ever found..."), + // Final Fantasy VI reference: + N_("Annihilated."), + // Earthbound reference: + N_("Looks like you got your head handed to you."), + // Leisure Suit Larry 1 reference: + N_("You screwed up again, dump your body down the tubes " + "and get you another one."), + // Monty Python references (Dead Parrot sketch mostly): + N_("You're not dead yet. You're just resting."), + N_("You are no more."), + N_("You have ceased to be."), + N_("You've expired and gone to meet your maker."), + N_("You're a stiff."), + N_("Bereft of life, you rest in peace."), + N_("If you weren't so animated, you'd be pushing up the daisies."), + N_("Your metabolic processes are now history."), + N_("You're off the twig."), + N_("You've kicked the bucket."), + N_("You've shuffled off your mortal coil, run down the " + "curtain and joined the bleedin' choir invisibile."), + N_("You are an ex-player."), + N_("You're pining for the fjords.") + }; + + const int random = rand() % (sizeof(deadMsg) / sizeof(deadMsg[0])); + return gettext(deadMsg[random]); } PlayerHandler::PlayerHandler() @@ -222,52 +269,8 @@ void PlayerHandler::handleMessage(MessageIn &msg) if (player_node->getHp() == 0 && !deathNotice) { - static char const *const deadMsg[] = - { - _("You are dead."), - _("We regret to inform you that your character was " - "killed in battle."), - _("You are not that alive anymore."), - _("The cold hands of the grim reaper are grabbing for " - "your soul."), - _("Game Over!"), - _("Insert coin to continue"), - _("No, kids. Your character did not really die. It... " - "err... went to a better place."), - _("Your plan of breaking your enemies weapon by " - "bashing it with your throat failed."), - _("I guess this did not run too well."), - // NetHack reference: - _("Do you want your possessions identified?"), - // Secret of Mana reference: - _("Sadly, no trace of you was ever found..."), - // Final Fantasy VI reference: - _("Annihilated."), - // Earthbound reference: - _("Looks like you got your head handed to you."), - // Leisure Suit Larry 1 reference: - _("You screwed up again, dump your body down the tubes " - "and get you another one."), - // Monty Python references (Dead Parrot sketch mostly): - _("You're not dead yet. You're just resting."), - _("You are no more."), - _("You have ceased to be."), - _("You've expired and gone to meet your maker."), - _("You're a stiff."), - _("Bereft of life, you rest in peace."), - _("If you weren't so animated, you'd be pushing up the " - "daisies."), - _("Your metabolic processes are now history."), - _("You're off the twig."), - _("You've kicked the bucket."), - _("You've shuffled off your mortal coil, run down the " - "curtain and joined the bleedin' choir invisibile."), - _("You are an ex-player."), - _("You're pining for the fjords.") - }; - std::string message(deadMsg[rand()%27]); - - deathNotice = new OkDialog(_("Message"), message); + deathNotice = new OkDialog(_("Message"), + randomDeathMessage()); deathNotice->addActionListener(&deathListener); player_node->setAction(Being::DEAD); } |