diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-12-17 20:23:33 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-01-04 21:41:25 +0100 |
commit | ad276ae0d4679aee9d7e6082fa602b49c6fd940a (patch) | |
tree | df3ff4eb6a315faaf722815c4af1e6398a40e81f /src/gui | |
parent | 33130dd288f5842f0edde0fff8618cdfe3afc856 (diff) | |
download | mana-ad276ae0d4679aee9d7e6082fa602b49c6fd940a.tar.gz mana-ad276ae0d4679aee9d7e6082fa602b49c6fd940a.tar.bz2 mana-ad276ae0d4679aee9d7e6082fa602b49c6fd940a.tar.xz mana-ad276ae0d4679aee9d7e6082fa602b49c6fd940a.zip |
Code reformatting
Mainly making sure 'const std::string &' is used everywhere instead of
'std::string const &'. The former has always been the preferred order in
this project.
(cherry picked from mainline)
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/chat.cpp | 37 | ||||
-rw-r--r-- | src/gui/chat.h | 21 | ||||
-rw-r--r-- | src/gui/window.h | 9 |
3 files changed, 23 insertions, 44 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index edde42d0..aa24ba7f 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -91,8 +91,7 @@ void ChatWindow::widgetResized(const gcn::Event &event) mChatInput->getHeight() - 5); } -void -ChatWindow::chatLog(std::string line, int own) +void ChatWindow::chatLog(std::string line, int own) { // Trim whitespace trim(line); @@ -182,14 +181,12 @@ ChatWindow::chatLog(std::string line, int own) } } -void -ChatWindow::chatLog(CHATSKILL act) +void ChatWindow::chatLog(CHATSKILL act) { chatLog(const_msg(act), BY_SERVER); } -void -ChatWindow::action(const gcn::ActionEvent &event) +void ChatWindow::action(const gcn::ActionEvent &event) { if (event.getId() == "chatinput") { @@ -222,8 +219,7 @@ ChatWindow::action(const gcn::ActionEvent &event) } } -void -ChatWindow::requestChatFocus() +void ChatWindow::requestChatFocus() { // Make sure chatWindow is visible if (!isVisible()) @@ -243,14 +239,13 @@ ChatWindow::requestChatFocus() mChatInput->requestFocus(); } -bool -ChatWindow::isInputFocused() +bool ChatWindow::isInputFocused() { return mChatInput->isFocused(); } -void -ChatWindow::whisper(const std::string &nick, std::string msg, int prefixlen) +void ChatWindow::whisper(const std::string &nick, std::string msg, + int prefixlen) { std::string recvnick = ""; msg.erase(0, prefixlen + 1); @@ -281,8 +276,7 @@ ChatWindow::whisper(const std::string &nick, std::string msg, int prefixlen) chatLog("Whispering to " + recvnick + " : " + msg, BY_PLAYER); } -void -ChatWindow::chatSend(const std::string &nick, std::string msg) +void ChatWindow::chatSend(const std::string &nick, std::string msg) { /* Some messages are managed client side, while others * require server handling by proper packet. Probably @@ -354,8 +348,7 @@ ChatWindow::chatSend(const std::string &nick, std::string msg) } } -std::string -ChatWindow::const_msg(CHATSKILL act) +std::string ChatWindow::const_msg(CHATSKILL act) { std::string msg; if (act.success == SKILL_FAILED && act.skill == SKILL_BASIC) { @@ -432,8 +425,7 @@ ChatWindow::const_msg(CHATSKILL act) return msg; } -void -ChatWindow::scroll(int amount) +void ChatWindow::scroll(int amount) { if (!isVisible()) return; @@ -445,8 +437,7 @@ ChatWindow::scroll(int amount) mTextOutput->showPart(scr); } -void -ChatWindow::keyPressed(gcn::KeyEvent &event) +void ChatWindow::keyPressed(gcn::KeyEvent &event) { if (event.getKey().getValue() == gcn::Key::DOWN && mCurHist != mHistory.end()) @@ -471,15 +462,13 @@ ChatWindow::keyPressed(gcn::KeyEvent &event) } } -void -ChatWindow::setInputText(std::string input_str) +void ChatWindow::setInputText(std::string input_str) { mChatInput->setText(input_str + " "); requestChatFocus(); } -void -ChatWindow::setVisible(bool isVisible) +void ChatWindow::setVisible(bool isVisible) { Window::setVisible(isVisible); diff --git a/src/gui/chat.h b/src/gui/chat.h index 09c3712b..dc0d002d 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -183,20 +183,16 @@ class ChatWindow : public Window, public gcn::ActionListener, * // for simple message by a user /- message * chatlog.chat_send("Zaeiru", "Hello to all users on the screen!"); */ - void - chatSend(const std::string &nick, std::string msg); + void chatSend(const std::string &nick, std::string msg); /** Called when key is pressed */ - void - keyPressed(gcn::KeyEvent &event); + void keyPressed(gcn::KeyEvent &event); /** Called to set current text */ - void - setInputText(std::string input_str); + void setInputText(std::string input_str); /** Override to reset mTmpVisible */ - void - setVisible(bool visible); + void setVisible(bool visible); /** * Scrolls the chat window @@ -205,8 +201,7 @@ class ChatWindow : public Window, public gcn::ActionListener, * up, positive numbers scroll down. The absolute amount indicates the * amount of 1/8ths of chat window real estate that should be scrolled. */ - void - scroll(int amount); + void scroll(int amount); /** * help implements the /help command @@ -214,15 +209,13 @@ class ChatWindow : public Window, public gcn::ActionListener, * @param msg1 is the command that the player needs help on * @param msg2 is the sub-command relating to the command */ - void - help(const std::string &msg1, const std::string &msg2); + void help(const std::string &msg1, const std::string &msg2); private: Network *mNetwork; bool mTmpVisible; - void - whisper(const std::string &nick, std::string msg, int prefixlen); + void whisper(const std::string &nick, std::string msg, int prefixlen); /** One item in the chat log */ struct CHATLOG diff --git a/src/gui/window.h b/src/gui/window.h index 984c6f06..d40e8c91 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -163,8 +163,7 @@ class Window : public gcn::Window, gcn::WidgetListener * * @return The parent window or <code>NULL</code> if there is none. */ - Window* - getParentWindow() { return mParent; } + Window *getParentWindow() { return mParent; } /** * Schedule this window for deletion. It will be deleted at the start @@ -204,14 +203,12 @@ class Window : public gcn::Window, gcn::WidgetListener /** * Sets the name of the window. This is not the window title. */ - void - setWindowName(const std::string &name) { mWindowName = name; } + void setWindowName(const std::string &name) { mWindowName = name; } /** * Returns the name of the window. This is not the window title. */ - const std::string& - getWindowName() { return mWindowName; } + const std::string &getWindowName() { return mWindowName; } /** * Reads the position (and the size for resizable windows) in the |