summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/adminhandler.cpp2
-rw-r--r--src/net/tmwa/adminhandler.h2
-rw-r--r--src/net/tmwa/beinghandler.cpp2
-rw-r--r--src/net/tmwa/beinghandler.h2
-rw-r--r--src/net/tmwa/buysellhandler.cpp4
-rw-r--r--src/net/tmwa/buysellhandler.h2
-rw-r--r--src/net/tmwa/charserverhandler.cpp6
-rw-r--r--src/net/tmwa/charserverhandler.h2
-rw-r--r--src/net/tmwa/chathandler.cpp2
-rw-r--r--src/net/tmwa/chathandler.h2
-rw-r--r--src/net/tmwa/gamehandler.cpp2
-rw-r--r--src/net/tmwa/gamehandler.h2
-rw-r--r--src/net/tmwa/generalhandler.cpp9
-rw-r--r--src/net/tmwa/generalhandler.h2
-rw-r--r--src/net/tmwa/gui/guildtab.cpp2
-rw-r--r--src/net/tmwa/gui/guildtab.h2
-rw-r--r--src/net/tmwa/gui/partytab.cpp2
-rw-r--r--src/net/tmwa/gui/partytab.h2
-rw-r--r--src/net/tmwa/guildhandler.cpp2
-rw-r--r--src/net/tmwa/guildhandler.h2
-rw-r--r--src/net/tmwa/inventoryhandler.cpp2
-rw-r--r--src/net/tmwa/inventoryhandler.h2
-rw-r--r--src/net/tmwa/itemhandler.cpp2
-rw-r--r--src/net/tmwa/itemhandler.h2
-rw-r--r--src/net/tmwa/loginhandler.cpp4
-rw-r--r--src/net/tmwa/loginhandler.h2
-rw-r--r--src/net/tmwa/messagehandler.cpp2
-rw-r--r--src/net/tmwa/messagehandler.h2
-rw-r--r--src/net/tmwa/messagein.cpp2
-rw-r--r--src/net/tmwa/messagein.h2
-rw-r--r--src/net/tmwa/messageout.cpp2
-rw-r--r--src/net/tmwa/messageout.h2
-rw-r--r--src/net/tmwa/network.cpp4
-rw-r--r--src/net/tmwa/network.h4
-rw-r--r--src/net/tmwa/npchandler.cpp85
-rw-r--r--src/net/tmwa/npchandler.h9
-rw-r--r--src/net/tmwa/playerhandler.cpp2
-rw-r--r--src/net/tmwa/playerhandler.h2
-rw-r--r--src/net/tmwa/protocol.h3
-rw-r--r--src/net/tmwa/specialhandler.cpp2
-rw-r--r--src/net/tmwa/specialhandler.h2
-rw-r--r--src/net/tmwa/tradehandler.cpp2
-rw-r--r--src/net/tmwa/tradehandler.h2
43 files changed, 142 insertions, 54 deletions
diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp
index 5d5034938..65f4d6f2c 100644
--- a/src/net/tmwa/adminhandler.cpp
+++ b/src/net/tmwa/adminhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h
index d81e2421a..4063a7fba 100644
--- a/src/net/tmwa/adminhandler.h
+++ b/src/net/tmwa/adminhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 02267e20e..627db1402 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/beinghandler.h b/src/net/tmwa/beinghandler.h
index 5e741aaa8..a45e33d36 100644
--- a/src/net/tmwa/beinghandler.h
+++ b/src/net/tmwa/beinghandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp
index 552aa1d51..629aa54f6 100644
--- a/src/net/tmwa/buysellhandler.cpp
+++ b/src/net/tmwa/buysellhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -69,7 +69,7 @@ BuySellHandler::BuySellHandler()
};
handledMessages = _messages;
buySellHandler = this;
- mBuyDialog = 0;
+ mBuyDialog = nullptr;
}
void BuySellHandler::handleMessage(Net::MessageIn &msg)
diff --git a/src/net/tmwa/buysellhandler.h b/src/net/tmwa/buysellhandler.h
index 65067f7e0..e4d07511f 100644
--- a/src/net/tmwa/buysellhandler.h
+++ b/src/net/tmwa/buysellhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 69f7165ec..717df1284 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -190,7 +190,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
msg.readInt32(); // option
msg.readInt32(); // karma
msg.readInt32(); // manner
- msg.skip(2); // unknown
+ msg.readInt16(); // character points left
character->data.mAttributes[HP] = msg.readInt16();
character->data.mAttributes[MAX_HP] = msg.readInt16();
@@ -347,7 +347,7 @@ void CharServerHandler::processCharLogin(Net::MessageIn &msg)
loginData.characterSlots = static_cast<short unsigned int>(slots);
bool version = msg.readInt8() == 1 && serverVersion > 0;
- msg.skip(17); // Unused
+ msg.skip(17); // 0 Unused
delete_all(mCharacters);
mCharacters.clear();
diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h
index f1256e409..915c6dba5 100644
--- a/src/net/tmwa/charserverhandler.h
+++ b/src/net/tmwa/charserverhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index 5af248e5c..368421285 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/chathandler.h b/src/net/tmwa/chathandler.h
index 9a88b7478..8652d297d 100644
--- a/src/net/tmwa/chathandler.h
+++ b/src/net/tmwa/chathandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp
index adaaa067b..5acf9ae6c 100644
--- a/src/net/tmwa/gamehandler.cpp
+++ b/src/net/tmwa/gamehandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/gamehandler.h b/src/net/tmwa/gamehandler.h
index ddb381058..d48fabdcc 100644
--- a/src/net/tmwa/gamehandler.h
+++ b/src/net/tmwa/gamehandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 293986bde..a666fa5f4 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -201,9 +201,9 @@ void GeneralHandler::reload()
static_cast<LoginHandler*>(mLoginHandler.get())->clearWorlds();
static_cast<CharServerHandler*>(
- mCharHandler.get())->setCharCreateDialog(0);
+ mCharHandler.get())->setCharCreateDialog(nullptr);
static_cast<CharServerHandler*>(
- mCharHandler.get())->setCharSelectDialog(0);
+ mCharHandler.get())->setCharSelectDialog(nullptr);
static_cast<PartyHandler*>(mPartyHandler.get())->reload();
}
@@ -259,6 +259,9 @@ void GeneralHandler::processEvent(Mana::Channels channel,
if (!statusWindow)
return;
+ // protection against double addition attributes.
+ statusWindow->clearAttributes();
+
statusWindow->addAttribute(STR, _("Strength"), true, "");
statusWindow->addAttribute(AGI, _("Agility"), true, "");
statusWindow->addAttribute(VIT, _("Vitality"), true, "");
diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h
index e0f29fd1d..b250ddfd4 100644
--- a/src/net/tmwa/generalhandler.h
+++ b/src/net/tmwa/generalhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/gui/guildtab.cpp b/src/net/tmwa/gui/guildtab.cpp
index 05a93bff8..af90f5c6b 100644
--- a/src/net/tmwa/gui/guildtab.cpp
+++ b/src/net/tmwa/gui/guildtab.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/gui/guildtab.h b/src/net/tmwa/gui/guildtab.h
index 21c56c4ed..351dadfd6 100644
--- a/src/net/tmwa/gui/guildtab.h
+++ b/src/net/tmwa/gui/guildtab.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/gui/partytab.cpp b/src/net/tmwa/gui/partytab.cpp
index 373fcca31..d0738e79c 100644
--- a/src/net/tmwa/gui/partytab.cpp
+++ b/src/net/tmwa/gui/partytab.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/gui/partytab.h b/src/net/tmwa/gui/partytab.h
index d865995f7..0bdc11372 100644
--- a/src/net/tmwa/gui/partytab.h
+++ b/src/net/tmwa/gui/partytab.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp
index 7ea97eb49..5e2ac528f 100644
--- a/src/net/tmwa/guildhandler.cpp
+++ b/src/net/tmwa/guildhandler.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/guildhandler.h b/src/net/tmwa/guildhandler.h
index d8d291bdd..e1d2d7c29 100644
--- a/src/net/tmwa/guildhandler.h
+++ b/src/net/tmwa/guildhandler.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index 14a15e59f..7fa26f5ed 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h
index d924e8713..d2ecc4b6d 100644
--- a/src/net/tmwa/inventoryhandler.h
+++ b/src/net/tmwa/inventoryhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/itemhandler.cpp b/src/net/tmwa/itemhandler.cpp
index ee33cd230..ce03044c7 100644
--- a/src/net/tmwa/itemhandler.cpp
+++ b/src/net/tmwa/itemhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/itemhandler.h b/src/net/tmwa/itemhandler.h
index 3e948547e..0f2459fbf 100644
--- a/src/net/tmwa/itemhandler.h
+++ b/src/net/tmwa/itemhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp
index bdc944d63..3b53bbf7c 100644
--- a/src/net/tmwa/loginhandler.cpp
+++ b/src/net/tmwa/loginhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -154,7 +154,7 @@ void LoginHandler::processServerVersion(Net::MessageIn &msg)
{
unsigned int options = msg.readInt8();
mRegistrationEnabled = options;
- msg.skip(2);
+ msg.skip(2); // 0 unused
serverVersion = msg.readInt8();
}
else
diff --git a/src/net/tmwa/loginhandler.h b/src/net/tmwa/loginhandler.h
index c13c882a7..e2b8beec7 100644
--- a/src/net/tmwa/loginhandler.h
+++ b/src/net/tmwa/loginhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/messagehandler.cpp b/src/net/tmwa/messagehandler.cpp
index 830b3bc4f..d4b3c03a4 100644
--- a/src/net/tmwa/messagehandler.cpp
+++ b/src/net/tmwa/messagehandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/messagehandler.h b/src/net/tmwa/messagehandler.h
index fef9e2004..7607e5c80 100644
--- a/src/net/tmwa/messagehandler.h
+++ b/src/net/tmwa/messagehandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/messagein.cpp b/src/net/tmwa/messagein.cpp
index 5a9d39211..b8bba342f 100644
--- a/src/net/tmwa/messagein.cpp
+++ b/src/net/tmwa/messagein.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/messagein.h b/src/net/tmwa/messagein.h
index bf8debf54..29b17d8ba 100644
--- a/src/net/tmwa/messagein.h
+++ b/src/net/tmwa/messagein.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp
index d5d9d82f9..790611381 100644
--- a/src/net/tmwa/messageout.cpp
+++ b/src/net/tmwa/messageout.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/messageout.h b/src/net/tmwa/messageout.h
index d97851d4a..5d1e911b6 100644
--- a/src/net/tmwa/messageout.h
+++ b/src/net/tmwa/messageout.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index db006c5c0..31329eafb 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -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, 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/network.h b/src/net/tmwa/network.h
index 757358c25..c0ec6ef3c 100644
--- a/src/net/tmwa/network.h
+++ b/src/net/tmwa/network.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -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 6b6ffcbb6..d86c64a96 100644
--- a/src/net/tmwa/npchandler.cpp
+++ b/src/net/tmwa/npchandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -25,6 +25,7 @@
#include "localplayer.h"
#include "gui/npcdialog.h"
+#include "gui/viewport.h"
#include "net/messagein.h"
#include "net/net.h"
@@ -41,7 +42,8 @@ extern Net::NpcHandler *npcHandler;
namespace TmwAthena
{
-NpcHandler::NpcHandler()
+NpcHandler::NpcHandler() :
+ mRequestLang(false)
{
static const Uint16 _messages[] =
{
@@ -51,6 +53,7 @@ NpcHandler::NpcHandler()
SMSG_NPC_CLOSE,
SMSG_NPC_INT_INPUT,
SMSG_NPC_STR_INPUT,
+ SMSG_NPC_COMMAND,
0
};
handledMessages = _messages;
@@ -59,9 +62,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 +91,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, npcId);
break;
default:
@@ -118,6 +131,8 @@ void NpcHandler::closeDialog(int npcId)
{
if ((*it).second.dialog)
(*it).second.dialog->close();
+ if ((*it).second.dialog == mDialog)
+ mDialog = nullptr;
mNpcDialogs.erase(it);
}
}
@@ -213,6 +228,7 @@ int NpcHandler::getNpc(Net::MessageIn &msg, bool haveLength)
else
{
mDialog = new NpcDialog(npcId);
+ mDialog->saveCamera();
if (player_node)
player_node->stopWalking(false);
Wrapper wrap;
@@ -222,9 +238,70 @@ int NpcHandler::getNpc(Net::MessageIn &msg, bool haveLength)
}
else
{
+ if (mDialog && mDialog != diag->second.dialog)
+ mDialog->restoreCamera();
mDialog = diag->second.dialog;
+ if (mDialog)
+ mDialog->saveCamera();
}
return npcId;
}
+void NpcHandler::processNpcCommand(Net::MessageIn &msg, int npcId)
+{
+ const int cmd = msg.readInt16();
+ 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;
+ case 5:
+ closeDialog(npcId);
+ break;
+
+ default:
+ logger->log("unknown npc command: %d", cmd);
+ break;
+ }
+}
+
+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 548346205..1cfcacb20 100644
--- a/src/net/tmwa/npchandler.h
+++ b/src/net/tmwa/npchandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -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, int npcId);
+
+ void processLangReuqest(Net::MessageIn &msg, int npcId);
+
+ private:
+ bool mRequestLang;
};
} // namespace TmwAthena
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index 4534cca8b..d5f0641eb 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/playerhandler.h b/src/net/tmwa/playerhandler.h
index 898bdae3d..0fa524d51 100644
--- a/src/net/tmwa/playerhandler.h
+++ b/src/net/tmwa/playerhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h
index 37f036ca8..ddc642101 100644
--- a/src/net/tmwa/protocol.h
+++ b/src/net/tmwa/protocol.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -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/net/tmwa/specialhandler.cpp b/src/net/tmwa/specialhandler.cpp
index c75d954dc..9fa7b6dfa 100644
--- a/src/net/tmwa/specialhandler.cpp
+++ b/src/net/tmwa/specialhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/specialhandler.h b/src/net/tmwa/specialhandler.h
index 50bf31c0b..f17ef4c44 100644
--- a/src/net/tmwa/specialhandler.h
+++ b/src/net/tmwa/specialhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp
index 2280079ea..1a44e4956 100644
--- a/src/net/tmwa/tradehandler.cpp
+++ b/src/net/tmwa/tradehandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/tradehandler.h b/src/net/tmwa/tradehandler.h
index 3a4c8c1fc..b5a06ef6a 100644
--- a/src/net/tmwa/tradehandler.h
+++ b/src/net/tmwa/tradehandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*