From 447232f0ad7dd94372424389336b0a53ed332597 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sat, 3 Oct 2009 18:12:52 -0600 Subject: Update the CharSelectDialog after char creation --- src/gui/charselectdialog.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/gui/charselectdialog.cpp') diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index 12980e7b..fef319d9 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -98,6 +98,8 @@ class CharEntry : public Container LocalPlayer *getChar() const { return mCharacter; } + void setChar(LocalPlayer *chr); + void requestFocus(); void update(); @@ -262,6 +264,26 @@ void CharSelectDialog::chooseSelected() attemptCharSelect(); } +void CharSelectDialog::update(int slot) +{ + if (slot >= 0 && slot < MAX_CHARACTER_COUNT) + { + mCharInfo->select(slot); + mCharEntries[slot]->setChar(mCharInfo->getEntry()); + mCharEntries[slot]->requestFocus(); + } + else + { + int slot = mCharInfo->getPos(); + for (int i = 0; i < MAX_CHARACTER_COUNT; i++) + { + mCharInfo->select(slot); + mCharEntries[slot]->setChar(mCharInfo->getEntry()); + } + mCharInfo->select(slot); + } +} + CharEntry::CharEntry(CharSelectDialog *m, char slot, LocalPlayer *chr): mSlot(slot), mCharacter(chr), @@ -285,6 +307,16 @@ CharEntry::CharEntry(CharSelectDialog *m, char slot, LocalPlayer *chr): update(); } +void CharEntry::setChar(LocalPlayer *chr) +{ + mCharacter = chr; + + if (chr) + mPlayerBox->setPlayer(chr); + + update(); +} + void CharEntry::requestFocus() { mButton->requestFocus(); -- cgit v1.2.3-60-g2f50