summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-05-07 07:51:35 -0600
committerJared Adams <jaxad0127@gmail.com>2009-05-07 07:52:38 -0600
commitb6580a8e547732ec1194afe218c030b8230659e2 (patch)
treea1c2ae8454db1f91274c5c13e3d67d81343532c4
parent67f53660db85c2f325472701517e04c446ec8ed4 (diff)
downloadmana-b6580a8e547732ec1194afe218c030b8230659e2.tar.gz
mana-b6580a8e547732ec1194afe218c030b8230659e2.tar.bz2
mana-b6580a8e547732ec1194afe218c030b8230659e2.tar.xz
mana-b6580a8e547732ec1194afe218c030b8230659e2.zip
Fix handling of error messages in the game state
Also make sure an appropirate message gets shown on duplicated login.
-rw-r--r--src/game.cpp12
-rw-r--r--src/main.cpp5
-rw-r--r--src/net/ea/generalhandler.cpp10
3 files changed, 18 insertions, 9 deletions
diff --git a/src/game.cpp b/src/game.cpp
index b8c0b73d..d640815d 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -34,6 +34,7 @@
#include "keyboardconfig.h"
#include "localplayer.h"
#include "log.h"
+#include "main.h"
#include "map.h"
#include "npc.h"
#include "particle.h"
@@ -474,12 +475,15 @@ void Game::logic()
Net::getGeneralHandler()->flushNetwork();
if (!Net::getGeneralHandler()->isNetworkConnected())
{
+ if (state != STATE_ERROR)
+ {
+ errorMessage = _("The connection to the server was lost, "
+ "the program will now quit");
+ }
+
if (!disconnectedDialog)
{
- disconnectedDialog = new OkDialog(_("Network Error"),
- _("The connection to the "
- "server was lost, the "
- "program will now quit"));
+ disconnectedDialog = new OkDialog(_("Network Error"), errorMessage);
disconnectedDialog->addActionListener(&exitListener);
disconnectedDialog->requestMoveToTop();
}
diff --git a/src/main.cpp b/src/main.cpp
index 0fa4044a..50ae193b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1011,7 +1011,7 @@ int main(int argc, char *argv[])
Net::getGeneralHandler()->tick();
- if (progressBar->isVisible())
+ if (progressBar && progressBar->isVisible())
{
progressBar->setProgress(progressBar->getProgress() + 0.005f);
if (progressBar->getProgress() == 1.0f)
@@ -1470,7 +1470,8 @@ int main(int argc, char *argv[])
game = new Game;
game->logic();
delete game;
- state = STATE_EXIT;
+ if (state != STATE_ERROR)
+ state = STATE_EXIT;
break;
case STATE_UPDATE:
diff --git a/src/net/ea/generalhandler.cpp b/src/net/ea/generalhandler.cpp
index 3d1b4536..b8d75671 100644
--- a/src/net/ea/generalhandler.cpp
+++ b/src/net/ea/generalhandler.cpp
@@ -128,7 +128,11 @@ void GeneralHandler::handleMessage(MessageIn &msg)
errorMessage = _("No servers available");
break;
case 2:
- errorMessage = _("This account is already logged in");
+ if (state == STATE_GAME)
+ errorMessage = _("Someone else is trying to use this "
+ "account");
+ else
+ errorMessage = _("This account is already logged in");
break;
case 3:
errorMessage = _("Speed hack detected");
@@ -191,12 +195,12 @@ void GeneralHandler::tick()
if (mNetwork->getState() == Network::NET_ERROR)
{
- state = STATE_ERROR;
-
if (!mNetwork->getError().empty())
errorMessage = mNetwork->getError();
else
errorMessage = _("Got disconnected from server!");
+
+ state = STATE_ERROR;
}
}