diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-04-05 15:34:11 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-04-05 16:25:18 +0300 |
commit | 08d5f2d6f3eeded6d7a2e1adcf94e850098aa85f (patch) | |
tree | 7cd9be72ab884387173b2aaaa6421ebba7be1ed4 | |
parent | 05a196194b8270c1ae2e63f8ae31f8a492022388 (diff) | |
download | mv-08d5f2d6f3eeded6d7a2e1adcf94e850098aa85f.tar.gz mv-08d5f2d6f3eeded6d7a2e1adcf94e850098aa85f.tar.bz2 mv-08d5f2d6f3eeded6d7a2e1adcf94e850098aa85f.tar.xz mv-08d5f2d6f3eeded6d7a2e1adcf94e850098aa85f.zip |
On room creation show room name in general tab caption.
Not allow move if in room.
-rw-r--r-- | src/being/playerinfo.cpp | 16 | ||||
-rw-r--r-- | src/being/playerinfo.h | 6 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 17 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.h | 5 | ||||
-rw-r--r-- | src/input/inputcondition.h | 3 | ||||
-rw-r--r-- | src/input/inputmanager.cpp | 2 | ||||
-rw-r--r-- | src/net/eathena/chathandler.cpp | 15 |
7 files changed, 53 insertions, 11 deletions
diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp index cfeb56a28..687ab5382 100644 --- a/src/being/playerinfo.cpp +++ b/src/being/playerinfo.cpp @@ -60,6 +60,7 @@ Inventory *mCartInventory = nullptr; MercenaryInfo *mMercenary = nullptr; HomunculusInfo *mHomunculus = nullptr; PetInfo *mPet = nullptr; +std::string mRoomName; #endif Equipment *mEquipment = nullptr; int mPetBeingId = 0; @@ -575,6 +576,21 @@ void updateAttackAi(const int targetId, const bool keep) if (mHomunculus) homunculusHandler->attack(targetId, keep); } + +std::string getRoomName() +{ + return mRoomName; +} + +void setRoomName(const std::string &name) +{ + mRoomName = name; +} + +bool isInRoom() +{ + return !mRoomName.empty(); +} #endif void setGuildPositionFlags(const GuildPositionFlags::Type pos) diff --git a/src/being/playerinfo.h b/src/being/playerinfo.h index 20da29e44..c0932cfb8 100644 --- a/src/being/playerinfo.h +++ b/src/being/playerinfo.h @@ -267,6 +267,12 @@ namespace PlayerInfo void updateMoveAI(); void updateAttackAi(const int targetId, const bool keep); + + std::string getRoomName(); + + void setRoomName(const std::string &name); + + bool isInRoom(); #endif void setGuildPositionFlags(const GuildPositionFlags::Type pos); diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 2c1f580ad..853d2a51c 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1219,12 +1219,6 @@ ChatTab *ChatWindow::addSpecialChannelTab(const std::string &name, return ret; } -ChatTab *ChatWindow::addChatRoomTab(const std::string &name, - const bool switchTo) -{ - return nullptr; -} - ChatTab *ChatWindow::addChannelTab(const std::string &name, const bool switchTo) { @@ -2132,3 +2126,14 @@ void ChatWindow::debugMessage(const std::string &msg) if (debugChatTab) debugChatTab->chatLog(msg, ChatMsgType::BY_SERVER); } + +void ChatWindow::joinRoom(const bool isJoin) +{ + Tab *const tab = mChatTabs->getTabByIndex(0); + std::string name; + if (isJoin) + name = PlayerInfo::getRoomName(); + else + name = _("General"); + tab->setCaption(name); +} diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h index 33d6a89bd..479d7db6a 100644 --- a/src/gui/windows/chatwindow.h +++ b/src/gui/windows/chatwindow.h @@ -199,9 +199,6 @@ class ChatWindow final : public Window, WhisperTab *getWhisperTab(const std::string &nick) const A_WARN_UNUSED; - ChatTab *addChatRoomTab(const std::string &name, - const bool switchTo = false); - ChatTab *addChannelTab(const std::string &name, const bool switchTo = false); @@ -212,6 +209,8 @@ class ChatWindow final : public Window, const bool switchTo, const bool join) A_WARN_UNUSED; + void joinRoom(const bool isJoin); + void removeAllWhispers(); void removeAllChannels(); diff --git a/src/input/inputcondition.h b/src/input/inputcondition.h index de479b328..5687b6f6a 100644 --- a/src/input/inputcondition.h +++ b/src/input/inputcondition.h @@ -45,11 +45,12 @@ namespace InputCondition // dialogs what prevent moving ALIVE = 32768, // player alive NOVENDING = 65536, // vending disabled + NOROOM = 131072, // not joined room SHORTCUT = 2 + 4 + 16 + 512 + 2048, // flags for shortcut keys SHORTCUT0 = 2 + 4 + 16 + 512, // flags for shortcut keys GAME = 2 + 4 + 8 + 16 + 64 + 2048, // main game key GAME2 = 2 + 8 + 16 + 64 + 2048, - ARROWKEYS = 2 + 4 + 8 + 16 + 64 + 2048 + 4096 + 16384 + 65536 + ARROWKEYS = 2 + 4 + 8 + 16 + 64 + 2048 + 4096 + 16384 + 65536 + 131072 }; } // namespace InputCondition diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index 11ff7f291..c60056c3e 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -693,6 +693,8 @@ void InputManager::updateConditionMask() if (!PlayerInfo::isVending()) mMask |= InputCondition::NOVENDING; + if (!PlayerInfo::isInRoom()) + mMask |= InputCondition::NOROOM; if (!settings.awayMode) mMask |= InputCondition::NOAWAY; diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index 1dfeb7ccb..eb7dfe375 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -26,6 +26,7 @@ #include "notifymanager.h" #include "being/localplayer.h" +#include "being/playerinfo.h" #include "being/playerrelations.h" #include "gui/chatconsts.h" @@ -852,8 +853,19 @@ void ChatHandler::processChatRoomCreateAck(Net::MessageIn &msg) switch(result) { case 0: - chatWindow->addChatRoomTab(mChatRoom, true); + { + PlayerInfo::setRoomName(mChatRoom); + chatWindow->joinRoom(true); + ChatObject *const obj = new ChatObject; + obj->ownerId = localPlayer->getId(); + obj->chatId = 0; + obj->maxUsers = 1000; + obj->currentUsers = 1; + obj->type = 1; + obj->title = mChatRoom; + localPlayer->setChat(obj); break; + } case 1: NotifyManager::notify(NotifyTypes::ROOM_LIMIT_EXCEEDED); break; @@ -864,6 +876,7 @@ void ChatHandler::processChatRoomCreateAck(Net::MessageIn &msg) UNIMPLIMENTEDPACKET; break; } + mChatRoom.clear(); } void ChatHandler::processChatRoomDestroy(Net::MessageIn &msg) |