diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/client.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 40 | ||||
-rw-r--r-- | src/net/tmwa/chathandler.cpp | 34 |
4 files changed, 66 insertions, 16 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4b2e0381..9e4d43e3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -32,8 +32,8 @@ ENDIF() IF (CMAKE_BUILD_TYPE) STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) - IF((CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) OR - (CMAKE_BUILD_TYPE_TOLOWER MATCHES relwithdebinfo)) + IF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug OR + CMAKE_BUILD_TYPE_TOLOWER MATCHES relwithdebinfo) SET(FLAGS "${FLAGS} -DDEBUG") ENDIF() ENDIF() diff --git a/src/client.cpp b/src/client.cpp index 2ebdb247..23f7a76d 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1052,13 +1052,13 @@ void Client::initHomeDir() if (mConfigDir.empty()){ #ifdef __APPLE__ - mConfigDir = mLocalDataDir; + mConfigDir = mLocalDataDir + "/" + branding.getValue("appShort", "mana"); #elif defined WIN32 mConfigDir = getSpecialFolderLocation(CSIDL_APPDATA); if (mConfigDir.empty()) mConfigDir = mLocalDataDir; else - mConfigDir += "/mana/" + branding.getValue("appName", "Mana"); + mConfigDir += "/mana/" + branding.getValue("appShort", "Mana"); #else mConfigDir = std::string(PHYSFS_getUserDir()) + "/.config/mana/" + branding.getValue("appShort", "mana"); diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 5163fc45..7648eb24 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -255,14 +255,46 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event) if (mSelectedIndex == index) { - mSelectionStatus = SEL_DESELECTING; + if(event.getClickCount() == 2) + { + if (item->isEquipment()) + { + if (item->isEquipped()) + Net::getInventoryHandler()->unequipItem(item); + else + Net::getInventoryHandler()->equipItem(item); + } + else + Net::getInventoryHandler()->useItem(item); + + } + else + { + mSelectionStatus = SEL_DESELECTING; + } } else if (item && item->getId()) { - setSelectedIndex(index); - mSelectionStatus = SEL_SELECTING; + if(event.getClickCount() == 2) + { + if (item->isEquipment()) + { + if (item->isEquipped()) + Net::getInventoryHandler()->unequipItem(item); + else + Net::getInventoryHandler()->equipItem(item); + } + else + Net::getInventoryHandler()->useItem(item); - itemShortcut->setItemSelected(item->getId()); + } + else + { + setSelectedIndex(index); + mSelectionStatus = SEL_SELECTING; + + itemShortcut->setItemSelected(item->getId()); + } if (item->isEquipment()) outfitWindow->setItemSelected(item->getId()); } diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 68c6dece..55259624 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -129,7 +129,8 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) break; // Received speech from being - case SMSG_BEING_CHAT: { + case SMSG_BEING_CHAT: + { chatMsgLength = msg.readInt16() - 8; int beingId = msg.readInt32(); being = actorSpriteManager->findBeing(beingId); @@ -141,8 +142,23 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) std::string::size_type pos = chatMsg.find(" : ", 0); std::string sender_name = ((pos == std::string::npos) - ? "" - : chatMsg.substr(0, pos)); + ? "" : chatMsg.substr(0, pos)); + + if (sender_name != being->getName() + && being->getType() == Being::PLAYER) + { + if (!being->getName().empty()) + sender_name = being->getName(); + } + else + { + chatMsg.erase(0, pos + 3); + } + + trim(chatMsg); + + std::string reducedMessage = chatMsg; + chatMsg = removeColors(sender_name) + " : " + reducedMessage; // We use getIgnorePlayer instead of ignoringPlayer here because ignorePlayer' side // effects are triggered right below for Being::IGNORE_SPEECH_FLOAT. @@ -150,21 +166,23 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) { Mana::Event event("Being"); event.setString("message", chatMsg); + event.setString("text", reducedMessage); event.setString("nick", sender_name); event.setInt("beingId", beingId); Mana::EventManager::trigger("Chat", event); } - chatMsg.erase(0, pos + 3); - trim(chatMsg); - - if (player_relations.hasPermission(sender_name, PlayerRelation::SPEECH_FLOAT)) + if (player_relations.hasPermission(sender_name, + PlayerRelation::SPEECH_FLOAT)) + { being->setSpeech(chatMsg, SPEECH_TIME); + } break; } case SMSG_PLAYER_CHAT: - case SMSG_GM_CHAT: { + case SMSG_GM_CHAT: + { chatMsgLength = msg.readInt16() - 4; if (chatMsgLength <= 0) |