diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-10-03 18:12:52 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-10-03 18:12:52 -0600 |
commit | 447232f0ad7dd94372424389336b0a53ed332597 (patch) | |
tree | f0aded965b96fed35fbe7ff2a9cf10700b923ce8 /src/net | |
parent | 0269b1f766a4e9e8ded91505855cff58c18086e2 (diff) | |
download | mana-447232f0ad7dd94372424389336b0a53ed332597.tar.gz mana-447232f0ad7dd94372424389336b0a53ed332597.tar.bz2 mana-447232f0ad7dd94372424389336b0a53ed332597.tar.xz mana-447232f0ad7dd94372424389336b0a53ed332597.zip |
Update the CharSelectDialog after char creation
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/ea/charserverhandler.cpp | 1 | ||||
-rw-r--r-- | src/net/tmwserv/charhandler.cpp | 40 | ||||
-rw-r--r-- | src/net/tmwserv/charhandler.h | 4 |
3 files changed, 43 insertions, 2 deletions
diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index f854841f..83f8f9fc 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -118,6 +118,7 @@ void CharServerHandler::handleMessage(MessageIn &msg) // Close the character create dialog if (mCharCreateDialog) { + mCharCreateDialog->success(); mCharCreateDialog->scheduleDelete(); mCharCreateDialog = 0; } diff --git a/src/net/tmwserv/charhandler.cpp b/src/net/tmwserv/charhandler.cpp index ec260d84..841c9a2d 100644 --- a/src/net/tmwserv/charhandler.cpp +++ b/src/net/tmwserv/charhandler.cpp @@ -72,6 +72,7 @@ extern ServerInfo gameServer; extern ServerInfo chatServer; CharHandler::CharHandler(): + mCharSelectDialog(0), mCharCreateDialog(0) { static const Uint16 _messages[] = { @@ -145,6 +146,30 @@ void CharHandler::handleMessage(MessageIn &msg) } chars.push_back(info); + + if (mCharSelectDialog) + { + mCharInfo->select(info.slot); + + LocalPlayer *tempPlayer = new LocalPlayer(); + tempPlayer->setName(info.name); + tempPlayer->setGender(info.gender); + tempPlayer->setSprite(Player::HAIR_SPRITE, info.hs * -1, + ColorDB::get(info.hc)); + tempPlayer->setLevel(info.level); + tempPlayer->setCharacterPoints(info.charPoints); + tempPlayer->setCorrectionPoints(info.corrPoints); + tempPlayer->setMoney(info.money); + + for (int i = 0; i < 7; i++) + { + tempPlayer->setAttributeBase(i, info.attr[i]); + } + + mCharInfo->setEntry(tempPlayer); + + mCharSelectDialog->update(info.slot); + } } break; @@ -199,10 +224,20 @@ void CharHandler::handleCharCreateResponse(MessageIn &msg) break; } new OkDialog(_("Error"), errorMessage); + + if (mCharCreateDialog) + mCharCreateDialog->unlock(); + } + else + { + if (mCharCreateDialog) + { + mCharCreateDialog->success(); + mCharCreateDialog->scheduleDelete(); + mCharCreateDialog = 0; + } } - if (mCharCreateDialog) - mCharCreateDialog->unlock(); } void CharHandler::handleCharSelectResponse(MessageIn &msg) @@ -258,6 +293,7 @@ void CharHandler::handleCharSelectResponse(MessageIn &msg) void CharHandler::setCharCreateDialog(CharCreateDialog *window) { + mCharSelectDialog = window ? window->getSelectDialog() : NULL; mCharCreateDialog = window; if (!mCharCreateDialog) return; diff --git a/src/net/tmwserv/charhandler.h b/src/net/tmwserv/charhandler.h index 2c62c1d0..5517bd17 100644 --- a/src/net/tmwserv/charhandler.h +++ b/src/net/tmwserv/charhandler.h @@ -23,6 +23,9 @@ #define NET_TMWSERV_CHARSERVERHANDLER_H #include "net/charhandler.h" + +#include "gui/charselectdialog.h" + #include "net/messagehandler.h" class LoginData; @@ -67,6 +70,7 @@ class CharHandler : public MessageHandler, public Net::CharHandler void handleCharSelectResponse(MessageIn &msg); LockedArray<LocalPlayer*> *mCharInfo; + CharSelectDialog *mCharSelectDialog; CharCreateDialog *mCharCreateDialog; }; |