diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-10-06 00:46:45 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-10-06 00:46:45 +0300 |
commit | 16da077d4094fd6941ae4de60f1b6f3e133f1b5a (patch) | |
tree | 8a3b46ef60ad049a21fc21dedbd20db5597dc614 /src/gui/windows/charselectdialog.cpp | |
parent | 87faf131575091160e9776c511e24b65e8b6b2e9 (diff) | |
download | manaverse-16da077d4094fd6941ae4de60f1b6f3e133f1b5a.tar.gz manaverse-16da077d4094fd6941ae4de60f1b6f3e133f1b5a.tar.bz2 manaverse-16da077d4094fd6941ae4de60f1b6f3e133f1b5a.tar.xz manaverse-16da077d4094fd6941ae4de60f1b6f3e133f1b5a.zip |
Update visible character name and character rename.
Diffstat (limited to 'src/gui/windows/charselectdialog.cpp')
-rw-r--r-- | src/gui/windows/charselectdialog.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp index 8d80fe1f7..768de6c03 100644 --- a/src/gui/windows/charselectdialog.cpp +++ b/src/gui/windows/charselectdialog.cpp @@ -605,3 +605,23 @@ void CharSelectDialog::updateState() mPlayButton->setCaption(_("Create")); } } + +void CharSelectDialog::setName(const int id, const std::string &newName) +{ + for (unsigned int i = 0, sz = static_cast<unsigned int>( + mCharacterEntries.size()); i < sz; ++i) + { + if (!mCharacterEntries[i]) + continue; + CharacterDisplay *const character = mCharacterEntries[i]; + if (!character) + continue; + LocalPlayer *const player = character->getCharacter()->dummy; + if (player && player->getId() == id) + { + player->setName(newName); + character->update(); + return; + } + } +} |