From 90ec2e79ac8f4412a86dacb8976f449a1662274e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 14 Sep 2014 13:41:58 +0300 Subject: In charselectdialog add function for separate chars adding/updating. --- src/gui/windows/charselectdialog.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'src/gui/windows/charselectdialog.cpp') diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp index 2d45e47ca..3c355c199 100644 --- a/src/gui/windows/charselectdialog.cpp +++ b/src/gui/windows/charselectdialog.cpp @@ -463,24 +463,23 @@ void CharSelectDialog::setCharacters(const Net::Characters &characters) } FOR_EACH (Net::Characters::const_iterator, i, characters) - { - if (!*i) - continue; - - Net::Character *const character = *i; - - const int characterSlot = character->slot; - if (characterSlot >= static_cast(mCharacterEntries.size())) - { - logger->log("Warning: slot out of range: %d", character->slot); - continue; - } + setCharacter(*i); + updateState(); +} - if (mCharacterEntries[characterSlot]) - mCharacterEntries[characterSlot]->setCharacter(character); +void CharSelectDialog::setCharacter(Net::Character *const character) +{ + if (!character) + return; + const int characterSlot = character->slot; + if (characterSlot >= static_cast(mCharacterEntries.size())) + { + logger->log("Warning: slot out of range: %d", character->slot); + return; } - updateState(); + if (mCharacterEntries[characterSlot]) + mCharacterEntries[characterSlot]->setCharacter(character); } void CharSelectDialog::lock() -- cgit v1.2.3-70-g09d2