summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Miller <shadowmil@gmail.com>2010-08-01 18:00:41 -0400
committerChuck Miller <shadowmil@gmail.com>2010-08-01 18:29:00 -0400
commit0e189bbe81c88283438aabb4fec3ba30920d3a36 (patch)
treec3f4b454564c6335c972fadd64fbc82cf23db55e
parent1937ef53c8dd42d986c0a6b061a482a6d8e3c0f7 (diff)
downloadmana-0e189bbe81c88283438aabb4fec3ba30920d3a36.tar.gz
mana-0e189bbe81c88283438aabb4fec3ba30920d3a36.tar.bz2
mana-0e189bbe81c88283438aabb4fec3ba30920d3a36.tar.xz
mana-0e189bbe81c88283438aabb4fec3ba30920d3a36.zip
Reduce localChatTab presence replacing it with the event system
Reviewed-By: Jared Adams
-rw-r--r--src/game.cpp12
-rw-r--r--src/gui/chat.cpp2
-rw-r--r--src/gui/npcpostdialog.cpp6
-rw-r--r--src/gui/outfitwindow.cpp1
-rw-r--r--src/gui/recorder.cpp12
-rw-r--r--src/gui/socialwindow.cpp54
-rw-r--r--src/gui/trade.cpp10
-rw-r--r--src/localplayer.cpp8
-rw-r--r--src/net/manaserv/chathandler.cpp13
-rw-r--r--src/net/tmwa/specialhandler.cpp5
-rw-r--r--src/statuseffect.cpp5
11 files changed, 58 insertions, 70 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 3aa093a6..148c3784 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -324,11 +324,11 @@ static bool saveScreenshot()
std::stringstream chatlogentry;
// TODO: Make it one complete gettext string below
chatlogentry << _("Screenshot saved as ") << filenameSuffix.str();
- localChatTab->chatLog(chatlogentry.str(), BY_SERVER);
+ SERVER_NOTICE(chatlogentry.str())
}
else
{
- localChatTab->chatLog(_("Saving screenshot failed!"), BY_SERVER);
+ SERVER_NOTICE(_("Saving screenshot failed!"))
logger->log("Error: could not save screenshot.");
}
@@ -707,16 +707,12 @@ void Game::handleInput()
unsigned int deflt = player_relations.getDefault();
if (deflt & PlayerRelation::TRADE)
{
- localChatTab->chatLog(
- _("Ignoring incoming trade requests"),
- BY_SERVER);
+ SERVER_NOTICE(_("Ignoring incoming trade requests"))
deflt &= ~PlayerRelation::TRADE;
}
else
{
- localChatTab->chatLog(
- _("Accepting incoming trade requests"),
- BY_SERVER);
+ SERVER_NOTICE(_("Accepting incoming trade requests"))
deflt |= PlayerRelation::TRADE;
}
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 86dc9d4d..00787182 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -415,9 +415,7 @@ void ChatWindow::event(const std::string &channel, const Mana::Event &event)
if (channel == "Notices")
{
if (event.getName() == "ServerNotice")
- {
localChatTab->chatLog(event.getString("message"), BY_SERVER);
- }
}
}
diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp
index 68a91f36..74173ae9 100644
--- a/src/gui/npcpostdialog.cpp
+++ b/src/gui/npcpostdialog.cpp
@@ -21,8 +21,9 @@
#include "gui/npcpostdialog.h"
+#include "eventmanager.h"
+
#include "gui/widgets/button.h"
-#include "gui/widgets/chattab.h"
#include "gui/widgets/label.h"
#include "gui/widgets/textbox.h"
#include "gui/widgets/textfield.h"
@@ -91,8 +92,7 @@ void NpcPostDialog::action(const gcn::ActionEvent &event)
{
if (mSender->getText().empty() || mText->getText().empty())
{
- localChatTab->chatLog(_("Failed to send as sender or letter "
- "invalid."));
+ SERVER_NOTICE(_("Failed to send as sender or letter invalid."))
}
else
{
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index 51b4b5c5..ad3342ee 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -33,7 +33,6 @@
#include "gui/widgets/button.h"
#include "gui/widgets/checkbox.h"
-#include "gui/widgets/chattab.h"
#include "gui/widgets/label.h"
#include "gui/widgets/layout.h"
diff --git a/src/gui/recorder.cpp b/src/gui/recorder.cpp
index 257afd7f..53024e7c 100644
--- a/src/gui/recorder.cpp
+++ b/src/gui/recorder.cpp
@@ -21,11 +21,11 @@
#include "gui/recorder.h"
#include "client.h"
+#include "eventmanager.h"
#include "gui/chat.h"
#include "gui/widgets/button.h"
-#include "gui/widgets/chattab.h"
#include "gui/widgets/layout.h"
#include "gui/widgets/windowcontainer.h"
@@ -84,16 +84,16 @@ void Recorder::setRecordingFile(const std::string &msg)
* Message should go after mStream is closed so that it isn't
* recorded.
*/
- localChatTab->chatLog(_("Finishing recording."), BY_SERVER);
+ SERVER_NOTICE(_("Finishing recording."))
}
else
{
- localChatTab->chatLog(_("Not currently recording."), BY_SERVER);
+ SERVER_NOTICE(_("Not currently recording."))
}
}
else if (mStream.is_open())
{
- localChatTab->chatLog(_("Already recording."), BY_SERVER);
+ SERVER_NOTICE(_("Already recording."))
}
else
{
@@ -101,7 +101,7 @@ void Recorder::setRecordingFile(const std::string &msg)
* Message should go before mStream is opened so that it isn't
* recorded.
*/
- localChatTab->chatLog(_("Starting to record..."), BY_SERVER);
+ SERVER_NOTICE(_("Starting to record..."))
const std::string file = Client::getLocalDataDirectory() + "/" + msgCopy;
mStream.open(file.c_str(), std::ios_base::trunc);
@@ -109,7 +109,7 @@ void Recorder::setRecordingFile(const std::string &msg)
if (mStream.is_open())
setVisible(true);
else
- localChatTab->chatLog(_("Failed to start recording."), BY_SERVER);
+ SERVER_NOTICE(_("Failed to start recording."))
}
}
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index 25447f30..cd9471aa 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -20,6 +20,7 @@
#include "gui/socialwindow.h"
+#include "eventmanager.h"
#include "guild.h"
#include "localplayer.h"
#include "party.h"
@@ -33,7 +34,6 @@
#include "gui/widgets/avatarlistbox.h"
#include "gui/widgets/browserbox.h"
#include "gui/widgets/button.h"
-#include "gui/widgets/chattab.h"
#include "gui/widgets/container.h"
#include "gui/widgets/label.h"
#include "gui/widgets/layouthelper.h"
@@ -121,10 +121,9 @@ public:
std::string name = mInviteDialog->getText();
Net::getGuildHandler()->invite(mGuild->getId(), name);
- localChatTab->chatLog(strprintf(_("Invited user %s to guild %s."),
+ SERVER_NOTICE(strprintf(_("Invited user %s to guild %s."),
name.c_str(),
- mGuild->getName().c_str()),
- BY_SERVER);
+ mGuild->getName().c_str()))
mInviteDialog = NULL;
}
else if (event.getId() == "~do invite")
@@ -134,8 +133,8 @@ public:
else if (event.getId() == "yes")
{
Net::getGuildHandler()->leave(mGuild->getId());
- localChatTab->chatLog(strprintf(_("Guild %s quit requested."),
- mGuild->getName().c_str()), BY_SERVER);
+ SERVER_NOTICE(strprintf(_("Guild %s quit requested."),
+ mGuild->getName().c_str()))
mConfirmDialog = NULL;
}
else if (event.getId() == "~yes")
@@ -202,8 +201,8 @@ public:
std::string name = mInviteDialog->getText();
Net::getPartyHandler()->invite(name);
- localChatTab->chatLog(strprintf(_("Invited user %s to party."),
- name.c_str()), BY_SERVER);
+ SERVER_NOTICE(strprintf(_("Invited user %s to party."),
+ name.c_str()))
mInviteDialog = NULL;
}
else if (event.getId() == "~do invite")
@@ -213,8 +212,8 @@ public:
else if (event.getId() == "yes")
{
Net::getPartyHandler()->leave();
- localChatTab->chatLog(strprintf(_("Party %s quit requested."),
- mParty->getName().c_str()), BY_SERVER);
+ SERVER_NOTICE(strprintf(_("Party %s quit requested."),
+ mParty->getName().c_str()))
mConfirmDialog = NULL;
}
else if (event.getId() == "~yes")
@@ -438,14 +437,14 @@ void SocialWindow::action(const gcn::ActionEvent &event)
// check if they accepted the invite
if (eventId == "yes")
{
- localChatTab->chatLog(strprintf(_("Accepted party invite from %s."),
- mPartyInviter.c_str()));
+ SERVER_NOTICE(strprintf(_("Accepted party invite from %s."),
+ mPartyInviter.c_str()))
Net::getPartyHandler()->inviteResponse(mPartyInviter, true);
}
else if (eventId == "no")
{
- localChatTab->chatLog(strprintf(_("Rejected party invite from %s."),
- mPartyInviter.c_str()));
+ SERVER_NOTICE(strprintf(_("Rejected party invite from %s."),
+ mPartyInviter.c_str()))
Net::getPartyHandler()->inviteResponse(mPartyInviter, false);
}
@@ -457,14 +456,14 @@ void SocialWindow::action(const gcn::ActionEvent &event)
// check if they accepted the invite
if (eventId == "yes")
{
- localChatTab->chatLog(strprintf(_("Accepted guild invite from %s."),
- mPartyInviter.c_str()));
+ SERVER_NOTICE(strprintf(_("Accepted guild invite from %s."),
+ mPartyInviter.c_str()))
Net::getGuildHandler()->inviteResponse(mGuildInvited, true);
}
else if (eventId == "no")
{
- localChatTab->chatLog(strprintf(_("Rejected guild invite from %s."),
- mPartyInviter.c_str()));
+ SERVER_NOTICE(strprintf(_("Rejected guild invite from %s."),
+ mPartyInviter.c_str()))
Net::getGuildHandler()->inviteResponse(mGuildInvited, false);
}
@@ -497,8 +496,8 @@ void SocialWindow::action(const gcn::ActionEvent &event)
}
Net::getGuildHandler()->create(name);
- localChatTab->chatLog(strprintf(_("Creating guild called %s."),
- name.c_str()), BY_SERVER);
+ SERVER_NOTICE(strprintf(_("Creating guild called %s."),
+ name.c_str()))
mGuildCreateDialog = NULL;
}
@@ -517,8 +516,8 @@ void SocialWindow::action(const gcn::ActionEvent &event)
}
Net::getPartyHandler()->create(name);
- localChatTab->chatLog(strprintf(_("Creating party called %s."),
- name.c_str()), BY_SERVER);
+ SERVER_NOTICE(strprintf(_("Creating party called %s."),
+ name.c_str()));
mPartyCreateDialog = NULL;
}
@@ -543,14 +542,14 @@ void SocialWindow::showGuildInvite(const std::string &guildName,
// check there isnt already an invite showing
if (mGuildInvited != 0)
{
- localChatTab->chatLog(_("Received guild request, but one already "
- "exists."), BY_SERVER);
+ SERVER_NOTICE(_("Received guild request, but one already "
+ "exists."))
return;
}
std::string msg = strprintf(_("%s has invited you to join the guild %s."),
inviterName.c_str(), guildName.c_str());
- localChatTab->chatLog(msg, BY_SERVER);
+ SERVER_NOTICE(msg)
// show invite
mGuildAcceptDialog = new ConfirmDialog(_("Accept Guild Invite"), msg, this);
@@ -565,8 +564,7 @@ void SocialWindow::showPartyInvite(const std::string &partyName,
// check there isnt already an invite showing
if (mPartyInviter != "")
{
- localChatTab->chatLog(_("Received party request, but one already "
- "exists."), BY_SERVER);
+ SERVER_NOTICE(_("Received party request, but one already exists."))
return;
}
@@ -597,7 +595,7 @@ void SocialWindow::showPartyInvite(const std::string &partyName,
}
}
- localChatTab->chatLog(msg, BY_SERVER);
+ SERVER_NOTICE(msg)
// show invite
mPartyAcceptDialog = new ConfirmDialog(_("Accept Party Invite"), msg, this);
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 4a86c235..6d3c7b21 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -21,6 +21,7 @@
#include "gui/trade.h"
+#include "eventmanager.h"
#include "inventory.h"
#include "item.h"
#include "localplayer.h"
@@ -32,7 +33,6 @@
#include "gui/setup.h"
#include "gui/widgets/button.h"
-#include "gui/widgets/chattab.h"
#include "gui/widgets/itemcontainer.h"
#include "gui/widgets/label.h"
#include "gui/widgets/scrollarea.h"
@@ -271,9 +271,8 @@ void TradeWindow::action(const gcn::ActionEvent &event)
if (mMyInventory->contains(item))
{
- localChatTab->chatLog(_("Failed adding item. You can not "
- "overlap one kind of item on the window."),
- BY_SERVER);
+ SERVER_NOTICE(_("Failed adding item. You can not "
+ "overlap one kind of item on the window."))
return;
}
@@ -314,8 +313,7 @@ void TradeWindow::action(const gcn::ActionEvent &event)
int curMoney = PlayerInfo::getAttribute(MONEY);
if (v > curMoney)
{
- localChatTab->chatLog(_("You don't have enough money."),
- BY_SERVER);
+ SERVER_NOTICE(_("You don't have enough money."))
v = curMoney;
}
Net::getTradeHandler()->setMoney(v);
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index f8d0ae0e..11fdf44c 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -24,6 +24,7 @@
#include "client.h"
#include "configuration.h"
#include "effectmanager.h"
+#include "eventmanager.h"
#include "flooritem.h"
#include "graphics.h"
#include "guild.h"
@@ -1000,7 +1001,7 @@ void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount)
{
if (config.getValue("showpickupchat", 1))
{
- localChatTab->chatLog(_("Unable to pick up item."), BY_SERVER);
+ SERVER_NOTICE(_("Unable to pick up item."))
}
}
else
@@ -1009,10 +1010,9 @@ void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount)
{
// TRANSLATORS: This sentence may be translated differently
// for different grammatical numbers (singular, plural, ...)
- localChatTab->chatLog(strprintf(ngettext("You picked up %d "
+ SERVER_NOTICE(strprintf(ngettext("You picked up %d "
"[@@%d|%s@@].", "You picked up %d [@@%d|%s@@].", amount),
- amount, itemInfo.getId(), itemInfo.getName().c_str()),
- BY_SERVER);
+ amount, itemInfo.getId(), itemInfo.getName().c_str()))
}
if (mMap && config.getValue("showpickupparticle", 0))
diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp
index 37ce2bf5..40d56bbd 100644
--- a/src/net/manaserv/chathandler.cpp
+++ b/src/net/manaserv/chathandler.cpp
@@ -26,6 +26,7 @@
#include "client.h"
#include "channel.h"
#include "channelmanager.h"
+#include "eventmanager.h"
#include "gui/chat.h"
@@ -149,7 +150,7 @@ void ChatHandler::handleGameChatMessage(Net::MessageIn &msg)
if (id == 0)
{
- localChatTab->chatLog(chatMsg, BY_SERVER);
+ SERVER_NOTICE(chatMsg)
return;
}
@@ -198,13 +199,13 @@ void ChatHandler::handleEnterChannelResponse(Net::MessageIn &msg)
}
else
{
- localChatTab->chatLog(_("Error joining channel."), BY_SERVER);
+ SERVER_NOTICE(_("Error joining channel."))
}
}
void ChatHandler::handleListChannelsResponse(Net::MessageIn &msg)
{
- localChatTab->chatLog(_("Listing channels."), BY_SERVER);
+ SERVER_NOTICE(_("Listing channels."))
while (msg.getUnreadLength())
{
std::string channelName = msg.readString();
@@ -214,9 +215,9 @@ void ChatHandler::handleListChannelsResponse(Net::MessageIn &msg)
numUsers << msg.readInt16();
channelName += " - ";
channelName += numUsers.str();
- localChatTab->chatLog(channelName, BY_SERVER);
+ SERVER_NOTICE(channelName)
}
- localChatTab->chatLog(_("End of channel list."), BY_SERVER);
+ SERVER_NOTICE(_("End of channel list."))
}
void ChatHandler::handlePrivateMessage(Net::MessageIn &msg)
@@ -341,7 +342,7 @@ void ChatHandler::handleWhoResponse(Net::MessageIn &msg)
{
break;
}
- localChatTab->chatLog(userNick, BY_SERVER);
+ SERVER_NOTICE(userNick)
}
}
diff --git a/src/net/tmwa/specialhandler.cpp b/src/net/tmwa/specialhandler.cpp
index f147ef9b..09d83cbe 100644
--- a/src/net/tmwa/specialhandler.cpp
+++ b/src/net/tmwa/specialhandler.cpp
@@ -21,13 +21,12 @@
#include "net/tmwa/specialhandler.h"
+#include "eventmanager.h"
#include "log.h"
#include "playerinfo.h"
#include "gui/skilldialog.h"
-#include "gui/widgets/chattab.h"
-
#include "net/messagein.h"
#include "net/messageout.h"
@@ -216,7 +215,7 @@ void SpecialHandler::handleMessage(Net::MessageIn &msg)
}
}
- localChatTab->chatLog(msg);
+ SERVER_NOTICE(msg)
break;
}
}
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp
index 0d8638fc..68bae823 100644
--- a/src/statuseffect.cpp
+++ b/src/statuseffect.cpp
@@ -21,11 +21,10 @@
#include "statuseffect.h"
+#include "eventmanager.h"
#include "log.h"
#include "sound.h"
-#include "gui/widgets/chattab.h"
-
#include "utils/xml.h"
#include "configuration.h"
@@ -52,7 +51,7 @@ void StatusEffect::playSFX()
void StatusEffect::deliverMessage()
{
if (!mMessage.empty())
- localChatTab->chatLog(mMessage, BY_SERVER);
+ SERVER_NOTICE(mMessage)
}
Particle *StatusEffect::getParticle()