diff options
Diffstat (limited to 'src/gui/charselectdialog.cpp')
-rw-r--r-- | src/gui/charselectdialog.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index f8c28c6a..d8794afd 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -154,7 +154,8 @@ CharSelectDialog::CharSelectDialog(LoginData *loginData): place = getPlacer(0, 1); - for (int i = 0; i < MAX_CHARACTER_COUNT; i++) { + for (int i = 0; i < MAX_CHARACTER_COUNT; i++) + { mCharacterEntries[i] = new CharacterDisplay(this); place(i, 0, mCharacterEntries[i]); } @@ -191,7 +192,8 @@ void CharSelectDialog::action(const gcn::ActionEvent &event) { attemptCharacterSelect(selected); } - else if (eventId == "new" && !mCharacterEntries[selected]->getCharacter()) + else if (eventId == "new" + && !mCharacterEntries[selected]->getCharacter()) { // Start new character dialog CharCreateDialog *charCreateDialog = @@ -268,7 +270,8 @@ void CharSelectDialog::setCharacters(const Net::Characters &characters) for (i = characters.begin(); i != i_end; ++i) { Net::Character *character = *i; - if (character->slot >= MAX_CHARACTER_COUNT) { + if (character->slot >= MAX_CHARACTER_COUNT) + { logger->log("Warning: slot out of range: %d", character->slot); continue; } @@ -309,9 +312,12 @@ bool CharSelectDialog::selectByName(const std::string &name, if (mLocked) return false; - for (int i = 0; i < MAX_CHARACTER_COUNT; ++i) { - if (Net::Character *character = mCharacterEntries[i]->getCharacter()) { - if (character->dummy->getName() == name) { + for (int i = 0; i < MAX_CHARACTER_COUNT; ++i) + { + if (Net::Character *character = mCharacterEntries[i]->getCharacter()) + { + if (character->dummy->getName() == name) + { mCharacterEntries[i]->requestFocus(); if (action == Choose) attemptCharacterSelect(i); @@ -380,8 +386,10 @@ void CharacterDisplay::update() mButton->setCaption(_("Choose")); mButton->setActionEventId("use"); mName->setCaption(strprintf("%s", character->getName().c_str())); - mLevel->setCaption(strprintf("Level %d", character->getLevel())); - mMoney->setCaption(Units::formatCurrency(character->getMoney())); + mLevel->setCaption(strprintf("Level %d", + mCharacter->data.mAttributes[LEVEL])); + mMoney->setCaption(Units::formatCurrency( + mCharacter->data.mAttributes[MONEY])); mDelete->setVisible(true); } |