diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-23 22:02:17 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-23 22:02:17 +0200 |
commit | 768f3d93019b262ce6aa9f913aed0f45d5e4c929 (patch) | |
tree | 0eee9d83a498b1f18def288848f54551881b778d /src/gui | |
parent | cc2cd67e1c3c3f95485ae4477b6a2f0d255e9163 (diff) | |
parent | fbbd4c406bf95ef8591f7368baacfad6f4d3f30f (diff) | |
download | Mana-768f3d93019b262ce6aa9f913aed0f45d5e4c929.tar.gz Mana-768f3d93019b262ce6aa9f913aed0f45d5e4c929.tar.bz2 Mana-768f3d93019b262ce6aa9f913aed0f45d5e4c929.tar.xz Mana-768f3d93019b262ce6aa9f913aed0f45d5e4c929.zip |
Merge branch '0.0.29'
Conflicts:
src/gui/widgets/chattab.cpp
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/inventorywindow.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/chattab.cpp | 22 |
2 files changed, 11 insertions, 16 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index c44ae9e7..06e43eac 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -245,11 +245,12 @@ void InventoryWindow::keyReleased(gcn::KeyEvent &event) void InventoryWindow::valueChanged(const gcn::SelectionEvent &event) { - if (mSplit) + if (mSplit && Net::getInventoryHandler()->canSplit(mItems->getSelectedItem())) { Item *item = mItems->getSelectedItem(); - ItemAmountWindow::showWindow(ItemAmountWindow::ItemSplit, this, item, + if (item) + ItemAmountWindow::showWindow(ItemAmountWindow::ItemSplit, this, item, (item->getQuantity() - 1)); } } diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 85353bf7..ad0911c9 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -215,7 +215,7 @@ void ChatTab::chatInput(std::string &msg) while (start != std::string::npos && msg[start+1] != '@') { std::string::size_type end = msg.find(']', start); - if (start+1 != end && end != std::string::npos) + if (start + 1 != end && end != std::string::npos) { // Catch multiple embeds and ignore them // so it doesn't crash the client. @@ -227,22 +227,16 @@ void ChatTab::chatInput(std::string &msg) std::string temp = msg.substr(start + 1, end - start - 1); - // Do not parse an empty string (it crashes the client) - if (!temp.empty()) + const ItemInfo itemInfo = ItemDB::get(temp); + if (itemInfo.getId() != 0) { - toLower(trim(temp)); - - const ItemInfo itemInfo = ItemDB::get(temp); - if (itemInfo.getName() != _("Unknown item")) - { - msg.insert(end, "@@"); - msg.insert(start+1, "|"); - msg.insert(start+1, toString(itemInfo.getId())); - msg.insert(start+1, "@@"); - } + msg.insert(end, "@@"); + msg.insert(start + 1, "|"); + msg.insert(start + 1, toString(itemInfo.getId())); + msg.insert(start + 1, "@@"); } } - start = msg.find('[', start + 1); + start = msg.find('[', start + 1); } // Prepare ordinary message |