summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/charserverhandler.cpp1
-rw-r--r--src/net/tmwserv/charhandler.cpp40
-rw-r--r--src/net/tmwserv/charhandler.h4
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;
};