From 41a23cb4511e9ba3985990e2703fb3d680a23d14 Mon Sep 17 00:00:00 2001 From: Chuck Miller Date: Sun, 18 Jul 2010 23:02:25 -0400 Subject: Move the majority of the netcode's server messages to the event system There is still a good way to go, but this should get us started Reviewed-by: Jared Adams --- src/net/tmwa/playerhandler.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/net/tmwa/playerhandler.cpp') diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 0ada96d7..0388573f 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -21,6 +21,8 @@ #include "net/tmwa/playerhandler.h" +#include "event.h" +#include "eventmanager.h" #include "game.h" #include "localplayer.h" #include "log.h" @@ -36,8 +38,6 @@ #include "gui/statuswindow.h" #include "gui/viewport.h" -#include "gui/widgets/chattab.h" - #include "net/messagein.h" #include "net/messageout.h" @@ -308,10 +308,9 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) int oldMoney = PlayerInfo::getAttribute(MONEY); int newMoney = msg.readInt32(); if (newMoney > oldMoney) - localChatTab->chatLog(strprintf(_("You picked up " - "%s."), - Units::formatCurrency(newMoney - oldMoney).c_str()), - BY_SERVER); + SERVER_NOTICE(strprintf(_("You picked up %s."), + Units::formatCurrency(newMoney - + oldMoney).c_str())) } break; case 0x0016: @@ -344,8 +343,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) if (ok != 1) { - localChatTab->chatLog(_("Cannot raise skill!"), - BY_SERVER); + SERVER_NOTICE(_("Cannot raise skill!")) } PlayerInfo::setStatBase(type, value); @@ -484,8 +482,9 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) switch (type) { case 0: - localChatTab->chatLog(_("Equip arrows first."), - BY_SERVER); + { + SERVER_NOTICE(_("Equip arrows first.")) + } break; default: logger->log("0x013b: Unhandled message %i", type); -- cgit v1.2.3-70-g09d2