summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-14 12:45:55 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-14 12:45:55 +0300
commit27efea7d495fdf755f7e94edb1f39103b6f8f072 (patch)
tree8f9465c9e21a443c9c02fc2f180c1a4ee0756b4a /src/net
parentc037b2b49f9967a269032753c7b24961313c723f (diff)
downloadmanaplus-27efea7d495fdf755f7e94edb1f39103b6f8f072.tar.gz
manaplus-27efea7d495fdf755f7e94edb1f39103b6f8f072.tar.bz2
manaplus-27efea7d495fdf755f7e94edb1f39103b6f8f072.tar.xz
manaplus-27efea7d495fdf755f7e94edb1f39103b6f8f072.zip
Move setCharCreateDialog from ea namespace into eathena and tmwa.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/charserverhandler.cpp38
-rw-r--r--src/net/ea/charserverhandler.h8
-rw-r--r--src/net/eathena/charserverhandler.cpp40
-rw-r--r--src/net/eathena/charserverhandler.h8
-rw-r--r--src/net/tmwa/charserverhandler.cpp40
-rw-r--r--src/net/tmwa/charserverhandler.h8
6 files changed, 96 insertions, 46 deletions
diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp
index 15bcb135a..e142fe27d 100644
--- a/src/net/ea/charserverhandler.cpp
+++ b/src/net/ea/charserverhandler.cpp
@@ -61,44 +61,6 @@ void CharServerHandler::setCharSelectDialog(CharSelectDialog *const window)
updateCharSelectDialog();
}
-void CharServerHandler::setCharCreateDialog(CharCreateDialog *const window)
-{
- mCharCreateDialog = window;
-
- if (!mCharCreateDialog)
- return;
-
- StringVect attributes;
- // TRANSLATORS: playe stat
- attributes.push_back(_("Strength:"));
- // TRANSLATORS: playe stat
- attributes.push_back(_("Agility:"));
- // TRANSLATORS: playe stat
- attributes.push_back(_("Vitality:"));
- // TRANSLATORS: playe stat
- attributes.push_back(_("Intelligence:"));
- // TRANSLATORS: playe stat
- attributes.push_back(_("Dexterity:"));
- // TRANSLATORS: playe stat
- attributes.push_back(_("Luck:"));
-
- const Token &token =
- static_cast<LoginHandler*>(Net::getLoginHandler())->getToken();
-
- int minStat = CharDB::getMinStat();
- if (!minStat)
- minStat = 1;
- int maxStat = CharDB::getMaxStat();
- if (!maxStat)
- maxStat = 9;
- int sumStat = CharDB::getSumStat();
- if (!sumStat)
- sumStat = 30;
-
- mCharCreateDialog->setAttributes(attributes, sumStat, minStat, maxStat);
- mCharCreateDialog->setFixedGender(true, token.sex);
-}
-
void CharServerHandler::requestCharacters()
{
connect();
diff --git a/src/net/ea/charserverhandler.h b/src/net/ea/charserverhandler.h
index ce5443753..c9b324c5b 100644
--- a/src/net/ea/charserverhandler.h
+++ b/src/net/ea/charserverhandler.h
@@ -44,14 +44,6 @@ class CharServerHandler notfinal : public Net::CharServerHandler
virtual void setCharSelectDialog(CharSelectDialog *const window)
override final;
- /**
- * Sets the character create dialog. The handler will clean up this
- * dialog when a new character is succesfully created, and will unlock
- * the dialog when a new character failed to be created.
- */
- virtual void setCharCreateDialog(CharCreateDialog *const window)
- override final;
-
virtual void requestCharacters() override final;
virtual unsigned int baseSprite() const override final A_WARN_UNUSED;
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index d7d7be582..e353d970e 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -44,9 +44,11 @@
#include "resources/iteminfo.h"
+#include "resources/db/chardb.h"
#include "resources/db/itemdb.h"
#include "utils/dtor.h"
+#include "utils/gettext.h"
#include "debug.h"
@@ -291,6 +293,44 @@ void CharServerHandler::connect()
mNetwork->skip(4);
}
+void CharServerHandler::setCharCreateDialog(CharCreateDialog *const window)
+{
+ mCharCreateDialog = window;
+
+ if (!mCharCreateDialog)
+ return;
+
+ StringVect attributes;
+ // TRANSLATORS: playe stat
+ attributes.push_back(_("Strength:"));
+ // TRANSLATORS: playe stat
+ attributes.push_back(_("Agility:"));
+ // TRANSLATORS: playe stat
+ attributes.push_back(_("Vitality:"));
+ // TRANSLATORS: playe stat
+ attributes.push_back(_("Intelligence:"));
+ // TRANSLATORS: playe stat
+ attributes.push_back(_("Dexterity:"));
+ // TRANSLATORS: playe stat
+ attributes.push_back(_("Luck:"));
+
+ const Token &token =
+ static_cast<LoginHandler*>(Net::getLoginHandler())->getToken();
+
+ int minStat = CharDB::getMinStat();
+ if (!minStat)
+ minStat = 1;
+ int maxStat = CharDB::getMaxStat();
+ if (!maxStat)
+ maxStat = 9;
+ int sumStat = CharDB::getSumStat();
+ if (!sumStat)
+ sumStat = 30;
+
+ mCharCreateDialog->setAttributes(attributes, sumStat, minStat, maxStat);
+ mCharCreateDialog->setFixedGender(true, token.sex);
+}
+
void CharServerHandler::processCharLogin(Net::MessageIn &msg)
{
msg.skip(2, "packet len");
diff --git a/src/net/eathena/charserverhandler.h b/src/net/eathena/charserverhandler.h
index d14c82cb7..cd14660ed 100644
--- a/src/net/eathena/charserverhandler.h
+++ b/src/net/eathena/charserverhandler.h
@@ -68,6 +68,14 @@ class CharServerHandler final : public MessageHandler,
void setNewPincode(const std::string &pin) override final;
+ /**
+ * Sets the character create dialog. The handler will clean up this
+ * dialog when a new character is succesfully created, and will unlock
+ * the dialog when a new character failed to be created.
+ */
+ void setCharCreateDialog(CharCreateDialog *const window)
+ override final;
+
protected:
void readPlayerData(Net::MessageIn &msg,
Net::Character *const character,
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 3fed3b568..b9997320a 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -44,9 +44,11 @@
#include "resources/iteminfo.h"
+#include "resources/db/chardb.h"
#include "resources/db/itemdb.h"
#include "utils/dtor.h"
+#include "utils/gettext.h"
#include "debug.h"
@@ -335,6 +337,44 @@ void CharServerHandler::connect()
mNetwork->skip(4);
}
+void CharServerHandler::setCharCreateDialog(CharCreateDialog *const window)
+{
+ mCharCreateDialog = window;
+
+ if (!mCharCreateDialog)
+ return;
+
+ StringVect attributes;
+ // TRANSLATORS: playe stat
+ attributes.push_back(_("Strength:"));
+ // TRANSLATORS: playe stat
+ attributes.push_back(_("Agility:"));
+ // TRANSLATORS: playe stat
+ attributes.push_back(_("Vitality:"));
+ // TRANSLATORS: playe stat
+ attributes.push_back(_("Intelligence:"));
+ // TRANSLATORS: playe stat
+ attributes.push_back(_("Dexterity:"));
+ // TRANSLATORS: playe stat
+ attributes.push_back(_("Luck:"));
+
+ const Token &token =
+ static_cast<LoginHandler*>(Net::getLoginHandler())->getToken();
+
+ int minStat = CharDB::getMinStat();
+ if (!minStat)
+ minStat = 1;
+ int maxStat = CharDB::getMaxStat();
+ if (!maxStat)
+ maxStat = 9;
+ int sumStat = CharDB::getSumStat();
+ if (!sumStat)
+ sumStat = 30;
+
+ mCharCreateDialog->setAttributes(attributes, sumStat, minStat, maxStat);
+ mCharCreateDialog->setFixedGender(true, token.sex);
+}
+
void CharServerHandler::processCharLogin(Net::MessageIn &msg)
{
BLOCK_START("CharServerHandler::processCharLogin")
diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h
index b8cb5182e..0fd6f1f93 100644
--- a/src/net/tmwa/charserverhandler.h
+++ b/src/net/tmwa/charserverhandler.h
@@ -69,6 +69,14 @@ class CharServerHandler final : public MessageHandler,
void setNewPincode(const std::string &pin A_UNUSED) override final
{ }
+ /**
+ * Sets the character create dialog. The handler will clean up this
+ * dialog when a new character is succesfully created, and will unlock
+ * the dialog when a new character failed to be created.
+ */
+ void setCharCreateDialog(CharCreateDialog *const window)
+ override final;
+
protected:
void readPlayerData(Net::MessageIn &msg,
Net::Character *const character,