From 95532bf76d70bafbb7d0bc0e2dd0fc92fd7f74cf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 5 Oct 2014 20:59:37 +0300 Subject: Add char rename button if server support it. --- src/net/eathena/charserverhandler.cpp | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'src/net/eathena/charserverhandler.cpp') 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 -- cgit v1.2.3-60-g2f50