summaryrefslogtreecommitdiff
path: root/src/net/ea/charserverhandler.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-10-04 12:27:07 -0600
committerJared Adams <jaxad0127@gmail.com>2009-10-04 12:27:07 -0600
commitcff9f1947bac8fa49aaf6f846a6e4335a439ac2e (patch)
treea1b2272c9541bb1ee40323948970787459187ae6 /src/net/ea/charserverhandler.cpp
parent95b54aee1b20e6fd2bf8f99766d810e0ab2e5477 (diff)
downloadmana-cff9f1947bac8fa49aaf6f846a6e4335a439ac2e.tar.gz
mana-cff9f1947bac8fa49aaf6f846a6e4335a439ac2e.tar.bz2
mana-cff9f1947bac8fa49aaf6f846a6e4335a439ac2e.tar.xz
mana-cff9f1947bac8fa49aaf6f846a6e4335a439ac2e.zip
Add ability to delect characters from account
Diffstat (limited to 'src/net/ea/charserverhandler.cpp')
-rw-r--r--src/net/ea/charserverhandler.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp
index 83f8f9fc..e538eeaf 100644
--- a/src/net/ea/charserverhandler.cpp
+++ b/src/net/ea/charserverhandler.cpp
@@ -49,6 +49,7 @@ extern ServerInfo charServer;
extern ServerInfo mapServer;
CharServerHandler::CharServerHandler():
+ mCharSelectDialog(0),
mCharCreateDialog(0)
{
static const Uint16 _messages[] = {
@@ -67,7 +68,7 @@ CharServerHandler::CharServerHandler():
void CharServerHandler::handleMessage(MessageIn &msg)
{
- int slot;
+ int count, slot;
LocalPlayer *tempPlayer;
logger->log("CharServerHandler: Packet ID: %x, Length: %d",
@@ -79,9 +80,9 @@ void CharServerHandler::handleMessage(MessageIn &msg)
msg.skip(20); // Unused
// Derive number of characters from message length
- n_character = (msg.getLength() - 24) / 106;
+ count = (msg.getLength() - 24) / 106;
- for (int i = 0; i < n_character; i++)
+ for (int i = 0; i < count; i++)
{
tempPlayer = readPlayerData(msg, slot);
mCharInfo->select(slot);
@@ -113,7 +114,6 @@ void CharServerHandler::handleMessage(MessageIn &msg)
mCharInfo->unlock();
mCharInfo->select(slot);
mCharInfo->setEntry(tempPlayer);
- n_character++;
// Close the character create dialog
if (mCharCreateDialog)
@@ -133,11 +133,13 @@ void CharServerHandler::handleMessage(MessageIn &msg)
break;
case SMSG_CHAR_DELETE_SUCCEEDED:
- delete mCharInfo->getEntry();
+ tempPlayer = mCharInfo->getEntry();
mCharInfo->setEntry(0);
mCharInfo->unlock();
- n_character--;
+ if (mCharSelectDialog)
+ mCharSelectDialog->update(mCharInfo->getPos());
new OkDialog(_("Info"), _("Character deleted."));
+ delete tempPlayer;
break;
case SMSG_CHAR_DELETE_FAILED:
@@ -219,6 +221,11 @@ LocalPlayer *CharServerHandler::readPlayerData(MessageIn &msg, int &slot)
return tempPlayer;
}
+void CharServerHandler::setCharSelectDialog(CharSelectDialog *window)
+{
+ mCharSelectDialog = window;
+}
+
void CharServerHandler::setCharCreateDialog(CharCreateDialog *window)
{
mCharCreateDialog = window;