~ubuntu-branches/ubuntu/vivid/manaplus/vivid

« back to all changes in this revision

Viewing changes to src/net/ea/charserverhandler.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2014-09-30 18:10:18 UTC
  • mfrom: (1.1.35)
  • Revision ID: package-import@ubuntu.com-20140930181018-pb73a0ogw29tjv8k
Tags: 1.4.9.27-1
* New upstream release.
* Bump Standards-Version to 3.9.6 (no changes required).

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include "gui/windows/charcreatedialog.h"
30
30
#include "gui/windows/okdialog.h"
31
31
 
32
 
#include "net/ea/loginhandler.h"
33
32
#include "net/ea/eaprotocol.h"
34
33
 
35
34
#include "net/character.h"
36
35
#include "net/messagein.h"
37
 
#include "net/net.h"
38
36
 
39
37
#include "utils/dtor.h"
40
38
#include "utils/gettext.h"
41
39
 
42
 
#include "resources/db/chardb.h"
43
 
 
44
40
#include "debug.h"
45
41
 
46
42
extern Net::CharServerHandler *charServerHandler;
61
57
    updateCharSelectDialog();
62
58
}
63
59
 
64
 
void CharServerHandler::setCharCreateDialog(CharCreateDialog *const window)
65
 
{
66
 
    mCharCreateDialog = window;
67
 
 
68
 
    if (!mCharCreateDialog)
69
 
        return;
70
 
 
71
 
    StringVect attributes;
72
 
    // TRANSLATORS: playe stat
73
 
    attributes.push_back(_("Strength:"));
74
 
    // TRANSLATORS: playe stat
75
 
    attributes.push_back(_("Agility:"));
76
 
    // TRANSLATORS: playe stat
77
 
    attributes.push_back(_("Vitality:"));
78
 
    // TRANSLATORS: playe stat
79
 
    attributes.push_back(_("Intelligence:"));
80
 
    // TRANSLATORS: playe stat
81
 
    attributes.push_back(_("Dexterity:"));
82
 
    // TRANSLATORS: playe stat
83
 
    attributes.push_back(_("Luck:"));
84
 
 
85
 
    const Token &token =
86
 
        static_cast<LoginHandler*>(Net::getLoginHandler())->getToken();
87
 
 
88
 
    int minStat = CharDB::getMinStat();
89
 
    if (!minStat)
90
 
        minStat = 1;
91
 
    int maxStat = CharDB::getMaxStat();
92
 
    if (!maxStat)
93
 
        maxStat = 9;
94
 
    int sumStat = CharDB::getSumStat();
95
 
    if (!sumStat)
96
 
        sumStat = 30;
97
 
 
98
 
    mCharCreateDialog->setAttributes(attributes, sumStat, minStat, maxStat);
99
 
    mCharCreateDialog->setFixedGender(true, token.sex);
100
 
}
101
 
 
102
60
void CharServerHandler::requestCharacters()
103
61
{
104
62
    connect();
142
100
    BLOCK_END("CharServerHandler::processCharLoginError")
143
101
}
144
102
 
145
 
void CharServerHandler::processCharCreate(Net::MessageIn &msg)
146
 
{
147
 
    BLOCK_START("CharServerHandler::processCharCreate")
148
 
    Net::Character *const character = new Net::Character;
149
 
    readPlayerData(msg, character, msg.getId() == SMSG_CHAR_CREATE_SUCCEEDED2);
150
 
    mCharacters.push_back(character);
151
 
 
152
 
    updateCharSelectDialog();
153
 
 
154
 
    // Close the character create dialog
155
 
    if (mCharCreateDialog)
156
 
    {
157
 
        mCharCreateDialog->scheduleDelete();
158
 
        mCharCreateDialog = nullptr;
159
 
    }
160
 
    BLOCK_END("CharServerHandler::processCharCreate")
161
 
}
162
 
 
163
103
void CharServerHandler::processCharCreateFailed(Net::MessageIn &msg)
164
104
{
165
105
    BLOCK_START("CharServerHandler::processCharCreateFailed")