diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-08-26 21:29:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-08-26 21:29:59 +0300 |
commit | a33a8dc48761d7cb2b4c1c468e1e3b188bcbf709 (patch) | |
tree | 1b1e98a615e2c03641c99b66cb4667b56f7087c3 /src/gui/charcreatedialog.cpp | |
parent | 012a10fd8153f3ddb775dde1e4dba4456f2aa9de (diff) | |
download | manaverse-a33a8dc48761d7cb2b4c1c468e1e3b188bcbf709.tar.gz manaverse-a33a8dc48761d7cb2b4c1c468e1e3b188bcbf709.tar.bz2 manaverse-a33a8dc48761d7cb2b4c1c468e1e3b188bcbf709.tar.xz manaverse-a33a8dc48761d7cb2b4c1c468e1e3b188bcbf709.zip |
Add const to some classes.
Diffstat (limited to 'src/gui/charcreatedialog.cpp')
-rw-r--r-- | src/gui/charcreatedialog.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index ba2e06661..4c553f5e1 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -64,7 +64,8 @@ static const uint8_t directions[] = Being::DOWN, Being::RIGHT, Being::UP, Being::LEFT }; -CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot): +CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, + const int slot) : Window(_("New Character"), true, parent, "charcreate.xml"), mCharSelectDialog(parent), mRace(0), @@ -152,8 +153,8 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot): mAttributesLeft = new Label( strprintf(_("Please distribute %d points"), 99)); - int w = 480; - int h = 350; + const int w = 480; + const int h = 350; setContentSize(w, h); mPlayerBox->setDimension(gcn::Rectangle(350, 40, 110, 90)); mActionButton->setPosition(375, 140); @@ -163,10 +164,10 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot): mNameField->setDimension( gcn::Rectangle(60, 10, 300, mNameField->getHeight())); - int leftX = 120; - int rightX = 300; - int labelX = 5; - int nameX = 145; + const int leftX = 120; + const int rightX = 300; + const int labelX = 5; + const int nameX = 145; mPrevHairColorButton->setPosition(leftX, 40); mNextHairColorButton->setPosition(rightX, 40); mHairColorLabel->setPosition(labelX, 45); @@ -270,11 +271,13 @@ void CharCreateDialog::action(const gcn::ActionEvent &event) mAttributeSlider[i]->getValue())); } - int characterSlot = mSlot; #ifdef MANASERV_SUPPORT + int characterSlot = mSlot; // On Manaserv, the slots start at 1, so we offset them. if (Net::getNetworkType() == ServerInfo::MANASERV) ++characterSlot; +#else + const int characterSlot = mSlot; #endif Net::getCharHandler()->newCharacter(getName(), characterSlot, @@ -367,7 +370,7 @@ void CharCreateDialog::updateSliders() } // Update distributed points - int pointsLeft = mMaxPoints - getDistributedPoints(); + const int pointsLeft = mMaxPoints - getDistributedPoints(); if (pointsLeft == 0) { mAttributesLeft->setCaption(_("Character stats OK")); @@ -406,7 +409,8 @@ int CharCreateDialog::getDistributedPoints() const } void CharCreateDialog::setAttributes(const StringVect &labels, - int available, int min, int max) + const int available, + const int min, const int max) { mMaxPoints = available; @@ -427,8 +431,8 @@ void CharCreateDialog::setAttributes(const StringVect &labels, mAttributeSlider.resize(labels.size()); mAttributeValue.resize(labels.size()); - int w = 480; - int h = 350; + const int w = 480; + const int h = 350; for (unsigned i = 0, sz = static_cast<unsigned>(labels.size()); i < sz; i++) @@ -462,7 +466,7 @@ void CharCreateDialog::setAttributes(const StringVect &labels, h - 5 - mCancelButton->getHeight()); } -void CharCreateDialog::setFixedGender(bool fixed, Gender gender) +void CharCreateDialog::setFixedGender(const bool fixed, const Gender gender) { if (gender == GENDER_FEMALE) { @@ -564,7 +568,7 @@ void CharCreateDialog::updatePlayer() void CharCreateDialog::keyPressed(gcn::KeyEvent &keyEvent) { - int actionId = static_cast<KeyEvent*>(&keyEvent)->getActionId(); + const int actionId = static_cast<KeyEvent*>(&keyEvent)->getActionId(); switch (actionId) { case Input::KEY_GUI_CANCEL: |