diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-02-21 23:23:24 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-02-21 23:23:24 +0100 |
commit | 458401d64fbe500295cc8e903702638fde0ab934 (patch) | |
tree | 3d1c606f118dba2b4f38fa80614bf30fdc12277c /src | |
parent | e6cd1f9cb82811d05e08aef0493eeba9cc41a95d (diff) | |
parent | d4bb2d1d0e82ca9d046f9b2346a7893ca11e8d9c (diff) | |
download | mana-458401d64fbe500295cc8e903702638fde0ab934.tar.gz mana-458401d64fbe500295cc8e903702638fde0ab934.tar.bz2 mana-458401d64fbe500295cc8e903702638fde0ab934.tar.xz mana-458401d64fbe500295cc8e903702638fde0ab934.zip |
Merge branch '0.5'
Translation file updates ignored.
Conflicts:
src/client.cpp
src/commandhandler.cpp
src/gui/popupmenu.cpp
src/localplayer.cpp
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 13 | ||||
-rw-r--r-- | src/commandhandler.cpp | 16 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 10 | ||||
-rw-r--r-- | src/localplayer.cpp | 31 | ||||
-rw-r--r-- | src/localplayer.h | 18 | ||||
-rw-r--r-- | src/net/tmwa/inventoryhandler.cpp | 7 | ||||
-rw-r--r-- | src/resources/mapreader.cpp | 6 |
7 files changed, 79 insertions, 22 deletions
diff --git a/src/client.cpp b/src/client.cpp index 71e2885d..7dbbdc88 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1189,22 +1189,23 @@ void Client::initHomeDir() mConfigDir = mOptions.configDir; - if (mConfigDir.empty()){ + if (mConfigDir.empty()) + { + const std::string app = branding.getValue("appShort", "manasource"); #ifdef __APPLE__ - mConfigDir = mLocalDataDir + "/" + branding.getValue("appShort", "mana"); + mConfigDir = mLocalDataDir + "/" + app; #elif defined __HAIKU__ mConfigDir = std::string(PHYSFS_getUserDir()) + "/config/settings/Mana" + - branding.getValue("appName", "Mana"); + branding.getValue("appName", "manasource"); #elif defined WIN32 mConfigDir = getSpecialFolderLocation(CSIDL_APPDATA); if (mConfigDir.empty()) mConfigDir = mLocalDataDir; else - mConfigDir += "/mana/" + branding.getValue("appShort", "Mana"); + mConfigDir += "/mana/" + app; #else - mConfigDir = std::string(PHYSFS_getUserDir()) + - "/.config/mana/" + branding.getValue("appShort", "mana"); + mConfigDir = std::string(PHYSFS_getUserDir()) + "/.config/mana/" + app; #endif } diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index dcaf6f0a..f5864a24 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -49,6 +49,7 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab) std::string type(command, 0, pos); std::string args(command, pos == std::string::npos ? command.size() : pos + 1); + trim(args); if (type == "help") // Do help before tabs so they can't override it { @@ -401,8 +402,21 @@ void CommandHandler::handleMsg(const std::string &args, ChatTab *tab) void CommandHandler::handleQuery(const std::string &args, ChatTab *tab) { - if (chatWindow->addWhisperTab(args, true)) + if (args.empty()) + { + tab->chatLog(_("No <nick> was given."), BY_SERVER); + return; + } + + if (args.length() > 1 && args[0] == '\"' && args[args.length() - 1] == '\"') + { + if (chatWindow->addWhisperTab(args.substr(1, args.length() - 2), true)) + return; + } + else if (chatWindow->addWhisperTab(args, true)) + { return; + } tab->chatLog(strprintf(_("Cannot create a whisper tab for nick \"%s\"! " "It either already exists, or is you."), args.c_str()), BY_SERVER); diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 8ff638c2..f5259c35 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -353,6 +353,11 @@ void PopupMenu::showPopup(Window *parent, int x, int y, Item *item, if (isInventory) { + if (PlayerInfo::getStorageCount() > 0) + { + mBrowserBox->addRow(strprintf("@@store|%s@@", _("Store"))); + } + if (item->getInfo().getEquippable()) { if (item->isEquipped()) @@ -372,11 +377,6 @@ void PopupMenu::showPopup(Window *parent, int x, int y, Item *item, { mBrowserBox->addRow(strprintf("@@split|%s@@", _("Split"))); } - - if (PlayerInfo::getStorageCount() > 0) - { - mBrowserBox->addRow(strprintf("@@store|%s@@", _("Store"))); - } } // Assume in storage for now // TODO: make this whole system more flexible, if needed diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 81fb1cee..3e59e794 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -984,13 +984,32 @@ void LocalPlayer::stopAttack() mLastTarget = -1; } -void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount) +void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount, + unsigned char fail) { - if (!amount) + if (fail) { + const char* msg; + switch (fail) + { + case PICKUP_BAD_ITEM: + msg = N_("Tried to pick up nonexistent item."); break; + case PICKUP_TOO_HEAVY: msg = N_("Item is too heavy."); break; + case PICKUP_TOO_FAR: msg = N_("Item is too far away"); break; + case PICKUP_INV_FULL: msg = N_("Inventory is full."); break; + case PICKUP_STACK_FULL: msg = N_("Stack is too big."); break; + case PICKUP_DROP_STEAL: + msg = N_("Item belongs to someone else."); break; + default: msg = N_("Unknown problem picking up item."); break; + } if (config.getValue("showpickupchat", 1)) { - SERVER_NOTICE(_("Unable to pick up item.")) + SERVER_NOTICE(_(msg)) + } + if (mMap && config.getValue("showpickupparticle", 0)) + { + // Show pickup notification + addMessageToQueue(_(msg), UserPalette::PICKUP_INFO); } } else @@ -1007,7 +1026,11 @@ void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount) if (mMap && config.getValue("showpickupparticle", 0)) { // Show pickup notification - addMessageToQueue(itemInfo.getName(), UserPalette::PICKUP_INFO); + std::string msg = ""; + if (amount > 1) + msg = strprintf("%i ", amount); + msg += itemInfo.getName(); + addMessageToQueue(msg, UserPalette::PICKUP_INFO); } } } diff --git a/src/localplayer.h b/src/localplayer.h index a5328182..b1a41697 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -45,6 +45,21 @@ class AwayListener : public gcn::ActionListener }; /** + * Reasons an item can fail to be picked up. + */ +enum +{ + PICKUP_OKAY, + PICKUP_BAD_ITEM, + PICKUP_TOO_HEAVY, + PICKUP_TOO_FAR, + PICKUP_INV_FULL, + PICKUP_STACK_FULL, + PICKUP_DROP_STEAL, +}; + + +/** * The local player character. */ class LocalPlayer : public Being @@ -168,7 +183,8 @@ class LocalPlayer : public Being /** * Shows item pickup notifications. */ - void pickedUp(const ItemInfo &itemInfo, int amount); + void pickedUp(const ItemInfo &itemInfo, int amount, + unsigned char fail); void setShowIp(bool show) { mShowIp = show; } diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 4aedd9f2..1d99eca4 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -226,13 +226,14 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) { const ItemInfo &itemInfo = itemDb->get(itemId); - if (msg.readInt8() > 0) + unsigned char err = msg.readInt8(); + if (err) { - player_node->pickedUp(itemInfo, 0); + player_node->pickedUp(itemInfo, 0, err); } else { - player_node->pickedUp(itemInfo, amount); + player_node->pickedUp(itemInfo, amount, PICKUP_OKAY); Item *item = inventory->getItem(index); diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 14021406..1dd12723 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -275,9 +275,11 @@ void MapReader::readLayer(xmlNodePtr node, Map *map) if (encoding == "base64") { - if (!compression.empty() && compression != "gzip" && compression != "zlib") + if (!compression.empty() && compression != "gzip" + && compression != "zlib") { - logger->log("Warning: only gzip layer compression supported!"); + logger->log("Warning: only gzip or zlib layer " + "compression supported!"); return; } |