diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-27 12:35:09 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-27 12:35:09 +0100 |
commit | 05e753294c1a603252d2eed4b1731c3f50543a7e (patch) | |
tree | 82d8c04a55df7a689fd15b69e8e6917c91e165d0 | |
parent | 38674a7732d2224e07e80c0c4224e3468e4ddfb0 (diff) | |
download | mana-client-05e753294c1a603252d2eed4b1731c3f50543a7e.tar.gz mana-client-05e753294c1a603252d2eed4b1731c3f50543a7e.tar.bz2 mana-client-05e753294c1a603252d2eed4b1731c3f50543a7e.tar.xz mana-client-05e753294c1a603252d2eed4b1731c3f50543a7e.zip |
Fixed some compiler warnings
Fixed a faulty == statement that should have been an assignment and a
mismatched 'else' block.
-rw-r--r-- | src/gui/chat.cpp | 47 | ||||
-rw-r--r-- | src/gui/chat.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/whispertab.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/whispertab.h | 11 | ||||
-rw-r--r-- | src/net/ea/chathandler.cpp | 9 |
5 files changed, 36 insertions, 38 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 8baf702e..7861bdb6 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -19,24 +19,25 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <guichan/focushandler.hpp> - #include "chat.h" -#include "chatinput.h" -#include "itemlinkhandler.h" -#include "recorder.h" -#include "scrollarea.h" -#include "sdlinput.h" -#include "widgets/tabbedarea.h" -#include "widgets/whispertab.h" +#include "gui/chatinput.h" +#include "gui/itemlinkhandler.h" +#include "gui/recorder.h" +#include "gui/scrollarea.h" +#include "gui/sdlinput.h" -#include "../beingmanager.h" -#include "../configuration.h" -#include "../localplayer.h" +#include "gui/widgets/tabbedarea.h" +#include "gui/widgets/whispertab.h" -#include "../utils/dtor.h" -#include "../utils/stringutils.h" +#include "beingmanager.h" +#include "configuration.h" +#include "localplayer.h" + +#include "utils/dtor.h" +#include "utils/stringutils.h" + +#include <guichan/focushandler.hpp> #ifdef TMWSERV_SUPPORT ChatWindow::ChatWindow(): @@ -140,20 +141,21 @@ void ChatWindow::logic() Window::logic(); Tab *tab = getFocused(); - if (tab != currentTab) { - currentTab == tab; + if (tab != mCurrentTab) { + mCurrentTab = tab; adjustTabSize(); } } -ChatTab* ChatWindow::getFocused() const +ChatTab *ChatWindow::getFocused() const { return dynamic_cast<ChatTab*>(mChatTabs->getSelectedTab()); } -void ChatWindow::clearTab(ChatTab* tab) +void ChatWindow::clearTab(ChatTab *tab) { - if (tab) tab->clearText(); + if (tab) + tab->clearText(); } void ChatWindow::clearTab() @@ -373,11 +375,8 @@ void ChatWindow::whisper(std::string nick, std::string mes, bool own) toLower(playerName); toLower(tempNick); - if (tempNick.compare(playerName) == 0) - if (own) - ; - else - return; + if (!own && tempNick.compare(playerName) == 0) + return; ChatTab *tab = mWhispers[tempNick]; diff --git a/src/gui/chat.h b/src/gui/chat.h index 736f9284..7c080960 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -213,7 +213,7 @@ class ChatWindow : public Window, /** Tabbed area for holding each channel. */ TabbedArea *mChatTabs; - Tab *currentTab; + Tab *mCurrentTab; typedef std::map<const std::string, ChatTab*> TabMap; /** Manage whisper tabs */ diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp index b67b74f8..ba469c00 100644 --- a/src/gui/widgets/whispertab.cpp +++ b/src/gui/widgets/whispertab.cpp @@ -47,8 +47,9 @@ #include "../../utils/strprintf.h" #include "../../utils/stringutils.h" -WhisperTab::WhisperTab(std::string nick) : ChatTab(nick), - mNick(nick) +WhisperTab::WhisperTab(const std::string &nick) : + ChatTab(nick), + mNick(nick) { } diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h index 059346fa..e3ebf0f3 100644 --- a/src/gui/widgets/whispertab.h +++ b/src/gui/widgets/whispertab.h @@ -27,24 +27,23 @@ class Channel; /** - * A tab for whispers from a single nick. + * A tab for whispers from a single player. */ class WhisperTab : public ChatTab { public: - std::string getNick() { return mNick; } + const std::string &getNick() const { return mNick; } protected: friend class ChatWindow; /** * Constructor. + * + * @param nick the name of the player this tab is whispering to */ - WhisperTab(std::string nick); + WhisperTab(const std::string &nick); - /** - * Destructor. - */ ~WhisperTab(); void sendChat(std::string &msg); diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index 2e7be21f..14432b28 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -35,7 +35,6 @@ #include "utils/gettext.h" #include "utils/stringutils.h" -#include <SDL_types.h> #include <string> extern Being *player_node; @@ -93,10 +92,14 @@ void ChatHandler::handleMessage(MessageIn &msg) chatMsg = msg.readString(chatMsgLength); if (nick != SERVER_NAME) + { if (player_relations.hasPermission(nick, PlayerRelation::WHISPER)) chatWindow->whisper(nick, chatMsg); + } else + { localChatTab->chatLog(chatMsg, BY_SERVER); + } break; @@ -106,9 +109,7 @@ void ChatHandler::handleMessage(MessageIn &msg) being = beingManager->findBeing(msg.readInt32()); if (!being || chatMsgLength <= 0) - { break; - } chatMsg = msg.readString(chatMsgLength); @@ -135,9 +136,7 @@ void ChatHandler::handleMessage(MessageIn &msg) chatMsgLength = msg.readInt16() - 4; if (chatMsgLength <= 0) - { break; - } chatMsg = msg.readString(chatMsgLength); std::string::size_type pos = chatMsg.find(" : ", 0); |