summaryrefslogtreecommitdiff
path: root/src/gui/char_select.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-12-29 20:45:58 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-12-29 20:45:58 +0000
commit6a7e4f64cc802f52e3fc350c88f6571c4913ba6d (patch)
treebd45cb2590636b4a8ff7a5443fc987f526ea0220 /src/gui/char_select.cpp
parented258400f785bb1882ea7fe88bb3a12f8c19edd4 (diff)
downloadmana-client-6a7e4f64cc802f52e3fc350c88f6571c4913ba6d.tar.gz
mana-client-6a7e4f64cc802f52e3fc350c88f6571c4913ba6d.tar.bz2
mana-client-6a7e4f64cc802f52e3fc350c88f6571c4913ba6d.tar.xz
mana-client-6a7e4f64cc802f52e3fc350c88f6571c4913ba6d.zip
Restored Dev-Cpp default execution options, updated walkmap in snow map, smoothed login sequence.
Diffstat (limited to 'src/gui/char_select.cpp')
-rw-r--r--src/gui/char_select.cpp32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 86e2b12f..b1f649ec 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -62,7 +62,7 @@ void CharSelectDialog::CharDeleteConfirm::action(const std::string &eventId)
}
CharSelectDialog::CharSelectDialog():
- Window("Select Character")
+ Window("Select Character"), mStatus(0)
{
selectButton = new Button("OK");
cancelButton = new Button("Cancel");
@@ -123,7 +123,8 @@ void CharSelectDialog::action(const std::string& eventId)
{
if (eventId == "ok" && n_character > 0) {
// Start game
- serverCharSelect();
+ attemptCharSelect();
+ mStatus = 1;
}
else if (eventId == "cancel") {
state = EXIT_STATE;
@@ -208,14 +209,23 @@ void CharSelectDialog::serverCharDelete()
}
}
-void CharSelectDialog::serverCharSelect()
+void CharSelectDialog::attemptCharSelect()
{
// Request character selection
MessageOut outMsg;
outMsg.writeInt16(0x0066);
outMsg.writeInt8(0);
+}
+void
+CharSelectDialog::checkCharSelect()
+{
+ // Receive reply
MessageIn msg = get_next_message();
+ if (state == ERROR_STATE)
+ {
+ return;
+ }
logger->log("CharSelect: Packet ID: %x, Length: %d, in_size: %d",
msg.getId(), msg.getLength(), in_size);
@@ -224,14 +234,14 @@ void CharSelectDialog::serverCharSelect()
{
char_ID = msg.readInt32();
map_path = "maps/" + msg.readString(16);
- map_path= map_path.substr(0, map_path.rfind(".")) + ".tmx.gz";
+ map_path = map_path.substr(0, map_path.rfind(".")) + ".tmx.gz";
map_address = msg.readInt32();
map_port = msg.readInt16();
player_info = char_info[0];
state = CONNECTING_STATE;
logger->log("CharSelect: Map: %s", map_path.c_str());
- logger->log("CharSelect: Server: %s:%d", iptostring(map_address),
+ logger->log("CharSelect: Server: %s:%i", iptostring(map_address),
map_port);
closeConnection();
}
@@ -278,6 +288,18 @@ void CharSelectDialog::logic()
if (n_character > 0) {
setPlayerInfo(char_info[0]);
}
+
+ if (mStatus == 1)
+ {
+ if (in_size > 2)
+ {
+ checkCharSelect();
+ }
+ else
+ {
+ flush();
+ }
+ }
}
CharCreateDialog::CharCreateDialog(Window *parent):