summaryrefslogtreecommitdiff
path: root/src/gui/charcreatedialog.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-02-19 22:38:59 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-02-19 23:37:36 +0100
commit363527d0f95963ba3f4a6d25c8eabc1bb3ad4efe (patch)
tree117ce95d3587f913a64b71fe4dcdee716b8aea7e /src/gui/charcreatedialog.cpp
parent432d16435774cafd630e287321e882f3e8510d16 (diff)
downloadmana-363527d0f95963ba3f4a6d25c8eabc1bb3ad4efe.tar.gz
mana-363527d0f95963ba3f4a6d25c8eabc1bb3ad4efe.tar.bz2
mana-363527d0f95963ba3f4a6d25c8eabc1bb3ad4efe.tar.xz
mana-363527d0f95963ba3f4a6d25c8eabc1bb3ad4efe.zip
Fixed a crash when trying to switch servers
Ownership of the charInfo global variable wasn't well defined. It was being locked, unlocked and generally modified from a lot of places, and somewhere in this mess it ended up crashing when switching servers. Now the CharHandler instances, for eAthena and manaserv respectively, own this list of characters. A new class, Net::Character wraps up the slot index in combination with the player dummy. The list is passed on to the CharSelectDialog each time it changes. Both related and unrelated cleanups were made as well. Reviewed-by: Jared Adams
Diffstat (limited to 'src/gui/charcreatedialog.cpp')
-rw-r--r--src/gui/charcreatedialog.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp
index 3d240271..8fb54f76 100644
--- a/src/gui/charcreatedialog.cpp
+++ b/src/gui/charcreatedialog.cpp
@@ -90,13 +90,13 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot):
mFemale->addActionListener(this);
mPlayerBox = new PlayerBox(mPlayer);
-
mPlayerBox->setWidth(74);
mNameField->setActionEventId("create");
mNameField->addActionListener(this);
- mAttributesLeft = new Label(strprintf(_("Please distribute %d points"), 99));
+ mAttributesLeft = new Label(
+ strprintf(_("Please distribute %d points"), 99));
int w = 200;
int h = 330;
@@ -168,8 +168,9 @@ void CharCreateDialog::action(const gcn::ActionEvent &event)
}
Net::getCharHandler()->newCharacter(getName(), mSlot,
- mFemale->isSelected(), mHairStyle,
- mHairColor, atts);
+ mFemale->isSelected(),
+ mHairStyle,
+ mHairColor, atts);
}
else
{
@@ -246,11 +247,13 @@ void CharCreateDialog::updateSliders()
mCreateButton->setEnabled(false);
if (pointsLeft > 0)
{
- mAttributesLeft->setCaption(strprintf(_("Please distribute %d points"), pointsLeft));
+ mAttributesLeft->setCaption(
+ strprintf(_("Please distribute %d points"), pointsLeft));
}
else
{
- mAttributesLeft->setCaption(strprintf(_("Please remove %d points"), -pointsLeft));
+ mAttributesLeft->setCaption(
+ strprintf(_("Please remove %d points"), -pointsLeft));
}
}
@@ -273,7 +276,7 @@ int CharCreateDialog::getDistributedPoints() const
return points;
}
-void CharCreateDialog::setAttributes(std::vector<std::string> labels,
+void CharCreateDialog::setAttributes(const std::vector<std::string> &labels,
int available, int min, int max)
{
mMaxPoints = available;
@@ -303,7 +306,8 @@ void CharCreateDialog::setAttributes(std::vector<std::string> labels,
add(mAttributeLabel[i]);
mAttributeSlider[i] = new Slider(min, max);
- mAttributeSlider[i]->setDimension(gcn::Rectangle(75, 140 + i*20, 100, 10));
+ mAttributeSlider[i]->setDimension(gcn::Rectangle(75, 140 + i * 20,
+ 100, 10));
mAttributeSlider[i]->setActionEventId("statslider");
mAttributeSlider[i]->addActionListener(this);
add(mAttributeSlider[i]);
@@ -346,11 +350,6 @@ void CharCreateDialog::setFixedGender(bool fixed, Gender gender)
}
}
-void CharCreateDialog::success()
-{
- mCharSelectDialog->update(mSlot);
-}
-
void CharCreateDialog::updateHair()
{
mHairStyle %= Being::getNumOfHairstyles();