diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-01-02 11:34:09 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-01-02 11:34:09 +0000 |
commit | 25d7576e6b10e5fa5c6981470d0ccd5f005e5650 (patch) | |
tree | 7caa7e6d6294efa410547adcfcb43236ac135920 /src/gui/char_select.cpp | |
parent | 6573cf6072c39396d2526edeff41449ea16e7288 (diff) | |
download | mana-25d7576e6b10e5fa5c6981470d0ccd5f005e5650.tar.gz mana-25d7576e6b10e5fa5c6981470d0ccd5f005e5650.tar.bz2 mana-25d7576e6b10e5fa5c6981470d0ccd5f005e5650.tar.xz mana-25d7576e6b10e5fa5c6981470d0ccd5f005e5650.zip |
Smoothed also character creation, buttons are now disabled during connection/data phase.
Diffstat (limited to 'src/gui/char_select.cpp')
-rw-r--r-- | src/gui/char_select.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index 734ed766..7ac76854 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -124,6 +124,9 @@ void CharSelectDialog::action(const std::string& eventId) if (eventId == "ok" && n_character > 0) { // Start game attemptCharSelect(); + newCharButton->setEnabled(false); + delCharButton->setEnabled(false); + selectButton->setEnabled(false); mStatus = 1; } else if (eventId == "cancel") { @@ -303,7 +306,7 @@ void CharSelectDialog::logic() } CharCreateDialog::CharCreateDialog(Window *parent): - Window("Create Character", true, parent) + Window("Create Character", true, parent), mStatus(0) { nameField = new TextField(""); nameLabel = new gcn::Label("Name:"); @@ -369,12 +372,29 @@ CharCreateDialog::CharCreateDialog(Window *parent): setLocationRelativeTo(getParent()); } +void CharCreateDialog::logic() +{ + if (mStatus == 1) + { + if (packetReady()) + { + checkCharCreate(); + } + else + { + flush(); + } + } +} + void CharCreateDialog::action(const std::string& eventId) { if (eventId == "create") { if (getName().length() >= 4) { // Attempt to create the character - serverCharCreate(); + attemptCharCreate(); + createButton->setEnabled(false); + mStatus = 1; } else { new OkDialog(this, "Error", @@ -406,7 +426,7 @@ std::string CharCreateDialog::getName() return nameField->getText(); } -void CharCreateDialog::serverCharCreate() +void CharCreateDialog::attemptCharCreate() { // Send character infos MessageOut outMsg; @@ -421,7 +441,10 @@ void CharCreateDialog::serverCharCreate() outMsg.writeInt8(0); outMsg.writeInt16(playerBox->hairColor + 1); outMsg.writeInt16(playerBox->hairStyle + 1); +} +void CharCreateDialog::checkCharCreate() +{ MessageIn msg = get_next_message(); if (msg.getId() == 0x006d) |