diff options
-rw-r--r-- | packaging/windows/package-helpers | 10 | ||||
-rw-r--r-- | packaging/windows/toolchain.cmake.example | 5 | ||||
-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 |
9 files changed, 93 insertions, 23 deletions
diff --git a/packaging/windows/package-helpers b/packaging/windows/package-helpers index de953149..a451f573 100644 --- a/packaging/windows/package-helpers +++ b/packaging/windows/package-helpers @@ -22,6 +22,14 @@ # - MANALIBS -- the directory containing the dlls copied into the # windows installer. Default is using the last directory in the # toolchains SET(CMAKE_FIND_ROOT_PATH +# +# Also, please note that the untgz nsis Plugins is needed to create +# an installer. +# The default nsis Plugins folder in most Linux distros is: +# in /usr/share/nsis/Plugins/ +# +# The default folder to use the toolchain in most Linux distros is: +# /usr/i586msvc-mingw32/ # MANA_BASE should point to the top directory of the source tree if [ -z "$MANA_BASE" ]; then @@ -110,4 +118,4 @@ mana-build-win32-installer(){ mana-nuke-cmake-stuff(){ find $MANA_BASE -name CMakeFiles -type d -exec rm -Rf '{}' \; 2>/dev/null find $MANA_BASE -name CMakeCache.txt -type f -exec rm '{}' \; 2>/dev/null -}
\ No newline at end of file +} diff --git a/packaging/windows/toolchain.cmake.example b/packaging/windows/toolchain.cmake.example index 0e99bd37..707246d0 100644 --- a/packaging/windows/toolchain.cmake.example +++ b/packaging/windows/toolchain.cmake.example @@ -9,9 +9,14 @@ ENDIF() SET(CMAKE_C_COMPILER ${TOOLCHAIN}gcc) SET(CMAKE_CXX_COMPILER ${TOOLCHAIN}g++) +# which rc compiler to use +SET(CMAKE_RC_COMPILER ${TOOLCHAIN}windres) + # here is the target environment located # the directories specified here should contain two directories, # 'include' for the headers, 'lib' for dlls and .a files +# For instance, the mingw32 headers can be installed at: +# /usr/i586-mingw32msvc/ SET(CMAKE_FIND_ROOT_PATH /build/mingw32 /build/tmw-libs ) # adjust the default behaviour of the FIND_XXX() commands: 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; } |