diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-10-22 15:04:20 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-10-23 10:09:26 +0200 |
commit | 1ac56984c0c8bd68166e38dcd6e5e5a4e770ec8c (patch) | |
tree | 463ddf2cc6126021124c842c70b2c9fdcd2009ec /src | |
parent | 9de9b252705fafda327eb18022b0771e7d28a9c9 (diff) | |
download | mana-1ac56984c0c8bd68166e38dcd6e5e5a4e770ec8c.tar.gz mana-1ac56984c0c8bd68166e38dcd6e5e5a4e770ec8c.tar.bz2 mana-1ac56984c0c8bd68166e38dcd6e5e5a4e770ec8c.tar.xz mana-1ac56984c0c8bd68166e38dcd6e5e5a4e770ec8c.zip |
Changed SERVER_NOTICE macro to inline function
Seems to be no point in using a macro here.
Diffstat (limited to 'src')
-rw-r--r-- | src/event.h | 10 | ||||
-rw-r--r-- | src/game.cpp | 11 | ||||
-rw-r--r-- | src/gui/npcpostdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/recorder.cpp | 10 | ||||
-rw-r--r-- | src/gui/socialwindow.cpp | 60 | ||||
-rw-r--r-- | src/gui/tradewindow.cpp | 6 | ||||
-rw-r--r-- | src/localplayer.cpp | 10 | ||||
-rw-r--r-- | src/net/manaserv/chathandler.cpp | 19 | ||||
-rw-r--r-- | src/net/manaserv/guildhandler.cpp | 21 | ||||
-rw-r--r-- | src/net/manaserv/partyhandler.cpp | 30 | ||||
-rw-r--r-- | src/net/manaserv/tradehandler.cpp | 8 | ||||
-rw-r--r-- | src/net/tmwa/adminhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwa/buysellhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/tmwa/chathandler.cpp | 20 | ||||
-rw-r--r-- | src/net/tmwa/guildhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/inventoryhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/tmwa/partyhandler.cpp | 8 | ||||
-rw-r--r-- | src/net/tmwa/playerhandler.cpp | 18 | ||||
-rw-r--r-- | src/net/tmwa/specialhandler.cpp | 8 | ||||
-rw-r--r-- | src/net/tmwa/tradehandler.cpp | 50 | ||||
-rw-r--r-- | src/statuseffect.cpp | 2 |
21 files changed, 152 insertions, 159 deletions
diff --git a/src/event.h b/src/event.h index 065fb7f6..868aabab 100644 --- a/src/event.h +++ b/src/event.h @@ -284,9 +284,11 @@ private: std::map<std::string, VariableData *> mData; }; -#define SERVER_NOTICE(message) { \ -Event event(Event::ServerNotice); \ -event.setString("message", message); \ -event.trigger(Event::NoticesChannel, event); } +inline void serverNotice(const std::string &message) +{ + Event event(Event::ServerNotice); + event.setString("message", message); + event.trigger(Event::NoticesChannel); +} #endif // EVENT_H diff --git a/src/game.cpp b/src/game.cpp index d55d80dd..c0624425 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -287,7 +287,7 @@ static bool saveScreenshot() if (!screenshot) { - SERVER_NOTICE(_("Could not take screenshot!")) + serverNotice(_("Could not take screenshot!")); logger->log("Error: could not take screenshot."); return false; } @@ -325,11 +325,12 @@ static bool saveScreenshot() if (success) { - SERVER_NOTICE(strprintf(_("Screenshot saved as %s"), filenameSuffix.str().c_str())) + serverNotice(strprintf(_("Screenshot saved as %s"), + filenameSuffix.str().c_str())); } else { - SERVER_NOTICE(_("Saving screenshot failed!")) + serverNotice(_("Saving screenshot failed!")); logger->log("Error: could not save screenshot."); } @@ -704,12 +705,12 @@ void Game::handleInput() unsigned int deflt = player_relations.getDefault(); if (deflt & PlayerRelation::TRADE) { - SERVER_NOTICE(_("Ignoring incoming trade requests")) + serverNotice(_("Ignoring incoming trade requests")); deflt &= ~PlayerRelation::TRADE; } else { - SERVER_NOTICE(_("Accepting incoming trade requests")) + serverNotice(_("Accepting incoming trade requests")); deflt |= PlayerRelation::TRADE; } diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp index 3567472a..a1b39e24 100644 --- a/src/gui/npcpostdialog.cpp +++ b/src/gui/npcpostdialog.cpp @@ -96,7 +96,7 @@ void NpcPostDialog::action(const gcn::ActionEvent &event) { if (mSender->getText().empty() || mText->getText().empty()) { - SERVER_NOTICE(_("Failed to send as sender or letter invalid.")) + serverNotice(_("Failed to send as sender or letter invalid.")); } else { diff --git a/src/gui/recorder.cpp b/src/gui/recorder.cpp index 07bc5fcd..8dd0f8ed 100644 --- a/src/gui/recorder.cpp +++ b/src/gui/recorder.cpp @@ -84,16 +84,16 @@ void Recorder::setRecordingFile(const std::string &msg) * Message should go after mStream is closed so that it isn't * recorded. */ - SERVER_NOTICE(_("Finishing recording.")) + serverNotice(_("Finishing recording.")); } else { - SERVER_NOTICE(_("Not currently recording.")) + serverNotice(_("Not currently recording.")); } } else if (mStream.is_open()) { - SERVER_NOTICE(_("Already recording.")) + serverNotice(_("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. */ - SERVER_NOTICE(_("Starting to record...")) + serverNotice(_("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 - SERVER_NOTICE(_("Failed to start recording.")) + serverNotice(_("Failed to start recording.")); } } diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index 065d0b0a..5a15da8f 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -113,9 +113,9 @@ public: if (!name.empty()) { Net::getGuildHandler()->invite(mGuild->getId(), name); - SERVER_NOTICE(strprintf(_("Invited user %s to guild %s."), - name.c_str(), - mGuild->getName().c_str())) + serverNotice(strprintf(_("Invited user %s to guild %s."), + name.c_str(), + mGuild->getName().c_str())); } mInviteDialog = nullptr; } @@ -126,8 +126,8 @@ public: else if (event.getId() == "yes") { Net::getGuildHandler()->leave(mGuild->getId()); - SERVER_NOTICE(strprintf(_("Guild %s quit requested."), - mGuild->getName().c_str())) + serverNotice(strprintf(_("Guild %s quit requested."), + mGuild->getName().c_str())); mConfirmDialog = nullptr; } else if (event.getId() == "no") @@ -186,8 +186,8 @@ public: std::string name = mInviteDialog->getText(); if (!name.empty()) - SERVER_NOTICE(strprintf(_("Invited user %s to party."), - name.c_str())) + serverNotice(strprintf(_("Invited user %s to party."), + name.c_str())); mInviteDialog = nullptr; } else if (event.getId() == "~do invite") @@ -197,8 +197,8 @@ public: else if (event.getId() == "yes") { Net::getPartyHandler()->leave(); - SERVER_NOTICE(strprintf(_("Party %s quit requested."), - mParty->getName().c_str())) + serverNotice(strprintf(_("Party %s quit requested."), + mParty->getName().c_str())); mConfirmDialog = nullptr; } else if (event.getId() == "no") @@ -482,14 +482,14 @@ void SocialWindow::action(const gcn::ActionEvent &event) // check if they accepted the invite if (eventId == "yes") { - SERVER_NOTICE(strprintf(_("Accepted party invite from %s."), - mPartyInviter.c_str())) + serverNotice(strprintf(_("Accepted party invite from %s."), + mPartyInviter.c_str())); Net::getPartyHandler()->inviteResponse(mPartyInviter, true); } else if (eventId == "no") { - SERVER_NOTICE(strprintf(_("Rejected party invite from %s."), - mPartyInviter.c_str())) + serverNotice(strprintf(_("Rejected party invite from %s."), + mPartyInviter.c_str())); Net::getPartyHandler()->inviteResponse(mPartyInviter, false); } @@ -501,12 +501,12 @@ void SocialWindow::action(const gcn::ActionEvent &event) // check if they accepted the invite if (eventId == "yes") { - SERVER_NOTICE(_("Accepted guild invite")) + serverNotice(_("Accepted guild invite")); Net::getGuildHandler()->inviteResponse(mGuildInvited, true); } else if (eventId == "no") { - SERVER_NOTICE(_("Rejected guild invite.")) + serverNotice(_("Rejected guild invite.")); Net::getGuildHandler()->inviteResponse(mGuildInvited, false); } @@ -534,16 +534,16 @@ void SocialWindow::action(const gcn::ActionEvent &event) if (name.size() > 16) { - SERVER_NOTICE(_("Creating guild failed, please choose a " - "shorter name.")); + serverNotice(_("Creating guild failed, please choose a " + "shorter name.")); return; } if (!name.empty()) { Net::getGuildHandler()->create(name); - SERVER_NOTICE(strprintf(_("Creating guild called %s."), - name.c_str())); + serverNotice(strprintf(_("Creating guild called %s."), + name.c_str())); } mGuildCreateDialog = nullptr; @@ -558,16 +558,16 @@ void SocialWindow::action(const gcn::ActionEvent &event) if (name.size() > 16) { - SERVER_NOTICE(_("Creating party failed, please choose a " - "shorter name.")); + serverNotice(_("Creating party failed, please choose a " + "shorter name.")); return; } if (!name.empty()) { Net::getPartyHandler()->create(name); - SERVER_NOTICE(strprintf(_("Creating party called %s."), - name.c_str())); + serverNotice(strprintf(_("Creating party called %s."), + name.c_str())); } mPartyCreateDialog = nullptr; @@ -593,13 +593,13 @@ void SocialWindow::showGuildInvite(const std::string &guildName, // check there isnt already an invite showing if (mGuildInvited != 0) { - SERVER_NOTICE(_("Received guild request, but one already exists.")) + serverNotice(_("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()); - SERVER_NOTICE(msg) + serverNotice(msg); // show invite mGuildAcceptDialog = new ConfirmDialog(_("Accept Guild Invite"), msg, this); @@ -614,7 +614,7 @@ void SocialWindow::showPartyInvite(const std::string &inviter, // check there isnt already an invite showing if (!mPartyInviter.empty()) { - SERVER_NOTICE(_("Received party request, but one already exists.")) + serverNotice(_("Received party request, but one already exists.")); return; } @@ -628,7 +628,7 @@ void SocialWindow::showPartyInvite(const std::string &inviter, else { msg = strprintf(_("You have been invited to join the %s party."), - partyName.c_str()); + partyName.c_str()); } } else @@ -636,16 +636,16 @@ void SocialWindow::showPartyInvite(const std::string &inviter, if (partyName.empty()) { msg = strprintf(_("%s has invited you to join their party."), - inviter.c_str()); + inviter.c_str()); } else { msg = strprintf(_("%s has invited you to join the %s party."), - inviter.c_str(), partyName.c_str()); + inviter.c_str(), partyName.c_str()); } } - SERVER_NOTICE(msg) + serverNotice(msg); // show invite mPartyAcceptDialog = new ConfirmDialog(_("Accept Party Invite"), msg, this); diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp index 2bcdecff..db4b6490 100644 --- a/src/gui/tradewindow.cpp +++ b/src/gui/tradewindow.cpp @@ -259,8 +259,8 @@ void TradeWindow::action(const gcn::ActionEvent &event) if (mMyInventory->contains(item)) { - SERVER_NOTICE(_("Failed adding item. You cannot " - "overlap one kind of item on the window.")) + serverNotice(_("Failed adding item. You cannot " + "overlap one kind of item on the window.")); return; } @@ -300,7 +300,7 @@ void TradeWindow::action(const gcn::ActionEvent &event) int curMoney = PlayerInfo::getAttribute(MONEY); if (v > curMoney) { - SERVER_NOTICE(_("You don't have enough money.")) + serverNotice(_("You don't have enough money.")); v = curMoney; } Net::getTradeHandler()->setMoney(v); diff --git a/src/localplayer.cpp b/src/localplayer.cpp index f2c1d33d..7dec601a 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -872,7 +872,7 @@ void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount, } if (config.getValue("showpickupchat", 1)) { - SERVER_NOTICE(_(msg)) + serverNotice(_(msg)); } if (mMap && config.getBoolValue("showpickupparticle")) { @@ -886,10 +886,10 @@ void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount, { // TRANSLATORS: This sentence may be translated differently // for different grammatical numbers (singular, plural, ...) - SERVER_NOTICE(strprintf(ngettext("You picked up %d [@@%d|%s@@].", - "You picked up %d [@@%d|%s@@].", - amount), - amount, itemInfo.id, itemInfo.name.c_str())) + serverNotice(strprintf(ngettext("You picked up %d [@@%d|%s@@].", + "You picked up %d [@@%d|%s@@].", + amount), + amount, itemInfo.id, itemInfo.name.c_str())); } if (mMap && config.getBoolValue("showpickupparticle")) diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp index ce21eb2f..11a1331e 100644 --- a/src/net/manaserv/chathandler.cpp +++ b/src/net/manaserv/chathandler.cpp @@ -150,7 +150,7 @@ void ChatHandler::handleGameChatMessage(MessageIn &msg) if (id == 0) { - SERVER_NOTICE(chatMsg) + serverNotice(chatMsg); return; } @@ -208,13 +208,13 @@ void ChatHandler::handleEnterChannelResponse(MessageIn &msg) } else { - SERVER_NOTICE(_("Error joining channel.")) + serverNotice(_("Error joining channel.")); } } void ChatHandler::handleListChannelsResponse(MessageIn &msg) { - SERVER_NOTICE(_("Listing channels.")) + serverNotice(_("Listing channels.")); while (msg.getUnreadLength()) { std::string channelName = msg.readString(); @@ -224,9 +224,9 @@ void ChatHandler::handleListChannelsResponse(MessageIn &msg) numUsers << msg.readInt16(); channelName += " - "; channelName += numUsers.str(); - SERVER_NOTICE(channelName) + serverNotice(channelName); } - SERVER_NOTICE(_("End of channel list.")) + serverNotice(_("End of channel list.")); } void ChatHandler::handlePrivateMessage(MessageIn &msg) @@ -355,16 +355,13 @@ void ChatHandler::handleChannelEvent(MessageIn &msg) void ChatHandler::handleWhoResponse(MessageIn &msg) { - std::string userNick; - while (msg.getUnreadLength()) { - userNick = msg.readString(); + std::string userNick = msg.readString(); if (userNick.empty()) - { break; - } - SERVER_NOTICE(userNick) + + serverNotice(userNick); } } diff --git a/src/net/manaserv/guildhandler.cpp b/src/net/manaserv/guildhandler.cpp index 1d927e30..9fdbafc2 100644 --- a/src/net/manaserv/guildhandler.cpp +++ b/src/net/manaserv/guildhandler.cpp @@ -77,12 +77,12 @@ void GuildHandler::handleMessage(MessageIn &msg) if (msg.readInt8() == ERRMSG_OK) { // TODO - Acknowledge guild was created - SERVER_NOTICE(_("Guild created.")) + serverNotice(_("Guild created.")); joinedGuild(msg); } else { - SERVER_NOTICE(_("Error creating guild.")) + serverNotice(_("Error creating guild.")); } } break; @@ -93,19 +93,19 @@ void GuildHandler::handleMessage(MessageIn &msg) if (response == ERRMSG_OK) { // TODO - Acknowledge invite was sent - SERVER_NOTICE(_("Invite sent.")) + serverNotice(_("Invite sent.")); } else if (response == ERRMSG_ALREADY_MEMBER) { - SERVER_NOTICE(_("Invited player is already in that guild.")); + serverNotice(_("Invited player is already in that guild.")); } else if (response == ERRMSG_LIMIT_REACHED) { - SERVER_NOTICE(_("Invited player can't join another guild.")); + serverNotice(_("Invited player can't join another guild.")); } else // any other failure { - SERVER_NOTICE(_("Invite failed.")); + serverNotice(_("Invite failed.")); } } break; @@ -212,12 +212,12 @@ void GuildHandler::handleMessage(MessageIn &msg) if (msg.readInt8() == ERRMSG_OK) { // promotion succeeded - SERVER_NOTICE(_("Member was promoted successfully.")) + serverNotice(_("Member was promoted successfully.")); } else { // promotion failed - SERVER_NOTICE(_("Failed to promote member.")) + serverNotice(_("Failed to promote member.")); } } @@ -256,9 +256,8 @@ void GuildHandler::handleMessage(MessageIn &msg) Channel *channel = channelManager->findByName(guild->getName()); channelManager->removeChannel(channel); local_player->removeGuild(guildId); - SERVER_NOTICE(strprintf( - _("Player %s kicked you out of guild %s"), - player.c_str(), guild->getName().c_str())); + serverNotice(strprintf(_("Player %s kicked you out of guild %s."), + player.c_str(), guild->getName().c_str())); } } break; } diff --git a/src/net/manaserv/partyhandler.cpp b/src/net/manaserv/partyhandler.cpp index 8f3618b5..e2a021cd 100644 --- a/src/net/manaserv/partyhandler.cpp +++ b/src/net/manaserv/partyhandler.cpp @@ -72,9 +72,9 @@ void PartyHandler::handleMessage(MessageIn &msg) case GPMSG_PARTY_INVITE_ERROR: { std::string name = msg.readString(); - SERVER_NOTICE(strprintf(_("Party invite failed, because no player " - "called %s is within the visual range."), - name.c_str())); + serverNotice(strprintf(_("Party invite failed, because no player " + "called %s is within the visual range."), + name.c_str())); } break; case CPMSG_PARTY_INVITED: @@ -95,12 +95,12 @@ void PartyHandler::handleMessage(MessageIn &msg) } break; case ERRMSG_TIME_OUT: - SERVER_NOTICE(_("Joining party failed, because the " - "invitation has timed out on the server.")); + serverNotice(_("Joining party failed, because the " + "invitation has timed out on the server.")); break; case ERRMSG_FAILURE: - SERVER_NOTICE(_("Joining party failed, because the " - "inviter has left the game.")); + serverNotice(_("Joining party failed, because the " + "inviter has left the game.")); break; default: logger->log("Unknown CPMSG_PARTY_INVITE_ANSWER_RESPONSE."); @@ -129,7 +129,7 @@ void PartyHandler::handleMessage(MessageIn &msg) notice = strprintf(_("%s joined the party on invitation from %s."), name.c_str(), inviter.c_str()); - SERVER_NOTICE(notice); + serverNotice(notice); if (name == local_player->getName()) local_player->setParty(mParty); @@ -148,17 +148,17 @@ void PartyHandler::handleMessage(MessageIn &msg) switch (msg.readInt8()) { case ERRMSG_OK: - SERVER_NOTICE(strprintf(_("%s rejected your invite."), - name.c_str())); + serverNotice(strprintf(_("%s rejected your invite."), + name.c_str())); break; case ERRMSG_LIMIT_REACHED: - SERVER_NOTICE(_("Party invitation rejected by server, " - "because of too many invitations in a " - "short time.")); + serverNotice(_("Party invitation rejected by server, " + "because of too many invitations in a " + "short time.")); break; case ERRMSG_FAILURE: - SERVER_NOTICE(strprintf(_("%s is already in a party."), - name.c_str())); + serverNotice(strprintf(_("%s is already in a party."), + name.c_str())); break; default: logger->log("Unknown CPMSG_PARTY_REJECTED."); diff --git a/src/net/manaserv/tradehandler.cpp b/src/net/manaserv/tradehandler.cpp index 9537909c..d6c411ee 100644 --- a/src/net/manaserv/tradehandler.cpp +++ b/src/net/manaserv/tradehandler.cpp @@ -92,9 +92,9 @@ void TradeHandler::setAcceptTradeRequests(bool acceptTradeRequests) { mAcceptTradeRequests = acceptTradeRequests; if (mAcceptTradeRequests) - SERVER_NOTICE(_("Accepting incoming trade requests.")) + serverNotice(_("Accepting incoming trade requests.")); else - SERVER_NOTICE(_("Ignoring incoming trade requests.")) + serverNotice(_("Ignoring incoming trade requests.")); } void TradeHandler::handleMessage(MessageIn &msg) @@ -145,14 +145,14 @@ void TradeHandler::handleMessage(MessageIn &msg) break; case GPMSG_TRADE_CANCEL: - SERVER_NOTICE(_("Trade canceled.")) + serverNotice(_("Trade canceled.")); tradeWindow->setVisible(false); tradeWindow->reset(); mTrading = false; break; case GPMSG_TRADE_COMPLETE: - SERVER_NOTICE(_("Trade completed.")) + serverNotice(_("Trade completed.")); tradeWindow->setVisible(false); tradeWindow->reset(); mTrading = false; diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp index 70e732be..c60050bd 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -60,9 +60,9 @@ void AdminHandler::handleMessage(MessageIn &msg) case SMSG_ADMIN_KICK_ACK: id = msg.readInt32(); if (id == 0) - SERVER_NOTICE(_("Kick failed!")) + serverNotice(_("Kick failed!")); else - SERVER_NOTICE(_("Kick succeeded!")) + serverNotice(_("Kick succeeded!")); break; case SMSG_BEING_IP_RESPONSE: id = msg.readInt32(); diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp index 00a36f15..1fdf1ffe 100644 --- a/src/net/tmwa/buysellhandler.cpp +++ b/src/net/tmwa/buysellhandler.cpp @@ -105,7 +105,7 @@ void BuySellHandler::handleMessage(MessageIn &msg) } else { - SERVER_NOTICE(_("Nothing to sell.")) + serverNotice(_("Nothing to sell.")); } break; @@ -115,13 +115,13 @@ void BuySellHandler::handleMessage(MessageIn &msg) // Reset player money since buy dialog already assumed purchase // would go fine mBuyDialog->setMoney(PlayerInfo::getAttribute(MONEY)); - SERVER_NOTICE(_("Unable to buy.")) + serverNotice(_("Unable to buy.")); } break; case SMSG_NPC_SELL_RESPONSE: if (msg.readInt8() != 0) - SERVER_NOTICE(_("Unable to sell.")) + serverNotice(_("Unable to sell.")); break; } } diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 5d9a0e21..883ae083 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -139,7 +139,7 @@ void ChatHandler::handleMessage(MessageIn &msg) } else { - SERVER_NOTICE(chatMsg) + serverNotice(chatMsg); } break; @@ -253,7 +253,7 @@ void ChatHandler::handleMessage(MessageIn &msg) msg.readInt8(); // message type - SERVER_NOTICE(msg.readString(chatMsgLength)) + serverNotice(msg.readString(chatMsgLength)); break; } @@ -322,43 +322,43 @@ void ChatHandler::privateMessage(const std::string &recipient, void ChatHandler::channelList() { - SERVER_NOTICE(_("Channels are not supported!")) + serverNotice(_("Channels are not supported!")); } void ChatHandler::enterChannel(const std::string &channel, const std::string &password) { - SERVER_NOTICE(_("Channels are not supported!")) + serverNotice(_("Channels are not supported!")); } void ChatHandler::quitChannel(int channelId) { - SERVER_NOTICE(_("Channels are not supported!")) + serverNotice(_("Channels are not supported!")); } void ChatHandler::sendToChannel(int channelId, const std::string &text) { - SERVER_NOTICE(_("Channels are not supported!")) + serverNotice(_("Channels are not supported!")); } void ChatHandler::userList(const std::string &channel) { - SERVER_NOTICE(_("Channels are not supported!")) + serverNotice(_("Channels are not supported!")); } void ChatHandler::setChannelTopic(int channelId, const std::string &text) { - SERVER_NOTICE(_("Channels are not supported!")) + serverNotice(_("Channels are not supported!")); } void ChatHandler::setUserMode(int channelId, const std::string &name, int mode) { - SERVER_NOTICE(_("Channels are not supported!")) + serverNotice(_("Channels are not supported!")); } void ChatHandler::kickUser(int channelId, const std::string &name) { - SERVER_NOTICE(_("Channels are not supported!")) + serverNotice(_("Channels are not supported!")); } void ChatHandler::requestOnlineList() diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index 2b94c3a0..1877f0f1 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -60,7 +60,7 @@ void GuildHandler::handleMessage(MessageIn &msg) void GuildHandler::create(const std::string &name) { - SERVER_NOTICE(_("Guild creation isn't supported.")) + serverNotice(_("Guild creation isn't supported.")); } void GuildHandler::invite(int guildId, const std::string &name) diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 0fd4e933..496ce621 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -274,7 +274,7 @@ void InventoryHandler::handleMessage(MessageIn &msg) if (msg.readInt8() == 0) { - SERVER_NOTICE(_("Failed to use item.")) + serverNotice(_("Failed to use item.")); } else { @@ -386,7 +386,7 @@ void InventoryHandler::handleMessage(MessageIn &msg) flag = msg.readInt8(); if (!flag) - SERVER_NOTICE(_("Unable to equip.")) + serverNotice(_("Unable to equip.")); else mEquips.setEquipment(getSlot(equipType), index); break; @@ -398,7 +398,7 @@ void InventoryHandler::handleMessage(MessageIn &msg) if (!flag) { - SERVER_NOTICE(_("Unable to unequip.")) + serverNotice(_("Unable to unequip.")); } else { diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp index 3b636c71..2b256cd5 100644 --- a/src/net/tmwa/partyhandler.cpp +++ b/src/net/tmwa/partyhandler.cpp @@ -79,9 +79,9 @@ void PartyHandler::handleMessage(MessageIn &msg) { case SMSG_PARTY_CREATE: if (msg.readInt8()) - SERVER_NOTICE(_("Could not create party.")) + serverNotice(_("Could not create party.")); else - SERVER_NOTICE(_("Party successfully created.")) + serverNotice(_("Party successfully created.")); break; case SMSG_PARTY_INFO: { @@ -221,7 +221,7 @@ void PartyHandler::handleMessage(MessageIn &msg) { taParty->removeFromMembers(); taParty->clearMembers(); - SERVER_NOTICE(_("You have left the party.")) + serverNotice(_("You have left the party.")); if (partyTab) { delete partyTab; @@ -325,7 +325,7 @@ void PartyHandler::invite(const std::string &name) } else { - SERVER_NOTICE(_("You can only invite when you are in a party!")) + serverNotice(_("You can only invite when you are in a party!")); } } diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 4f417dc8..e4a1815f 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -318,18 +318,14 @@ void PlayerHandler::handleMessage(MessageIn &msg) { int oldMoney = PlayerInfo::getAttribute(MONEY); int newMoney = msg.readInt32(); - std::string money = Units::formatCurrency( - newMoney - oldMoney); PlayerInfo::setAttribute(MONEY, newMoney); if (newMoney > oldMoney) { + std::string money = Units::formatCurrency(newMoney - oldMoney); if (config.getBoolValue("showpickupchat")) - SERVER_NOTICE(strprintf(_("You picked up %s."), - Units::formatCurrency(newMoney - - oldMoney).c_str())) + serverNotice(strprintf(_("You picked up %s."), money.c_str())); if (config.getBoolValue("showpickupparticle")) - local_player->addMessageToQueue(money, - UserPalette::PICKUP_INFO); + local_player->addMessageToQueue(money, UserPalette::PICKUP_INFO); } } break; @@ -362,9 +358,7 @@ void PlayerHandler::handleMessage(MessageIn &msg) int value = msg.readInt8(); if (ok != 1) - { - SERVER_NOTICE(_("Cannot raise skill!")) - } + serverNotice(_("Cannot raise skill!")); PlayerInfo::setStatBase(type, value); } @@ -502,9 +496,7 @@ void PlayerHandler::handleMessage(MessageIn &msg) switch (type) { case 0: - { - SERVER_NOTICE(_("Equip arrows first.")) - } + serverNotice(_("Equip arrows first.")); break; default: logger->log("0x013b: Unhandled message %i", type); diff --git a/src/net/tmwa/specialhandler.cpp b/src/net/tmwa/specialhandler.cpp index 6a0bef9a..2e22b00a 100644 --- a/src/net/tmwa/specialhandler.cpp +++ b/src/net/tmwa/specialhandler.cpp @@ -202,19 +202,19 @@ void SpecialHandler::handleMessage(MessageIn &msg) { switch (skillId) { - case SKILL_WARP : + case SKILL_WARP: msg = _("Warp failed..."); break; - case SKILL_STEAL : + case SKILL_STEAL: msg = _("Could not steal anything..."); break; - case SKILL_ENVENOM : + case SKILL_ENVENOM: msg = _("Poison had no effect..."); break; } } - SERVER_NOTICE(msg) + serverNotice(msg); break; } } diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index 2441d83a..da82d751 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -123,35 +123,37 @@ void TradeHandler::handleMessage(MessageIn &msg) switch (msg.readInt8()) { case 0: // Too far away - SERVER_NOTICE(_("Trading isn't possible. Trade " - "partner is too far away.")) + serverNotice(_("Trading isn't possible. Trade " + "partner is too far away.")); break; case 1: // Character doesn't exist - SERVER_NOTICE(_("Trading isn't possible. Character " - "doesn't exist.")) + serverNotice(_("Trading isn't possible. Character " + "doesn't exist.")); break; case 2: // Invite request check failed... - SERVER_NOTICE(_("Trade cancelled due to an unknown " - "reason.")) + serverNotice(_("Trade cancelled due to an unknown " + "reason.")); break; case 3: // Trade accepted tradeWindow->reset(); tradeWindow->setCaption(strprintf(_("Trade: You and %s"), - tradePartnerName.c_str())); + tradePartnerName.c_str())); tradeWindow->setVisible(true); break; case 4: // Trade cancelled if (player_relations.hasPermission(tradePartnerName, PlayerRelation::SPEECH_LOG)) - SERVER_NOTICE(strprintf(_("Trade with %s cancelled."), - tradePartnerName.c_str())) + { + serverNotice(strprintf(_("Trade with %s cancelled."), + tradePartnerName.c_str())); + } // otherwise ignore silently tradeWindow->setVisible(false); mTrading = false; break; default: // Shouldn't happen as well, but to be sure - SERVER_NOTICE(_("Unhandled trade cancel packet.")) + serverNotice(_("Unhandled trade cancel packet.")); break; } break; @@ -199,22 +201,22 @@ void TradeHandler::handleMessage(MessageIn &msg) break; case 1: // Add item failed - player overweighted - SERVER_NOTICE(_("Failed adding item. Trade " - "partner is over weighted.")) + serverNotice(_("Failed adding item. " + "Trade partner is over weighted.")); break; case 2: - // Add item failed - player has no free slot - SERVER_NOTICE(_("Failed adding item. Trade " - "partner has no free slot.")) - break; + // Add item failed - player has no free slot + serverNotice(_("Failed adding item. " + "Trade partner has no free slot.")); + break; case 3: - // Add item failed - non tradable item - SERVER_NOTICE(_("Failed adding item. You " - "cant trade this item.")) - break; + // Add item failed - non tradable item + serverNotice(_("Failed adding item. " + "You can't trade this item.")); + break; default: - SERVER_NOTICE(_("Failed adding item for " - "unknown reason.")) + serverNotice(_("Failed adding item for unknown " + "reason.")); break; } } @@ -226,14 +228,14 @@ void TradeHandler::handleMessage(MessageIn &msg) break; case SMSG_TRADE_CANCEL: - SERVER_NOTICE(_("Trade canceled.")) + serverNotice(_("Trade canceled.")); tradeWindow->setVisible(false); tradeWindow->reset(); mTrading = false; break; case SMSG_TRADE_COMPLETE: - SERVER_NOTICE(_("Trade completed.")) + serverNotice(_("Trade completed.")); tradeWindow->setVisible(false); tradeWindow->reset(); mTrading = false; diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index 004e2f66..e4f18c12 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -44,7 +44,7 @@ void StatusEffect::playSFX() void StatusEffect::deliverMessage() { if (!mMessage.empty()) - SERVER_NOTICE(mMessage) + serverNotice(mMessage); } Particle *StatusEffect::getParticle() |