summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-09-26 19:38:02 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-09-26 19:38:02 +0000
commit5f078fc572eb28d9a62a288e7f708d66ec0fc910 (patch)
treea8f53c9a5bfe49c0382ce57968c2842ba1ea480c
parent1e67cb01df788e02c7b248bb22b144d3d8b76cef (diff)
downloadmana-5f078fc572eb28d9a62a288e7f708d66ec0fc910.tar.gz
mana-5f078fc572eb28d9a62a288e7f708d66ec0fc910.tar.bz2
mana-5f078fc572eb28d9a62a288e7f708d66ec0fc910.tar.xz
mana-5f078fc572eb28d9a62a288e7f708d66ec0fc910.zip
Now error message is displayed properly when the map server is offline.
-rw-r--r--ChangeLog3
-rw-r--r--src/gui/char_select.cpp18
-rw-r--r--src/gui/skill.cpp1
-rw-r--r--src/main.cpp3
-rw-r--r--src/main.h3
-rw-r--r--src/net/network.cpp2
6 files changed, 20 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 16cb5530..58e9a825 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@
src/gui/updatewindow.cpp, src/main.cpp, src/main.h,
src/net/network.cpp: Added a nicer handling of when you get disconnected
from the server.
+ * src/gui/char_select.cpp, src/gui/skill.cpp, src/main.cpp, src/main.h,
+ src/net/network.cpp: Now error message is displayed properly when the map
+ server is offline.
2005-09-25 Bjørn Lindeijer <bjorn@lindeijer.nl>
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index fd0ccdc9..f6fa3a1a 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -252,14 +252,13 @@ void CharSelectDialog::serverCharSelect()
{
switch (msg.readByte()) {
case 0:
- new OkDialog(this, "Error", "Access denied");
+ errorMessage = "Access denied";
break;
case 1:
- new OkDialog(this, "Error", "Cannot use this ID");
+ errorMessage = "Cannot use this ID";
break;
default:
- new OkDialog(this, "Error",
- "Unknown failure to select character");
+ errorMessage = "Unknown failure to select character");
break;
}
skip(msg.getLength());
@@ -267,18 +266,21 @@ void CharSelectDialog::serverCharSelect()
else if (msg.getId() == 0x0081)
{
switch (msg.readByte()) {
+ case 1:
+ errorMessage = "Map server offline";
+ break;
case 3:
- new OkDialog(this, "Error", "Speed hack detected");
+ errorMessage = "Speed hack detected";
break;
case 8:
- new OkDialog(this, "Error", "Duplicated login");
+ errorMessage = "Duplicated login";
break;
default:
- new OkDialog(this, "Error", "Unkown error with 0x0081");
+ errorMessage = "Unkown error with 0x0081";
break;
}
close_session();
- state = LOGIN_STATE;
+ state = ERROR_STATE;
}
// Todo: add other packets
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index 58eea2e7..72e89d55 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -186,7 +186,6 @@ bool SkillDialog::hasSkill(int id)
void SkillDialog::addSkill(int id, int lvl, int mp)
{
- printf("%i\n", id);
SKILL *tmp = new SKILL();
tmp->id = id;
tmp->lv = lvl;
diff --git a/src/main.cpp b/src/main.cpp
index 734af6dd..a6fef07c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -75,6 +75,7 @@ Graphics *graphics;
int map_address, char_ID;
short map_port;
unsigned char state;
+std::string errorMessage;
unsigned char screen_mode;
volatile int framesToDraw = 0;
@@ -507,7 +508,7 @@ int main(int argc, char *argv[])
break;
case ERROR_STATE:
logger->log("State: ERROR");
- currentDialog = new ErrorDialog("You got disconnected from the server");
+ currentDialog = new ErrorDialog(errorMessage);
inputHandler = errorInputHandler;
break;
default:
diff --git a/src/main.h b/src/main.h
index 5f404b10..b8d2a052 100644
--- a/src/main.h
+++ b/src/main.h
@@ -24,6 +24,8 @@
#ifndef _TMW_MAIN_H
#define _TMW_MAIN_H
+#include <string>
+
class Image;
class Sound;
@@ -57,6 +59,7 @@ extern short map_port;
extern int account_ID, session_ID1, session_ID2;
extern char sex, n_server, n_character;
extern unsigned char state;
+extern std::string errorMessage;
extern Sound sound;
#endif
diff --git a/src/net/network.cpp b/src/net/network.cpp
index 2d48fc8c..6f852529 100644
--- a/src/net/network.cpp
+++ b/src/net/network.cpp
@@ -217,6 +217,7 @@ void flush()
if (ret <= 0)
{
logger->log("Error in SDLNet_TCP_Recv(): %s", SDLNet_GetError());
+ errorMessage = "You got disconnected from server";
state = ERROR_STATE;
return;
}
@@ -232,6 +233,7 @@ void flush()
if (ret < (int)out_size)
{
logger->log("Error in SDLNet_TCP_Send(): %s", SDLNet_GetError());
+ errorMessage = "You got disconnected from server";
state = ERROR_STATE;
return;
}