summaryrefslogtreecommitdiff
path: root/src/gui/charcreatedialog.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2013-04-27 21:43:32 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2013-04-27 22:07:06 +0200
commit4b0da49b28bb64d2da293ca90fec63079c2c5849 (patch)
tree7cf17967002737836199966e6e123de417943d4d /src/gui/charcreatedialog.cpp
parent1a99d37d059df95f6a144c4f9e9fa85dacefd185 (diff)
downloadmana-4b0da49b28bb64d2da293ca90fec63079c2c5849.tar.gz
mana-4b0da49b28bb64d2da293ca90fec63079c2c5849.tar.bz2
mana-4b0da49b28bb64d2da293ca90fec63079c2c5849.tar.xz
mana-4b0da49b28bb64d2da293ca90fec63079c2c5849.zip
Added support for charcreation.xml settings
This file was introduced by ManaPlus as a way of configuring the character creation process. It defines the number of hair styles and colors, how stat points should be divided and what the starting equipment of the player is. The minimum and maximum hair color/style IDs are not supported at the moment. This is mostly a backport of ManaPlus commits 10cf52b5 and dcc18eba, with some style changes. Mantis-issue: 501 Reviewed-by: Ablu
Diffstat (limited to 'src/gui/charcreatedialog.cpp')
-rw-r--r--src/gui/charcreatedialog.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp
index 8fee148b..a3c03a31 100644
--- a/src/gui/charcreatedialog.cpp
+++ b/src/gui/charcreatedialog.cpp
@@ -41,6 +41,7 @@
#include "net/charhandler.h"
#include "net/net.h"
+#include "resources/chardb.h"
#include "resources/hairdb.h"
#include "utils/gettext.h"
@@ -56,6 +57,10 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot):
mPlayer = new Being(0, ActorSprite::PLAYER, 0, NULL);
mPlayer->setGender(GENDER_MALE);
+ const std::vector<int> &items = CharDB::getDefaultItems();
+ for (size_t i = 0; i < items.size(); ++i)
+ mPlayer->setSprite(i + 1, items.at(i));
+
mHairStylesIds = hairDB.getHairStyleIds(
Net::getCharHandler()->getCharCreateMaxHairStyleId());
mHairStyleId = rand() * mHairStylesIds.size() / RAND_MAX;
@@ -196,7 +201,9 @@ void CharCreateDialog::action(const gcn::ActionEvent &event)
}
}
else if (event.getId() == "cancel")
+ {
scheduleDelete();
+ }
else if (event.getId() == "nextcolor")
{
++mHairColorId;