diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-10-05 20:59:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-10-05 21:02:42 +0300 |
commit | 95532bf76d70bafbb7d0bc0e2dd0fc92fd7f74cf (patch) | |
tree | 53c227068936ed4690866f4e13b957678e181dac /src/net | |
parent | b0361de1fcfc26b4bb497473e9fe1ef0f5013c98 (diff) | |
download | mv-95532bf76d70bafbb7d0bc0e2dd0fc92fd7f74cf.tar.gz mv-95532bf76d70bafbb7d0bc0e2dd0fc92fd7f74cf.tar.bz2 mv-95532bf76d70bafbb7d0bc0e2dd0fc92fd7f74cf.tar.xz mv-95532bf76d70bafbb7d0bc0e2dd0fc92fd7f74cf.zip |
Add char rename button if server support it.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/charserverhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/charserverhandler.cpp | 30 | ||||
-rw-r--r-- | src/net/eathena/charserverhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/charserverhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/charserverhandler.h | 2 |
5 files changed, 28 insertions, 10 deletions
diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h index 3b45e3e33..07135c40e 100644 --- a/src/net/charserverhandler.h +++ b/src/net/charserverhandler.h @@ -63,7 +63,7 @@ class CharServerHandler notfinal virtual void deleteCharacter(Net::Character *const character) = 0; - virtual void renameCharacter(Net::Character *const character, + virtual void renameCharacter(const int id, const std::string &newName) = 0; virtual void switchCharacter() const = 0; diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index 323fa681c..ee40d5e65 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -28,7 +28,10 @@ #include "being/attributes.h" +#include "gui/dialogtype.h" + #include "gui/windows/charcreatedialog.h" +#include "gui/windows/okdialog.h" #include "net/character.h" #include "net/logindata.h" @@ -45,6 +48,7 @@ #include "resources/db/itemdb.h" #include "utils/dtor.h" +#include "utils/gettext.h" #include "debug.h" @@ -476,20 +480,34 @@ void CharServerHandler::processCharCreate(Net::MessageIn &msg) BLOCK_END("CharServerHandler::processCharCreate") } -void CharServerHandler::renameCharacter(Net::Character *const character, +void CharServerHandler::renameCharacter(const int id, const std::string &newName) { - if (!character) - return; - createOutPacket(CMSG_CHAR_RENAME); - outMsg.writeInt32(mSelectedCharacter->dummy->getId(), "char id"); + outMsg.writeInt32(id, "char id"); outMsg.writeString(newName, 24, "name"); } void CharServerHandler::processCharRename(Net::MessageIn &msg) { - msg.readInt16("flag"); + if (msg.readInt16("flag")) + { + // TRANSLATORS: info message + new OkDialog(_("Info"), _("Character renamed."), + // TRANSLATORS: ok dialog button + _("OK"), + DialogType::OK, + true, true, nullptr, 260); + } + else + { + // TRANSLATORS: info message + new OkDialog(_("Info"), _("Character rename error."), + // TRANSLATORS: ok dialog button + _("Error"), + DialogType::ERROR, + true, true, nullptr, 260); + } } } // namespace EAthena diff --git a/src/net/eathena/charserverhandler.h b/src/net/eathena/charserverhandler.h index b88c96778..c59ab8c64 100644 --- a/src/net/eathena/charserverhandler.h +++ b/src/net/eathena/charserverhandler.h @@ -51,7 +51,7 @@ class CharServerHandler final : public MessageHandler, const unsigned char look, const std::vector<int> &stats) const override final; - void renameCharacter(Net::Character *const character, + void renameCharacter(const int id, const std::string &newName) override final; void deleteCharacter(Net::Character *const character) override final; diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 274120a83..95b26a89d 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -511,7 +511,7 @@ void CharServerHandler::processCharCreate2(Net::MessageIn &msg) BLOCK_END("CharServerHandler::processCharCreate2") } -void CharServerHandler::renameCharacter(Net::Character *const character, +void CharServerHandler::renameCharacter(const int id, const std::string &newName) { } diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h index 29af074a5..22e616003 100644 --- a/src/net/tmwa/charserverhandler.h +++ b/src/net/tmwa/charserverhandler.h @@ -53,7 +53,7 @@ class CharServerHandler final : public MessageHandler, void deleteCharacter(Net::Character *const character) override final; - void renameCharacter(Net::Character *const character, + void renameCharacter(const int id, const std::string &newName) override final; void switchCharacter() const override final; |