diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-14 13:41:58 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-14 13:41:58 +0300 |
commit | 90ec2e79ac8f4412a86dacb8976f449a1662274e (patch) | |
tree | 449b974da159049afee29d94cfcc50fa642cfdb0 /src | |
parent | ceafa0afeeb8f47f91896cda18c2ae4d084a6fa5 (diff) | |
download | mv-90ec2e79ac8f4412a86dacb8976f449a1662274e.tar.gz mv-90ec2e79ac8f4412a86dacb8976f449a1662274e.tar.bz2 mv-90ec2e79ac8f4412a86dacb8976f449a1662274e.tar.xz mv-90ec2e79ac8f4412a86dacb8976f449a1662274e.zip |
In charselectdialog add function for separate chars adding/updating.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/windows/charselectdialog.cpp | 29 | ||||
-rw-r--r-- | src/gui/windows/charselectdialog.h | 2 |
2 files changed, 16 insertions, 15 deletions
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<int>(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<int>(mCharacterEntries.size())) + { + logger->log("Warning: slot out of range: %d", character->slot); + return; } - updateState(); + if (mCharacterEntries[characterSlot]) + mCharacterEntries[characterSlot]->setCharacter(character); } void CharSelectDialog::lock() diff --git a/src/gui/windows/charselectdialog.h b/src/gui/windows/charselectdialog.h index cf44f30b9..a6acd9c32 100644 --- a/src/gui/windows/charselectdialog.h +++ b/src/gui/windows/charselectdialog.h @@ -98,6 +98,8 @@ class CharSelectDialog final : public Window, void setCharacters(const Net::Characters &characters); + void setCharacter(Net::Character *const character); + void use(const int selected); void lock(); |