From e4add227d27ea87538906b856069c23da27dbdac Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 22 Jan 2012 16:23:56 +0300 Subject: Add man file for manaplustest. --- docs/Makefile.am | 3 ++- docs/manaplustest.6 | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 docs/manaplustest.6 diff --git a/docs/Makefile.am b/docs/Makefile.am index e76af80b8..91cfe1242 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,4 +1,5 @@ -man6_MANS = manaplus.6 +man6_MANS = manaplus.6 \ + manaplustest.6 EXTRA_DIST = $(man6_MANS) \ packages.txt \ diff --git a/docs/manaplustest.6 b/docs/manaplustest.6 new file mode 100644 index 000000000..754a3fb31 --- /dev/null +++ b/docs/manaplustest.6 @@ -0,0 +1,14 @@ +.TH "ManaPlusTest" "6" +.SH "NAME" +manaplustest \- ManaPlusTest: test tool for manaplus +.SH "SYNOPSIS" +\fBmanaplustest\fR +.SH "DESCRIPTION" +It start graphics and audio testing and configuring manaplus. + +.SH "AUTHOR" +This manual page was written by Andrei Karas +for the ManaPlus project. +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU General Public License, Version 2 any +later version published by the Free Software Foundation. -- cgit v1.2.3-70-g09d2 From 07ecab051e47f2a934acef615294db496520e87c Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Fri, 20 Jan 2012 20:38:54 +0100 Subject: Made the update window bigger and resizable Also made it remember its size and position. Reviewed-by: Erik Schilling Conflicts: src/gui/updaterwindow.cpp --- src/gui/updaterwindow.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index 39dde65c3..28bd8467c 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -155,6 +155,12 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost, mLoadUpdates(applyUpdates), mUpdateType(updateType) { + setWindowName("UpdaterWindow"); + setResizable(true); + setDefaultSize(450, 400, ImageRect::CENTER); + setMinWidth(320); + setMinHeight(240); + mBrowserBox = new BrowserBox; mScrollArea = new ScrollArea(mBrowserBox); mLabel = new Label(_("Connecting...")); @@ -175,14 +181,12 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost, placer(3, 5, mCancelButton); placer(4, 5, mPlayButton); - reflowLayout(450, 400); - Layout &layout = getLayout(); layout.setRowHeight(0, Layout::AUTO_SET); addKeyListener(this); - center(); + loadWindowState(); setVisible(true); mCancelButton->requestFocus(); -- cgit v1.2.3-70-g09d2 From 2e168e49be41607bd865c97e6667ba1a2db150ed Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 22 Jan 2012 20:09:45 +0300 Subject: Replace particle font to japan font if need. --- src/gui/gui.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index bd855a598..3d79f0cdf 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -105,14 +105,14 @@ Gui::Gui(Graphics *graphics): Window::setWindowContainer(guiTop); setTop(guiTop); + const std::vector langs = getLang(); + const bool isJapan = (!langs.empty() && langs[0].size() > 3 + && langs[0].substr(0, 3) == "ja_"); + // Set global font const int fontSize = config.getIntValue("fontSize"); - std::string fontFile = config.getValue("font", ""); - - std::vector langs = getLang(); - if (!langs.empty() && langs[0].size() > 3 - && langs[0].substr(0, 3) == "ja_") + if (isJapan) { fontFile = config.getValue("japanFont", ""); if (fontFile.empty()) @@ -134,6 +134,15 @@ Gui::Gui(Graphics *graphics): // Set particle font fontFile = config.getValue("particleFont", ""); + + if (isJapan) + { + fontFile = config.getValue("japanFont", ""); + if (fontFile.empty()) + fontFile = branding.getStringValue("japanFont"); + } + + if (fontFile.empty()) fontFile = branding.getStringValue("particleFont"); -- cgit v1.2.3-70-g09d2 From b78aedfe72d430d4d7efeefabcb84e866e13c01e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 22 Jan 2012 20:14:05 +0300 Subject: Add to translation word "key" from top right buttons. --- src/gui/windowmenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index e954340f8..138090075 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -299,7 +299,7 @@ void WindowMenu::mouseMoved(gcn::MouseEvent &event) if (key != KeyboardConfig::KEY_NO_VALUE) { mTextPopup->show(x + getX(), y + getY(), btn->getDescription(), - "Key: " + keyboard.getKeyValueString(key)); + strprintf(_("Key: %s"), keyboard.getKeyValueString(key).c_str())); } else { -- cgit v1.2.3-70-g09d2 From 35bce2462822ebbab20231f05a9efe689455d736 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 22 Jan 2012 20:47:09 +0300 Subject: Add tab names P and F to translation. --- src/gui/socialwindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index 3988c819c..a1a6c1cee 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -1273,10 +1273,12 @@ SocialWindow::SocialWindow() : loadWindowState(); - mPlayers = new SocialPlayersTab("P"); + // TRANSLATORS: here P is title for visible players tab in social window + mPlayers = new SocialPlayersTab(_("P")); mTabs->addTab(mPlayers, mPlayers->mScroll); - mFriends = new SocialFriendsTab("F"); + // TRANSLATORS: here F is title for friends tab in social window + mFriends = new SocialFriendsTab(_("F")); mTabs->addTab(mFriends, mFriends->mScroll); mNavigation = new SocialNavigationTab(); -- cgit v1.2.3-70-g09d2 From fcddd8c0dab52900ded0c4faafd635aa6416425f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 23 Jan 2012 02:46:39 +0300 Subject: Add false and true condition logging. --- src/CMakeLists.txt | 2 ++ src/Makefile.am | 2 ++ src/debug.h | 13 +++++++++++++ src/utils/checkutils.cpp | 39 +++++++++++++++++++++++++++++++++++++++ src/utils/checkutils.h | 30 ++++++++++++++++++++++++++++++ 5 files changed, 86 insertions(+) create mode 100644 src/utils/checkutils.cpp create mode 100644 src/utils/checkutils.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 18379fdf0..fd56c9cba 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -443,6 +443,8 @@ SET(SRCS resources/wallpaper.h utils/base64.cpp utils/base64.h + utils/checkutils.cpp + utils/checkutils.h utils/copynpaste.cpp utils/copynpaste.h utils/dtor.h diff --git a/src/Makefile.am b/src/Makefile.am index ead1224d6..6948bfcc4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -448,6 +448,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ resources/wallpaper.h \ utils/base64.cpp \ utils/base64.h \ + utils/checkutils.cpp \ + utils/checkutils.h \ utils/copynpaste.cpp \ utils/copynpaste.h \ utils/dtor.h \ diff --git a/src/debug.h b/src/debug.h index 4b3934922..64a83e51c 100644 --- a/src/debug.h +++ b/src/debug.h @@ -23,6 +23,19 @@ //#define DEBUG_JOYSTICK 1 #ifdef ENABLE_MEM_DEBUG + //define _DEBUG_NEW_EMULATE_MALLOC 1 #include "debug/debug_new.h" + +#define reportFalse(val) reportFalse1(val, __FILE__, __LINE__) +#define reportFalse1(val, file, line) reportFalseReal(val, file, line) + +#define reportTrue(val) reportTrue1(val, __FILE__, __LINE__) +#define reportTrue1(val, file, line) reportTrueReal(val, file, line) + +#else + +#define reportFalse(val) (val) +#define reportTrue(val) (val) + #endif diff --git a/src/utils/checkutils.cpp b/src/utils/checkutils.cpp new file mode 100644 index 000000000..64bb42d0c --- /dev/null +++ b/src/utils/checkutils.cpp @@ -0,0 +1,39 @@ +/* + * The ManaPlus Client + * Copyright (C) 2012 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "utils/checkutils.h" + +#include + +#include "logger.h" + +bool reportFalseReal(bool val, const char* file, unsigned line) +{ + if (!val) + logger->log("Debug: false value at %s:%u", file, line); + return val; +} + +bool reportTrueReal(bool val, const char* file, unsigned line) +{ + if (val) + logger->log("Debug: true value at %s:%u", file, line); + return val; +} diff --git a/src/utils/checkutils.h b/src/utils/checkutils.h new file mode 100644 index 000000000..6791ff7e0 --- /dev/null +++ b/src/utils/checkutils.h @@ -0,0 +1,30 @@ +/* + * The ManaPlus Client + * Copyright (C) 2012 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef UTILS_CHECKUTILS_H +#define UTILS_CHECKUTILS_H + +#include + +bool reportFalseReal(bool val, const char* file, unsigned line); + +bool reportTrueReal(bool val, const char* file, unsigned line); + +#endif // UTILS_CHECKUTILS_H -- cgit v1.2.3-70-g09d2 From 20ffb556085e519f98a96f00257ee6b837116a8e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 23 Jan 2012 14:58:38 +0300 Subject: Add some report checks to actorsprite. --- src/actorsprite.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp index c1c139bb9..c718c31f2 100644 --- a/src/actorsprite.cpp +++ b/src/actorsprite.cpp @@ -39,6 +39,8 @@ #include "resources/imageset.h" #include "resources/resourcemanager.h" +#include "utils/checkutils.h" + #include "debug.h" #define EFFECTS_FILE "effects.xml" @@ -70,7 +72,7 @@ ActorSprite::~ActorSprite() for (ActorSpriteListenerIterator iter = mActorSpriteListeners.begin(), e = mActorSpriteListeners.end(); iter != e; ++iter) { - if (*iter) + if (reportFalse(*iter)) (*iter)->actorSpriteDestroyed(*this); } } @@ -245,7 +247,7 @@ void ActorSprite::setStatusEffectBlock(int offset, Uint16 newEffects) void ActorSprite::internalTriggerEffect(int effectId, bool sfx, bool gfx) { - if (!particleEngine) + if (reportTrue(!particleEngine)) return; if (player_node) @@ -256,13 +258,13 @@ void ActorSprite::internalTriggerEffect(int effectId, bool sfx, bool gfx) EffectDescription *ed = getEffectDescription(effectId); - if (!ed) + if (reportTrue(!ed)) { logger->log1("Unknown special effect and no default recorded"); return; } - if (gfx && !ed->mGFXEffect.empty() && particleEngine) + if (gfx && !ed->mGFXEffect.empty()) { Particle *selfFX; @@ -287,7 +289,7 @@ void ActorSprite::updateStatusEffect(int index, bool newStatus) void ActorSprite::handleStatusEffect(StatusEffect *effect, int effectId) { - if (!effect) + if (reportTrue(!effect)) return; // TODO: Find out how this is meant to be used @@ -392,7 +394,7 @@ void ActorSprite::load() void ActorSprite::unload() { - if (!loaded) + if (reportTrue(!loaded)) return; cleanupTargetCursors(); @@ -476,7 +478,7 @@ void ActorSprite::cleanupTargetCursors() void ActorSprite::loadTargetCursor(const std::string &filename, int width, int height, int type, int size) { - if (size < TC_SMALL || size >= NUM_TC) + if (reportTrue(size < TC_SMALL || size >= NUM_TC)) return; ImageSet *currentImageSet = Theme::getImageSetFromTheme( -- cgit v1.2.3-70-g09d2 From 7d60bf1c04fce4ed16144aece76e594e0e217960 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 23 Jan 2012 18:26:41 +0300 Subject: Add support for request client language from server. --- src/net/tmwa/network.cpp | 2 +- src/net/tmwa/network.h | 2 +- src/net/tmwa/npchandler.cpp | 33 ++++++++++++++++++++++++++++++--- src/net/tmwa/npchandler.h | 7 +++++++ src/net/tmwa/protocol.h | 1 + src/utils/stringutils.cpp | 13 +++++++++++++ src/utils/stringutils.h | 2 ++ 7 files changed, 55 insertions(+), 5 deletions(-) diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index addc737ee..08ba1db10 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -83,7 +83,7 @@ short packet_lengths[] = -1, -1, 20, 10, 32, 9, 34, 14, 2, 6, 48, 56, -1, 4, 5, 10, // #0x0200 26, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 19, 10, 0, 0, 0, - 2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, -1, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h index 17a4f7370..c0ec6ef3c 100644 --- a/src/net/tmwa/network.h +++ b/src/net/tmwa/network.h @@ -39,7 +39,7 @@ * Protocol version, reported to the eAthena char and mapserver who can adjust * the protocol accordingly. */ -#define CLIENT_PROTOCOL_VERSION 4 +#define CLIENT_PROTOCOL_VERSION 5 #define CLIENT_TMW_PROTOCOL_VERSION 1 namespace TmwAthena diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index 574f34d55..5e305070e 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -41,7 +41,8 @@ extern Net::NpcHandler *npcHandler; namespace TmwAthena { -NpcHandler::NpcHandler() +NpcHandler::NpcHandler() : + mRequestLang(false) { static const Uint16 _messages[] = { @@ -51,6 +52,7 @@ NpcHandler::NpcHandler() SMSG_NPC_CLOSE, SMSG_NPC_INT_INPUT, SMSG_NPC_STR_INPUT, + SMSG_NPC_COMMAND, 0 }; handledMessages = _messages; @@ -59,9 +61,12 @@ NpcHandler::NpcHandler() void NpcHandler::handleMessage(Net::MessageIn &msg) { - getNpc(msg, msg.getId() == SMSG_NPC_CHOICE + int npcId = getNpc(msg, msg.getId() == SMSG_NPC_CHOICE || msg.getId() == SMSG_NPC_MESSAGE); + if (msg.getId() != SMSG_NPC_STR_INPUT) + mRequestLang = false; + switch (msg.getId()) { case SMSG_NPC_CHOICE: @@ -85,7 +90,14 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) break; case SMSG_NPC_STR_INPUT: - processNpcStrInput(msg); + if (mRequestLang) + processLangReuqest(msg, npcId); + else + processNpcStrInput(msg); + break; + + case SMSG_NPC_COMMAND: + processNpcCommand(msg); break; default: @@ -227,4 +239,19 @@ int NpcHandler::getNpc(Net::MessageIn &msg, bool haveLength) return npcId; } +void NpcHandler::processNpcCommand(Net::MessageIn &msg) +{ + const int cmd = msg.readInt16(); + if (cmd == 0) + mRequestLang = true; + else + logger->log("unknown npc command: %d", cmd); +} + +void NpcHandler::processLangReuqest(Net::MessageIn &msg A_UNUSED, int npcId) +{ + mRequestLang = false; + stringInput(npcId, getLangSimple()); +} + } // namespace TmwAthena diff --git a/src/net/tmwa/npchandler.h b/src/net/tmwa/npchandler.h index 967829ddc..648b1e5d9 100644 --- a/src/net/tmwa/npchandler.h +++ b/src/net/tmwa/npchandler.h @@ -65,6 +65,13 @@ class NpcHandler : public MessageHandler, public Ea::NpcHandler void sellItem(int beingId, int itemId, int amount); int getNpc(Net::MessageIn &msg, bool haveLength); + + void processNpcCommand(Net::MessageIn &msg); + + void processLangReuqest(Net::MessageIn &msg, int npcId); + + private: + bool mRequestLang; }; } // namespace TmwAthena diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h index 0f124cc20..ddc642101 100644 --- a/src/net/tmwa/protocol.h +++ b/src/net/tmwa/protocol.h @@ -335,5 +335,6 @@ enum #define SMSG_IGNORE_ALL_RESPONSE 0x00d2 #define CMSG_ONLINE_LIST 0x0210 #define SMSG_ONLINE_LIST 0x0211 +#define SMSG_NPC_COMMAND 0x0212 #endif diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index b855e3b04..26accbc7d 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -509,6 +509,19 @@ std::vector getLang() return langs; } +std::string getLangSimple() +{ + std::string lang = config.getValue("lang", "").c_str(); + if (lang.empty()) + { + char *lng = getenv("LANG"); + if (!lng) + return ""; + return lng; + } + return lang; +} + std::string packList(std::list &list) { std::list::const_iterator i = list.begin(); diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h index c6eb08a6c..5cb726eef 100644 --- a/src/utils/stringutils.h +++ b/src/utils/stringutils.h @@ -188,6 +188,8 @@ std::string combineDye2(std::string file, std::string dye); std::vector getLang(); +std::string getLangSimple(); + std::string packList(std::list &list); std::list unpackList(const std::string &str); -- cgit v1.2.3-70-g09d2 From bac1df3b9ac0e3327e8de812793d0a18cfd64cba Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 23 Jan 2012 20:41:50 +0300 Subject: Add moving camera commands from npc. --- src/gui/viewport.cpp | 41 +++++++++++++++++++++++++++++++++++ src/gui/viewport.h | 8 +++++++ src/net/tmwa/network.cpp | 2 +- src/net/tmwa/npchandler.cpp | 52 +++++++++++++++++++++++++++++++++++++++------ src/net/tmwa/npchandler.h | 2 +- 5 files changed, 97 insertions(+), 8 deletions(-) diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 1407415fd..f4c6c315f 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -875,3 +875,44 @@ bool Viewport::isPopupMenuVisible() { return mPopupMenu ? mPopupMenu->isVisible() : false; } + +void Viewport::moveCameraToActor(int actorId, int x, int y) +{ + if (!player_node) + return; + + Actor *actor = actorSpriteManager->findBeing(actorId); + if (!actor) + return; + Vector actorPos = actor->getPosition(); + Vector playerPos = player_node->getPosition(); + mCameraMode = 1; + mCameraRelativeX = actorPos.x - playerPos.x + x; + mCameraRelativeY = actorPos.y - playerPos.y + y; +} + +void Viewport::moveCameraToPosition(int x, int y) +{ + if (!player_node) + return; + + Vector playerPos = player_node->getPosition(); + mCameraMode = 1; + + mCameraRelativeX = x - playerPos.x; + mCameraRelativeY = y - playerPos.y; +} + +void Viewport::moveCameraRelative(int x, int y) +{ + mCameraMode = 1; + mCameraRelativeX += x; + mCameraRelativeY += y; +} + +void Viewport::returnCamera() +{ + mCameraMode = 0; + mCameraRelativeX = 0; + mCameraRelativeY = 0; +} diff --git a/src/gui/viewport.h b/src/gui/viewport.h index b25f51242..0f56e9426 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -250,6 +250,14 @@ class Viewport : public WindowContainer, public gcn::MouseListener, bool isPopupMenuVisible(); + void moveCameraToActor(int actorId, int x = 0, int y = 0); + + void moveCameraToPosition(int x, int y); + + void moveCameraRelative(int x, int y); + + void returnCamera(); + protected: friend class ActorSpriteManager; diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 08ba1db10..31329eafb 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -83,7 +83,7 @@ short packet_lengths[] = -1, -1, 20, 10, 32, 9, 34, 14, 2, 6, 48, 56, -1, 4, 5, 10, // #0x0200 26, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 19, 10, 0, 0, 0, - 2, -1, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, -1, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index 5e305070e..c395eb1b8 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -25,6 +25,7 @@ #include "localplayer.h" #include "gui/npcdialog.h" +#include "gui/viewport.h" #include "net/messagein.h" #include "net/net.h" @@ -97,7 +98,7 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) break; case SMSG_NPC_COMMAND: - processNpcCommand(msg); + processNpcCommand(msg, npcId); break; default: @@ -239,13 +240,52 @@ int NpcHandler::getNpc(Net::MessageIn &msg, bool haveLength) return npcId; } -void NpcHandler::processNpcCommand(Net::MessageIn &msg) +void NpcHandler::processNpcCommand(Net::MessageIn &msg, int npcId) { const int cmd = msg.readInt16(); - if (cmd == 0) - mRequestLang = true; - else - logger->log("unknown npc command: %d", cmd); + switch (cmd) + { + case 0: + mRequestLang = true; + break; + + case 1: + if (viewport) + viewport->moveCameraToActor(npcId); + break; + + case 2: + if (viewport) + { + const int id = msg.readInt32(); + const int x = msg.readInt16(); + const int y = msg.readInt16(); + if (!id) + viewport->moveCameraToPosition(x, y); + else + viewport->moveCameraToActor(id, x, y); + } + break; + + case 3: + if (viewport) + viewport->returnCamera(); + break; + + case 4: + if (viewport) + { + msg.readInt32(); // id + const int x = msg.readInt16(); + const int y = msg.readInt16(); + viewport->moveCameraRelative(x, y); + } + break; + + default: + logger->log("unknown npc command: %d", cmd); + break; + } } void NpcHandler::processLangReuqest(Net::MessageIn &msg A_UNUSED, int npcId) diff --git a/src/net/tmwa/npchandler.h b/src/net/tmwa/npchandler.h index 648b1e5d9..1cfcacb20 100644 --- a/src/net/tmwa/npchandler.h +++ b/src/net/tmwa/npchandler.h @@ -66,7 +66,7 @@ class NpcHandler : public MessageHandler, public Ea::NpcHandler int getNpc(Net::MessageIn &msg, bool haveLength); - void processNpcCommand(Net::MessageIn &msg); + void processNpcCommand(Net::MessageIn &msg, int npcId); void processLangReuqest(Net::MessageIn &msg, int npcId); -- cgit v1.2.3-70-g09d2 From 5e7e165bfdf4d0d726fd058b786519a04bcf62b0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 24 Jan 2012 00:19:18 +0300 Subject: Fix possible crash in server change. --- src/gui/widgets/vertcontainer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp index 305343d1a..42ae97802 100644 --- a/src/gui/widgets/vertcontainer.cpp +++ b/src/gui/widgets/vertcontainer.cpp @@ -70,6 +70,7 @@ void VertContainer::clear() mCount = 0; mNextY = 0; + mResizableWidgets.clear(); } void VertContainer::widgetResized(const gcn::Event &event A_UNUSED) -- cgit v1.2.3-70-g09d2 From 59f67ec52e74ee24e5898acd3a6bc17c3d1d36e5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 24 Jan 2012 00:24:21 +0300 Subject: Move one line in findpath map method. --- src/map.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/map.cpp b/src/map.cpp index 211504504..2209cf997 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1383,9 +1383,6 @@ Path Map::findPath(int startX, int startY, int destX, int destY, if (startX >= mWidth || startY >= mHeight) return path; - // Declare open list, a list with open tiles sorted on F cost - std::priority_queue openList; - // Return when destination not walkable if (!getWalk(destX, destY, walkmask)) return path; @@ -1397,6 +1394,9 @@ Path Map::findPath(int startX, int startY, int destX, int destY, startTile->Gcost = 0; + // Declare open list, a list with open tiles sorted on F cost + std::priority_queue openList; + // Add the start point to the open list openList.push(Location(startX, startY, startTile)); -- cgit v1.2.3-70-g09d2 From 72b1287c22c92ce607b283a37324a029d7cd53b9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 24 Jan 2012 01:08:38 +0300 Subject: Fix compilation with manaserv support. --- src/net/manaserv/loginhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net/manaserv/loginhandler.cpp b/src/net/manaserv/loginhandler.cpp index 8b8ac831f..f1c597c00 100644 --- a/src/net/manaserv/loginhandler.cpp +++ b/src/net/manaserv/loginhandler.cpp @@ -339,7 +339,7 @@ void LoginHandler::readServerInfo(Net::MessageIn &msg) return; // Set the update host when included in the message - const std::string updateHost = msg.readString(); + std::string updateHost = msg.readString(); if (!updateHost.empty()) { if (!checkPath(updateHost)) -- cgit v1.2.3-70-g09d2 From 504f93b83e6f7448c5eb3fbcb421e94b7f34f699 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 24 Jan 2012 14:27:54 +0300 Subject: Add evol and tmw branding. --- data/evol/evol.manaplus | 17 +++++++++++++++++ data/evol/images/loginwallpaper_800x600.png | Bin 0 -> 1481772 bytes data/tmw/images/loginwallpaper_800x600.png | Bin 0 -> 903998 bytes data/tmw/tmw.manaplus | 17 +++++++++++++++++ docs/example.manaplus | 2 +- 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 data/evol/evol.manaplus create mode 100644 data/evol/images/loginwallpaper_800x600.png create mode 100644 data/tmw/images/loginwallpaper_800x600.png create mode 100644 data/tmw/tmw.manaplus diff --git a/data/evol/evol.manaplus b/data/evol/evol.manaplus new file mode 100644 index 000000000..af5c1ea1e --- /dev/null +++ b/data/evol/evol.manaplus @@ -0,0 +1,17 @@ + + + + diff --git a/data/evol/images/loginwallpaper_800x600.png b/data/evol/images/loginwallpaper_800x600.png new file mode 100644 index 000000000..a1fe4f83b Binary files /dev/null and b/data/evol/images/loginwallpaper_800x600.png differ diff --git a/data/tmw/images/loginwallpaper_800x600.png b/data/tmw/images/loginwallpaper_800x600.png new file mode 100644 index 000000000..e3a6e492d Binary files /dev/null and b/data/tmw/images/loginwallpaper_800x600.png differ diff --git a/data/tmw/tmw.manaplus b/data/tmw/tmw.manaplus new file mode 100644 index 000000000..47688e1d0 --- /dev/null +++ b/data/tmw/tmw.manaplus @@ -0,0 +1,17 @@ + + + + diff --git a/docs/example.manaplus b/docs/example.manaplus index 8be9c675e..80d4c9ce3 100644 --- a/docs/example.manaplus +++ b/docs/example.manaplus @@ -9,7 +9,7 @@ filename / path as a command line parameter --> -