summaryrefslogtreecommitdiff
path: root/src/net/tmwa/gamehandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/tmwa/gamehandler.cpp')
-rw-r--r--src/net/tmwa/gamehandler.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp
index 435d5d30..63f5fcec 100644
--- a/src/net/tmwa/gamehandler.cpp
+++ b/src/net/tmwa/gamehandler.cpp
@@ -22,12 +22,11 @@
#include "net/tmwa/gamehandler.h"
#include "client.h"
+#include "event.h"
#include "game.h"
#include "localplayer.h"
#include "log.h"
-#include "gui/widgets/chattab.h"
-
#include "gui/okdialog.h"
#include "net/messagein.h"
@@ -58,6 +57,8 @@ GameHandler::GameHandler()
};
handledMessages = _messages;
gameHandler = this;
+
+ listen(CHANNEL_GAME);
}
void GameHandler::handleMessage(Net::MessageIn &msg)
@@ -84,8 +85,7 @@ void GameHandler::handleMessage(Net::MessageIn &msg)
break;
case SMSG_WHO_ANSWER:
- localChatTab->chatLog(strprintf(_("Online users: %d"),
- msg.readInt32()), BY_SERVER);
+ SERVER_NOTICE(strprintf(_("Online users: %d"), msg.readInt32()))
break;
case SMSG_CHAR_SWITCH_RESPONSE:
@@ -105,6 +105,21 @@ void GameHandler::handleMessage(Net::MessageIn &msg)
}
}
+void GameHandler::event(Channels channel, const Mana::Event &event)
+{
+ if (channel == CHANNEL_GAME)
+ {
+ if (event.getName() == EVENT_ENGINESINITALIZED)
+ {
+ Game::instance()->changeMap(mMap);
+ }
+ else if (event.getName() == EVENT_MAPLOADED)
+ {
+ MessageOut outMsg(CMSG_MAP_LOADED);
+ }
+ }
+}
+
void GameHandler::connect()
{
mNetwork->connect(mapServer);
@@ -142,16 +157,6 @@ void GameHandler::disconnect()
mNetwork->disconnect();
}
-void GameHandler::inGame()
-{
- Game::instance()->changeMap(mMap);
-}
-
-void GameHandler::mapLoaded(const std::string &mapName)
-{
- MessageOut outMsg(CMSG_MAP_LOADED);
-}
-
void GameHandler::who()
{
}