From a8bf33d851c88107a4673ef6fc97b303efb537d8 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Tue, 27 Jan 2009 04:01:50 +0100 Subject: Enabled gettext translations on windows. --- src/main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 0291fd86..051840f1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -219,7 +219,7 @@ void init_engine(const Options &options) GetLastError() != ERROR_ALREADY_EXISTS) #elif defined __APPLE__ // Use Application Directory instead of .tmw - homeDir = std::string(PHYSFS_getUserDir()) + + homeDir = std::string(PHYSFS_getUserDir()) + "/Library/Application Support/The Mana World"; if ((mkdir(homeDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) && (errno != EEXIST)) @@ -672,9 +672,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 -- cgit v1.2.3-70-g09d2 From 61707d27740d0e429d8533606789f1e829752b0f Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Wed, 28 Jan 2009 15:16:12 +0000 Subject: Fix handling of packet 0x81 --- src/net/charserverhandler.cpp | 50 +++++++++++++++++++++++++------------------ src/net/loginhandler.cpp | 32 +++++++++++++++++++++++---- src/net/maploginhandler.cpp | 26 ++++++++++++++++------ src/net/protocol.h | 1 + 4 files changed, 78 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/net/charserverhandler.cpp b/src/net/charserverhandler.cpp index cfa52c38..f00615d7 100644 --- a/src/net/charserverhandler.cpp +++ b/src/net/charserverhandler.cpp @@ -38,6 +38,7 @@ CharServerHandler::CharServerHandler(): mCharCreateDialog(0) { static const Uint16 _messages[] = { + SMSG_CONNECTION_PROBLEM, 0x006b, 0x006c, 0x006d, @@ -45,7 +46,6 @@ CharServerHandler::CharServerHandler(): 0x006f, 0x0070, 0x0071, - 0x0081, 0 }; handledMessages = _messages; @@ -53,13 +53,40 @@ CharServerHandler::CharServerHandler(): void CharServerHandler::handleMessage(MessageIn *msg) { - int slot; + int slot, 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: // Skip length word and an additional mysterious 20 bytes msg->skip(2 + 20); @@ -154,25 +181,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 646c5f3c..c9eec9f4 100644 --- a/src/net/loginhandler.cpp +++ b/src/net/loginhandler.cpp @@ -35,6 +35,7 @@ extern SERVER_INFO **server_info; LoginHandler::LoginHandler() { static const Uint16 _messages[] = { + SMSG_CONNECTION_PROBLEM, SMSG_UPDATE_HOST, 0x0069, 0x006a, @@ -45,9 +46,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; @@ -91,10 +115,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 0d349a6d..68652c79 100644 --- a/src/net/maploginhandler.cpp +++ b/src/net/maploginhandler.cpp @@ -31,8 +31,8 @@ MapLoginHandler::MapLoginHandler() { static const Uint16 _messages[] = { + SMSG_CONNECTION_PROBLEM, SMSG_LOGIN_SUCCESS, - 0x0081, 0 }; handledMessages = _messages; @@ -40,10 +40,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); @@ -52,10 +71,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 b70834c6..3bdeb429 100644 --- a/src/net/protocol.h +++ b/src/net/protocol.h @@ -24,6 +24,7 @@ // Packets from server to client #define SMSG_LOGIN_SUCCESS 0x0073 /**< Contains starting location */ +#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 -- cgit v1.2.3-70-g09d2 From 6f3477baa73cbc08e4ee48e0839d709cb14602cb Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Thu, 29 Jan 2009 15:33:16 +0100 Subject: Made more strings translatable (patch by Kess) --- src/gui/status.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gui/status.cpp b/src/gui/status.cpp index b95a1eb8..39a298f7 100644 --- a/src/gui/status.cpp +++ b/src/gui/status.cpp @@ -52,19 +52,19 @@ StatusWindow::StatusWindow(LocalPlayer *player): mGpLabel = new gcn::Label(strprintf(_("Job: %d"), 0)); mJobLvlLabel = new gcn::Label(strprintf(_("Money: %d GP"), 0)); - mHpLabel = new gcn::Label("HP:"); + mHpLabel = new gcn::Label(_("HP:")); mHpBar = new ProgressBar(1.0f, 80, 15, 0, 171, 34); mHpValueLabel = new gcn::Label; - mXpLabel = new gcn::Label("Exp:"); + mXpLabel = new gcn::Label(_("Exp:")); mXpBar = new ProgressBar(1.0f, 80, 15, 143, 192, 211); mXpValueLabel = new gcn::Label; - mMpLabel = new gcn::Label("MP:"); + mMpLabel = new gcn::Label(_("MP:")); mMpBar = new ProgressBar(1.0f, 80, 15, 26, 102, 230); mMpValueLabel = new gcn::Label; - mJobXpLabel = new gcn::Label("Job:"); + mJobXpLabel = new gcn::Label(_("Job:")); mJobXpBar = new ProgressBar(1.0f, 80, 15, 220, 135, 203); mJobValueLabel = new gcn::Label; @@ -133,8 +133,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; @@ -402,3 +405,4 @@ void StatusWindow::action(const gcn::ActionEvent &event) } } } + -- cgit v1.2.3-70-g09d2 From d2876ad85935c5d0b181d050bd4c19a4682123b1 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Thu, 5 Feb 2009 09:31:19 +0100 Subject: Fixed inability to chat while talking to NPCs These checks were meant to allow the keyboard to be used to close the NPC dialogs, however in this form they prevent the user from being able to chat while talking to NPCs. Better make sure the Ok button is focused, so you can use Space to close the NPC dialog. --- src/game.cpp | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'src') diff --git a/src/game.cpp b/src/game.cpp index 1c4bb538..2ba8f7d7 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -627,26 +627,6 @@ void Game::handleInput() { 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 { -- cgit v1.2.3-70-g09d2