diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-09-26 17:24:37 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-09-26 17:24:37 +0000 |
commit | a0fd39a05151848bef85e18e25aa0824bc9cef93 (patch) | |
tree | 60f9ed2136268d7570b4716a318e510b2c30d2ce /src/gui | |
parent | 1a7f56901301fb8fe08f26526f3314b0974626ca (diff) | |
download | mana-client-a0fd39a05151848bef85e18e25aa0824bc9cef93.tar.gz mana-client-a0fd39a05151848bef85e18e25aa0824bc9cef93.tar.bz2 mana-client-a0fd39a05151848bef85e18e25aa0824bc9cef93.tar.xz mana-client-a0fd39a05151848bef85e18e25aa0824bc9cef93.zip |
Added a nicer handling of when you get disconnected from the server.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/char_select.cpp | 8 | ||||
-rw-r--r-- | src/gui/char_server.cpp | 8 | ||||
-rw-r--r-- | src/gui/gui.cpp | 2 | ||||
-rw-r--r-- | src/gui/login.cpp | 12 | ||||
-rw-r--r-- | src/gui/updatewindow.cpp | 8 |
5 files changed, 19 insertions, 19 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index 0c03a6b0..fd0ccdc9 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -139,7 +139,7 @@ void CharSelectDialog::action(const std::string& eventId) serverCharSelect(); } else if (eventId == "cancel") { - state = EXIT; + state = EXIT_STATE; } else if (eventId == "new") { if (n_character == 0) { @@ -241,7 +241,7 @@ void CharSelectDialog::serverCharSelect() map_address = msg.readLong(); map_port = msg.readShort(); player_info = char_info[0]; - state = GAME; + state = GAME_STATE; logger->log("CharSelect: Map: %s", map_path.c_str()); logger->log("CharSelect: Server: %s:%d", iptostring(map_address), @@ -278,7 +278,7 @@ void CharSelectDialog::serverCharSelect() break; } close_session(); - state = LOGIN; + state = LOGIN_STATE; } // Todo: add other packets @@ -492,6 +492,6 @@ void charSelectInputHandler(SDL_KeyboardEvent *keyEvent) { if (keyEvent->keysym.sym == SDLK_ESCAPE) { - state = EXIT; + state = EXIT_STATE; } } diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp index 5c371469..a8f99d8f 100644 --- a/src/gui/char_server.cpp +++ b/src/gui/char_server.cpp @@ -107,7 +107,7 @@ void ServerSelectDialog::action(const std::string& eventId) server_char_server(serverList->getSelected()); } else if (eventId == "cancel") { - state = LOGIN; + state = LOGIN_STATE; } } @@ -128,14 +128,14 @@ void charServerInputHandler(SDL_KeyboardEvent *keyEvent) { if (keyEvent->keysym.sym == SDLK_ESCAPE) { - state = LOGIN; + state = LOGIN_STATE; } } void server_char_server(int serverIndex) { int ret; - state = LOGIN; + state = LOGIN_STATE; const char *ipstring = iptostring(server_info[serverIndex]->address); // Connect to char server @@ -217,7 +217,7 @@ void server_char_server(int serverIndex) msg.readByte(); // unknown } - state = CHAR_SELECT; + state = CHAR_SELECT_STATE; logger->log("CharServer: Player: %s (Packet ID: %x, Length: %d)", char_info[0]->name.c_str(), msg.getId(), msg.getLength()); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 6edcd1a4..afe2019d 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -230,7 +230,7 @@ void Gui::mousePress(int mx, int my, int button) int tilex = mx / 32 + camera_x; int tiley = my / 32 + camera_y; - if (state == GAME && tiledMap->getWalk(tilex, tiley)) { + if (state == GAME_STATE && tiledMap->getWalk(tilex, tiley)) { walk(tilex, tiley, 0); player_node->setDestination(tilex, tiley); diff --git a/src/gui/login.cpp b/src/gui/login.cpp index f5dc4f1e..83a20f8b 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -240,7 +240,7 @@ void LoginDialog::action(const std::string& eventId) } else if (eventId == "cancel") { - state = EXIT; + state = EXIT_STATE; } else if (eventId == "register") { @@ -315,7 +315,7 @@ void loginInputHandler(SDL_KeyboardEvent *keyEvent) { if (keyEvent->keysym.sym == SDLK_ESCAPE) { - state = EXIT; + state = EXIT_STATE; } } @@ -329,7 +329,7 @@ int attemptLogin(const std::string& user, const std::string& pass) (short)config.getValue("port", 0)); if (ret == -1) { - state = LOGIN; + state = LOGIN_STATE; wrongLoginNotice = new OkDialog("Error", "Unable to connect to login server"); return LOGIN_NO_CONNECTION; @@ -378,7 +378,7 @@ int attemptLogin(const std::string& user, const std::string& pass) server_info[i]->port); } - state = CHAR_SERVER; + state = CHAR_SERVER_STATE; skip(msg.getLength()); ret = LOGIN_OK; @@ -409,11 +409,11 @@ int attemptLogin(const std::string& user, const std::string& pass) break; } skip(msg.getLength()); - state = LOGIN; + state = LOGIN_STATE; } else { skip(msg.getLength()); - state = LOGIN; + state = LOGIN_STATE; ret = LOGIN_UNKNOWN_ERROR; } // Todo: add other packets, also encrypted diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 5007e5f1..9e6a1b7b 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -138,14 +138,14 @@ void UpdaterWindow::action(const std::string& eventId) // Skip the updating process if (mDownloadStatus == UPDATE_COMPLETE) { - state = EXIT; + state = EXIT_STATE; } else { mDownloadStatus = UPDATE_ERROR; } } else if (eventId == "play") { - state = LOGIN; + state = LOGIN_STATE; } } @@ -201,7 +201,7 @@ int UpdaterWindow::updateProgress(void *ptr, uw->setLabel(progressString.str().c_str()); uw->setProgress(progress); - if (state != UPDATE || uw->mDownloadStatus == UPDATE_ERROR) { + if (state != UPDATE_STATE || uw->mDownloadStatus == UPDATE_ERROR) { // If the action was canceled return an error code to stop the mThread return -1; } @@ -311,7 +311,7 @@ void updateInputHandler(SDL_KeyboardEvent *keyEvent) { if (keyEvent->keysym.sym == SDLK_ESCAPE) { - state = EXIT; + state = EXIT_STATE; } } |