summaryrefslogtreecommitdiff
path: root/src/gui/char_select.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-02-21 14:41:13 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-02-21 14:41:13 +0000
commitf498ede13039e938c2411b0bed6868d1f53e73ff (patch)
treeec5c3531d2207ac5c95d5c90e461fd9103636d23 /src/gui/char_select.cpp
parente9a6d4270d37d455ab4ea88fb59351ed9c5ca430 (diff)
downloadmana-f498ede13039e938c2411b0bed6868d1f53e73ff.tar.gz
mana-f498ede13039e938c2411b0bed6868d1f53e73ff.tar.bz2
mana-f498ede13039e938c2411b0bed6868d1f53e73ff.tar.xz
mana-f498ede13039e938c2411b0bed6868d1f53e73ff.zip
Don't allow character names shorter than 4 (they fail) and handle character
creation and deletion errors properly (character selection errors were handled instead).
Diffstat (limited to 'src/gui/char_select.cpp')
-rw-r--r--src/gui/char_select.cpp33
1 files changed, 12 insertions, 21 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index ba18a93d..fa8d6f9e 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -184,15 +184,8 @@ void CharSelectDialog::serverCharDelete() {
setPlayerInfo(NULL);
new OkDialog(this, "Info", "Player deleted");
}
- else if (RFIFOW(0) == 0x006c) {
- switch (RFIFOB(2)) {
- case 0:
- new OkDialog(this, "Error", "Access denied");
- break;
- case 1:
- new OkDialog(this, "Error", "Cannot use this ID");
- break;
- }
+ else if (RFIFOW(0) == 0x0070) {
+ new OkDialog(this, "Error", "Failed to delete character.");
RFIFOSKIP(3);
}
else {
@@ -331,9 +324,14 @@ CharCreateDialog::~CharCreateDialog()
void CharCreateDialog::action(const std::string& eventId)
{
if (eventId == "create") {
- // Attempt to create the character and schedule this dialog for
- // deletion.
- serverCharCreate();
+ if (getName().length() >= 4) {
+ // Attempt to create the character
+ serverCharCreate();
+ }
+ else {
+ new OkDialog(this, "Error",
+ "Your name needs to be at least 4 characters.");
+ }
}
else if (eventId == "cancel") {
windowContainer->scheduleDelete(this);
@@ -403,15 +401,8 @@ void CharCreateDialog::serverCharCreate()
char_info->weapon = RFIFOW(2 + 56);
RFIFOSKIP(108);
//n_character++;
- } else if (RFIFOW(0) == 0x006c) {
- switch (RFIFOB(2)) {
- case 0:
- new OkDialog(this, "Error", "Access denied");
- break;
- case 1:
- new OkDialog(this, "Error", "Cannot use this ID");
- break;
- }
+ } else if (RFIFOW(0) == 0x006e) {
+ new OkDialog(this, "Error", "Failed to create character");
RFIFOSKIP(3);
n_character = 0;
} else {