diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-24 21:38:28 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-24 21:38:28 +0200 |
commit | 18b6856aa416473019bc36ead2c0e9cda3719a44 (patch) | |
tree | b08f3ed09378dd288f3e4605ad9160d901640dc4 /src | |
parent | 768f3d93019b262ce6aa9f913aed0f45d5e4c929 (diff) | |
parent | 4e18e7619e9a8c909dea3374a2a7aa39befe0c16 (diff) | |
download | mana-18b6856aa416473019bc36ead2c0e9cda3719a44.tar.gz mana-18b6856aa416473019bc36ead2c0e9cda3719a44.tar.bz2 mana-18b6856aa416473019bc36ead2c0e9cda3719a44.tar.xz mana-18b6856aa416473019bc36ead2c0e9cda3719a44.zip |
Merge branch '0.0.29'
Diffstat (limited to 'src')
-rw-r--r-- | src/commandhandler.cpp | 3 | ||||
-rw-r--r-- | src/gui/chat.cpp | 26 | ||||
-rw-r--r-- | src/gui/chat.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/chattab.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/chattab.h | 2 | ||||
-rw-r--r-- | src/keyboardconfig.cpp | 2 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.cpp | 4 | ||||
-rw-r--r-- | src/resources/itemdb.cpp | 11 |
8 files changed, 36 insertions, 19 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index aaca632a..0af77398 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -340,7 +340,8 @@ void CommandHandler::handleMsg(const std::string &args, ChatTab *tab) tab->chatLog(_("Cannot send empty whispers!"), BY_SERVER); } -void CommandHandler::handleQuery(const std::string &args, ChatTab *tab) { +void CommandHandler::handleQuery(const std::string &args, ChatTab *tab) +{ if (chatWindow->addWhisperTab(args, true)) return; diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 414d1e02..1ce1b77c 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -292,10 +292,12 @@ void ChatWindow::addTab(ChatTab *tab) void ChatWindow::removeWhisper(const std::string &nick) { - mWhispers.erase(nick); + std::string tempNick = nick; + toLower(tempNick); + mWhispers.erase(tempNick); } -void ChatWindow::chatInput(std::string &msg) +void ChatWindow::chatInput(const std::string &msg) { ChatTab *tab = getFocused(); tab->chatInput(msg); @@ -430,7 +432,8 @@ void ChatWindow::setRecordingFile(const std::string &msg) mRecorder->setRecordingFile(msg); } -void ChatWindow::whisper(const std::string &nick, std::string mes, bool own) +void ChatWindow::whisper(const std::string &nick, + const std::string &mes, bool own) { if (mes.empty()) return; @@ -444,12 +447,13 @@ void ChatWindow::whisper(const std::string &nick, std::string mes, bool own) if (tempNick.compare(playerName) == 0) return; - ChatTab *tab = mWhispers[tempNick]; + ChatTab *tab = 0; + TabMap::const_iterator i = mWhispers.find(tempNick); - if (!tab && config.getValue("whispertab", false)) - { + if (i != mWhispers.end()) + tab = i->second; + else if (config.getValue("whispertab", false)) tab = addWhisperTab(nick); - } if (tab) { @@ -468,7 +472,9 @@ void ChatWindow::whisper(const std::string &nick, std::string mes, bool own) nick.c_str(), mes.c_str()), BY_PLAYER); } else + { localChatTab->chatLog(nick + " : " + mes, ACT_WHISPER, false); + } } } @@ -480,10 +486,12 @@ ChatTab *ChatWindow::addWhisperTab(const std::string &nick, bool switchTo) toLower(playerName); toLower(tempNick); - if (mWhispers[tempNick] || tempNick.compare(playerName) == 0) + if (mWhispers.find(tempNick) != mWhispers.end() + || tempNick.compare(playerName) == 0) return NULL; - ChatTab *ret = mWhispers[tempNick] = new WhisperTab(nick); + ChatTab *ret = new WhisperTab(nick); + mWhispers[tempNick] = ret; if (switchTo) mChatTabs->setSelectedTab(ret); diff --git a/src/gui/chat.h b/src/gui/chat.h index c6e8e326..7080392e 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -136,7 +136,7 @@ class ChatWindow : public Window, * * @param msg The message text which is to be sent. */ - void chatInput(std::string &msg); + void chatInput(const std::string &msg); /** Called when key is pressed */ void keyPressed(gcn::KeyEvent &event); @@ -171,7 +171,7 @@ class ChatWindow : public Window, void doPresent(); - void whisper(const std::string &nick, std::string mes, + void whisper(const std::string &nick, const std::string &mes, bool own = false); ChatTab *addWhisperTab(const std::string &nick, bool switchTo = false); diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index ad0911c9..d2fa33b8 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -203,8 +203,9 @@ void ChatTab::chatLog(const std::string &nick, const std::string &msg) false); } -void ChatTab::chatInput(std::string &msg) +void ChatTab::chatInput(const std::string &message) { + std::string msg = message; trim(msg); if (msg.empty()) diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h index dc0d3047..4cb6a58f 100644 --- a/src/gui/widgets/chattab.h +++ b/src/gui/widgets/chattab.h @@ -77,7 +77,7 @@ class ChatTab : public Tab * * @param msg The message text which is to be sent. */ - void chatInput(std::string &msg); + void chatInput(const std::string &msg); /** * Scrolls the chat window diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp index 89b1aaf9..8e021aa6 100644 --- a/src/keyboardconfig.cpp +++ b/src/keyboardconfig.cpp @@ -98,7 +98,7 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = { {"keyChatScrollDown", SDLK_PAGEDOWN, _("Scroll Chat Down")}, {"keyChatPrevTab", SDLK_LEFTBRACKET, _("Previous Chat Tab")}, {"keyChatNextTab", SDLK_RIGHTBRACKET, _("Next Chat Tab")}, - {"keyOK", SDLK_RETURN, _("Select OK")}, + {"keyOK", SDLK_SPACE, _("Select OK")}, {"keyQuit", SDLK_ESCAPE, _("Quit")}, {"keyIgnoreInput1", SDLK_LSUPER, _("Ignore input 1")}, {"keyIgnoreInput2", SDLK_RSUPER, _("Ignore input 2")} diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index e91a1c19..e9c9f91c 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -190,7 +190,9 @@ void InventoryHandler::handleMessage(MessageIn &msg) { const ItemInfo &itemInfo = ItemDB::get(itemId); const std::string amountStr = - (amount > 1) ? toString(amount) : "a"; + // TRANSLATORS: Used as in "You picked up a ...", when + // picking up only one item. + (amount > 1) ? toString(amount) : _("a"); if (config.getValue("showpickupchat", 1)) { diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index 62bf0700..b25f754f 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -96,6 +96,12 @@ static WeaponType weaponTypeFromString(const std::string &name, int id = 0) else return WPNTYPE_NONE; } +static std::string normalized(const std::string &name) +{ + std::string normalized = name; + return toLower(trim(normalized));; +} + void ItemDB::load() { if (mLoaded) @@ -196,8 +202,7 @@ void ItemDB::load() mItemInfos[id] = itemInfo; if (!name.empty()) { - std::string temp = name; - toLower(trim(temp)); + std::string temp = normalized(name); NamedItemInfos::const_iterator itr = mNamedItemInfos.find(temp); if (itr == mNamedItemInfos.end()) @@ -266,7 +271,7 @@ const ItemInfo &ItemDB::get(const std::string &name) { assert(mLoaded); - NamedItemInfos::const_iterator i = mNamedItemInfos.find(name); + NamedItemInfos::const_iterator i = mNamedItemInfos.find(normalized(name)); if (i == mNamedItemInfos.end()) { |