summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp12
-rw-r--r--src/gui/status.cpp4
-rw-r--r--src/main.cpp5
-rw-r--r--src/net/charserverhandler.cpp49
-rw-r--r--src/net/loginhandler.cpp34
-rw-r--r--src/net/maploginhandler.cpp26
-rw-r--r--src/net/protocol.h1
7 files changed, 87 insertions, 44 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 3b943f6b..03d68a80 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -613,18 +613,6 @@ void Game::handleInput()
// Close the config window, cancelling changes if opened
else if (setupWindow->isVisible())
setupWindow->action(gcn::ActionEvent(NULL, "cancel"));
- // Submits the text and proceeds to the next dialog
- else if (npcStringDialog->isVisible())
- npcStringDialog->action(gcn::ActionEvent(NULL, "ok"));
- // Proceed to the next dialog option, or close the window
- else if (npcTextDialog->isVisible())
- npcTextDialog->action(gcn::ActionEvent(NULL, "ok"));
- // Choose the currently highlighted dialogue option
- else if (npcListDialog->isVisible())
- npcListDialog->action(gcn::ActionEvent(NULL, "ok"));
- // Submits the text and proceeds to the next dialog
- else if (npcIntegerDialog->isVisible())
- npcIntegerDialog->action(gcn::ActionEvent(NULL, "ok"));
// Else, open the chat edit box
else
{
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index bd6048f3..69f6baa1 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -131,8 +131,11 @@ StatusWindow::StatusWindow(LocalPlayer *player):
mStatsDefenseLabel= new gcn::Label(_("Defense:"));
mStatsMagicAttackLabel = new gcn::Label(_("M.Attack:"));
mStatsMagicDefenseLabel = new gcn::Label(_("M.Defense:"));
+ // Gettext flag for next line: xgettext:no-c-format
mStatsAccuracyLabel = new gcn::Label(_("% Accuracy:"));
+ // Gettext flag for next line: xgettext:no-c-format
mStatsEvadeLabel = new gcn::Label(_("% Evade:"));
+ // Gettext flag for next line: xgettext:no-c-format
mStatsReflexLabel = new gcn::Label(_("% Reflex:"));
mStatsAttackPoints = new gcn::Label;
@@ -400,3 +403,4 @@ void StatusWindow::action(const gcn::ActionEvent &event)
}
}
}
+
diff --git a/src/main.cpp b/src/main.cpp
index 6866093f..fb5486d5 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -739,9 +739,12 @@ int main(int argc, char *argv[])
#if ENABLE_NLS
#ifdef WIN32
putenv(("LANG=" + std::string(_nl_locale_name_default())).c_str());
+ // mingw doesn't like LOCALEDIR to be defined for some reason
+ bindtextdomain("tmw", "translations/");
+#else
+ bindtextdomain("tmw", LOCALEDIR);
#endif
setlocale(LC_MESSAGES, "");
- bindtextdomain("tmw", LOCALEDIR);
bind_textdomain_codeset("tmw", "UTF-8");
textdomain("tmw");
#endif
diff --git a/src/net/charserverhandler.cpp b/src/net/charserverhandler.cpp
index 909100e5..b04fb94a 100644
--- a/src/net/charserverhandler.cpp
+++ b/src/net/charserverhandler.cpp
@@ -43,6 +43,7 @@ CharServerHandler::CharServerHandler():
mCharCreateDialog(0)
{
static const Uint16 _messages[] = {
+ SMSG_CONNECTION_PROBLEM,
0x006b,
0x006c,
0x006d,
@@ -50,7 +51,6 @@ CharServerHandler::CharServerHandler():
0x006f,
0x0070,
0x0071,
- 0x0081,
0
};
handledMessages = _messages;
@@ -60,12 +60,40 @@ void CharServerHandler::handleMessage(MessageIn *msg)
{
int slot;
int flags;
+ int code;
LocalPlayer *tempPlayer;
logger->log("CharServerHandler: Packet ID: %x, Length: %d",
msg->getId(), msg->getLength());
switch (msg->getId())
{
+ case SMSG_CONNECTION_PROBLEM:
+ code = msg->readInt8();
+ logger->log("Connection problem: %i", code);
+
+ switch (code) {
+ case 0:
+ errorMessage = "Authentication failed";
+ break;
+ case 1:
+ errorMessage = "Map server(s) offline";
+ break;
+ case 2:
+ errorMessage = "This account is already logged in";
+ break;
+ case 3:
+ errorMessage = "Speed hack detected";
+ break;
+ case 8:
+ errorMessage = "Duplicated login";
+ break;
+ default:
+ errorMessage = "Unknown connection error";
+ break;
+ }
+ state = ERROR_STATE;
+ break;
+
case 0x006b:
msg->skip(2); // Length word
flags = msg->readInt32(); // Aethyra extensions flags
@@ -165,25 +193,6 @@ void CharServerHandler::handleMessage(MessageIn *msg)
mCharInfo->select(slot);
state = CONNECTING_STATE;
break;
-
- case 0x0081:
- switch (msg->readInt8()) {
- case 1:
- errorMessage = "Map server offline";
- break;
- case 3:
- errorMessage = "Speed hack detected";
- break;
- case 8:
- errorMessage = "Duplicated login";
- break;
- default:
- errorMessage = "Unknown error with 0x0081";
- break;
- }
- mCharInfo->unlock();
- state = ERROR_STATE;
- break;
}
}
diff --git a/src/net/loginhandler.cpp b/src/net/loginhandler.cpp
index f240618d..db601214 100644
--- a/src/net/loginhandler.cpp
+++ b/src/net/loginhandler.cpp
@@ -34,7 +34,8 @@ extern SERVER_INFO **server_info;
LoginHandler::LoginHandler()
{
static const Uint16 _messages[] = {
- 0x0063,
+ SMSG_CONNECTION_PROBLEM,
+ SMSG_UPDATE_HOST,
0x0069,
0x006a,
0
@@ -44,9 +45,32 @@ LoginHandler::LoginHandler()
void LoginHandler::handleMessage(MessageIn *msg)
{
+ int code;
+
switch (msg->getId())
{
- case 0x0063:
+ case SMSG_CONNECTION_PROBLEM:
+ code = msg->readInt8();
+ logger->log("Connection problem: %i", code);
+
+ switch (code) {
+ case 0:
+ errorMessage = "Authentication failed";
+ break;
+ case 1:
+ errorMessage = "No servers available";
+ break;
+ case 2:
+ errorMessage = "This account is already logged in";
+ break;
+ default:
+ errorMessage = "Unknown connection error";
+ break;
+ }
+ state = ERROR_STATE;
+ break;
+
+ case SMSG_UPDATE_HOST:
int len;
len = msg->readInt16() - 4;
@@ -90,10 +114,10 @@ void LoginHandler::handleMessage(MessageIn *msg)
break;
case 0x006a:
- int loginError = msg->readInt8();
- logger->log("Login::error code: %i", loginError);
+ code = msg->readInt8();
+ logger->log("Login::error code: %i", code);
- switch (loginError) {
+ switch (code) {
case 0:
errorMessage = "Unregistered ID";
break;
diff --git a/src/net/maploginhandler.cpp b/src/net/maploginhandler.cpp
index 1b0919fa..b851117e 100644
--- a/src/net/maploginhandler.cpp
+++ b/src/net/maploginhandler.cpp
@@ -30,8 +30,8 @@
MapLoginHandler::MapLoginHandler()
{
static const Uint16 _messages[] = {
+ SMSG_CONNECTION_PROBLEM,
SMSG_LOGIN_SUCCESS,
- 0x0081,
0
};
handledMessages = _messages;
@@ -39,10 +39,29 @@ MapLoginHandler::MapLoginHandler()
void MapLoginHandler::handleMessage(MessageIn *msg)
{
+ int code;
unsigned char direction;
switch (msg->getId())
{
+ case SMSG_CONNECTION_PROBLEM:
+ code = msg->readInt8();
+ logger->log("Connection problem: %i", code);
+
+ switch (code) {
+ case 0:
+ errorMessage = "Authentication failed";
+ break;
+ case 2:
+ errorMessage = "This account is already logged in";
+ break;
+ default:
+ errorMessage = "Unknown connection error";
+ break;
+ }
+ state = ERROR_STATE;
+ break;
+
case SMSG_LOGIN_SUCCESS:
msg->readInt32(); // server tick
msg->readCoordinates(player_node->mX, player_node->mY, direction);
@@ -51,10 +70,5 @@ void MapLoginHandler::handleMessage(MessageIn *msg)
player_node->mX, player_node->mY, direction);
state = GAME_STATE;
break;
-
- case 0x0081:
- logger->log("Warning: Map server D/C");
- state = ERROR_STATE;
- break;
}
}
diff --git a/src/net/protocol.h b/src/net/protocol.h
index fd08c45d..e9053451 100644
--- a/src/net/protocol.h
+++ b/src/net/protocol.h
@@ -27,6 +27,7 @@
*********************************/
#define SMSG_LOGIN_SUCCESS 0x0073 /**< Contains starting location */
#define SMSG_SERVER_PING 0x007f /**< Contains server tick */
+#define SMSG_CONNECTION_PROBLEM 0x0081
#define SMSG_UPDATE_HOST 0x0063 /**< Custom update host packet */
#define SMSG_PLAYER_UPDATE_1 0x01d8
#define SMSG_PLAYER_UPDATE_2 0x01d9