summaryrefslogtreecommitdiff
path: root/src/net/playerhandler.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-09 12:56:02 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-09 12:56:02 +0000
commit8a9e607d36b9b22cfb22002a3bbeb1bf86810337 (patch)
tree032f20fff6f1371548d279c7cfad8e550ca75128 /src/net/playerhandler.cpp
parent76185faa619fd06576f2e67e1f2d5f1fb659e340 (diff)
downloadmana-8a9e607d36b9b22cfb22002a3bbeb1bf86810337.tar.gz
mana-8a9e607d36b9b22cfb22002a3bbeb1bf86810337.tar.bz2
mana-8a9e607d36b9b22cfb22002a3bbeb1bf86810337.tar.xz
mana-8a9e607d36b9b22cfb22002a3bbeb1bf86810337.zip
Made all local action listeners structs and moved them into anonymous namespaces.
Diffstat (limited to 'src/net/playerhandler.cpp')
-rw-r--r--src/net/playerhandler.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp
index 02afc9db..070fb112 100644
--- a/src/net/playerhandler.cpp
+++ b/src/net/playerhandler.cpp
@@ -43,27 +43,25 @@ OkDialog *deathNotice = NULL;
* Listener used for handling the overweigth message.
*/
// TODO Move somewhere else
-class WeightNoticeListener : public gcn::ActionListener
-{
- public:
- void action(const std::string &eventId)
- {
- weightNotice = NULL;
- }
-} weightNoticeListener;
-
+namespace {
+ struct WeightListener : public gcn::ActionListener
+ {
+ void action(const std::string &eventId) { weightNotice = NULL; }
+ } weightListener;
+}
/**
* Listener used for handling death message.
*/
// TODO Move somewhere else
-class DeathNoticeListener : public gcn::ActionListener {
- public:
+namespace {
+ struct DeathListener : public gcn::ActionListener {
void action(const std::string &eventId) {
player_node->revive();
deathNotice = NULL;
}
-} deathNoticeListener;
+ } deathListener;
+}
PlayerHandler::PlayerHandler()
{
@@ -142,7 +140,7 @@ void PlayerHandler::handleMessage(MessageIn *msg)
"You are carrying more then half your "
"weight. You are unable to regain "
"health.");
- weightNotice->addActionListener(&weightNoticeListener);
+ weightNotice->addActionListener(&weightListener);
}
player_node->mTotalWeight = value;
break;
@@ -164,7 +162,7 @@ void PlayerHandler::handleMessage(MessageIn *msg)
{
deathNotice = new OkDialog("Message",
"You're now dead, press ok to restart");
- deathNotice->addActionListener(&deathNoticeListener);
+ deathNotice->addActionListener(&deathListener);
player_node->mAction = Being::DEAD;
}
}