diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-12-28 00:48:05 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-12-29 07:41:08 +0100 |
commit | 3553f1e11f7f4478c4c64192f6455d528c7dffda (patch) | |
tree | e0dd6bf3c44718f7be5cad7803449cd6ebb625ff /src/gui | |
parent | 411b54e993ea997e18be18fadd26ceab00c00fa3 (diff) | |
download | mana-3553f1e11f7f4478c4c64192f6455d528c7dffda.tar.gz mana-3553f1e11f7f4478c4c64192f6455d528c7dffda.tar.bz2 mana-3553f1e11f7f4478c4c64192f6455d528c7dffda.tar.xz mana-3553f1e11f7f4478c4c64192f6455d528c7dffda.zip |
Made the client handle the characters slots properly for Manaserv.
Reviewed-by: Crush.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/charcreatedialog.cpp | 10 | ||||
-rw-r--r-- | src/gui/charselectdialog.cpp | 11 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 2db25a35..746295b5 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -156,7 +156,8 @@ void CharCreateDialog::action(const gcn::ActionEvent &event) { if (event.getId() == "create") { - if (getName().length() >= 4) + if (Net::getNetworkType() == ServerInfo::MANASERV + || getName().length() >= 4) { // Attempt to create the character mCreateButton->setEnabled(false); @@ -167,7 +168,12 @@ void CharCreateDialog::action(const gcn::ActionEvent &event) atts.push_back((int) mAttributeSlider[i]->getValue()); } - Net::getCharHandler()->newCharacter(getName(), mSlot, + int characterSlot = mSlot; + // On Manaserv, the slots start at 1, so we offset them. + if (Net::getNetworkType() == ServerInfo::MANASERV) + ++characterSlot; + + Net::getCharHandler()->newCharacter(getName(), characterSlot, mFemale->isSelected(), mHairStyle, mHairColor, atts); diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index 1fe7d3ba..42c514ec 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -281,13 +281,20 @@ void CharSelectDialog::setCharacters(const Net::Characters &characters) for (i = characters.begin(); i != i_end; ++i) { Net::Character *character = *i; - if (character->slot >= (int)mCharacterEntries.size()) + + // Slots Number start at 1 for Manaserv, so we offset them by one. + int characterSlot = character->slot; + if (Net::getNetworkType() == ServerInfo::MANASERV + && characterSlot > 0) + --characterSlot; + + if (characterSlot >= (int)mCharacterEntries.size()) { logger->log("Warning: slot out of range: %d", character->slot); continue; } - mCharacterEntries[character->slot]->setCharacter(character); + mCharacterEntries[characterSlot]->setCharacter(character); } } |