summaryrefslogtreecommitdiff
path: root/src/gui/charselectdialog.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-10-03 18:12:52 -0600
committerJared Adams <jaxad0127@gmail.com>2009-10-03 18:12:52 -0600
commit447232f0ad7dd94372424389336b0a53ed332597 (patch)
treef0aded965b96fed35fbe7ff2a9cf10700b923ce8 /src/gui/charselectdialog.cpp
parent0269b1f766a4e9e8ded91505855cff58c18086e2 (diff)
downloadmana-447232f0ad7dd94372424389336b0a53ed332597.tar.gz
mana-447232f0ad7dd94372424389336b0a53ed332597.tar.bz2
mana-447232f0ad7dd94372424389336b0a53ed332597.tar.xz
mana-447232f0ad7dd94372424389336b0a53ed332597.zip
Update the CharSelectDialog after char creation
Diffstat (limited to 'src/gui/charselectdialog.cpp')
-rw-r--r--src/gui/charselectdialog.cpp32
1 files changed, 32 insertions, 0 deletions
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();