summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-01-10 20:29:58 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-01-11 22:28:13 +0100
commit3c828c4c7448353858a80d1c60e47d125ed3d3e4 (patch)
tree1ba38fa3f7b0a4536c0a005ab3fbbde682a34d7f
parentd65dfcfa04a622effcd4cebdfaa5e713ca7627d8 (diff)
downloadmanaserv-3c828c4c7448353858a80d1c60e47d125ed3d3e4.tar.gz
manaserv-3c828c4c7448353858a80d1c60e47d125ed3d3e4.tar.bz2
manaserv-3c828c4c7448353858a80d1c60e47d125ed3d3e4.tar.xz
manaserv-3c828c4c7448353858a80d1c60e47d125ed3d3e4.zip
Made the servers report their protocol version.
As the protocol version isn't something the maintainers should set, I removed the net_clientVersion irrelevant option, replaced by the corresponding define PROTOCOL_VERSION in the manaserv_protocol.h file. A corresponding change in the client will be made. N.B.: Now, the Enet version is also reported in the log. Reviewed-by: Jaxad.
-rw-r--r--src/account-server/accounthandler.cpp5
-rw-r--r--src/account-server/main-account.cpp4
-rw-r--r--src/game-server/being.cpp4
-rw-r--r--src/game-server/main-game.cpp3
-rw-r--r--src/manaserv_protocol.h2
5 files changed, 13 insertions, 5 deletions
diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp
index 9948f1ea..5cb71c4d 100644
--- a/src/account-server/accounthandler.cpp
+++ b/src/account-server/accounthandler.cpp
@@ -318,7 +318,7 @@ void AccountHandler::handleLoginMessage(AccountClient &client, MessageIn &msg)
const int clientVersion = msg.readInt32();
- if (clientVersion < Configuration::getValue("net_clientVersion", 0))
+ if (clientVersion < PROTOCOL_VERSION)
{
reply.writeInt8(LOGIN_INVALID_VERSION);
client.send(reply);
@@ -458,7 +458,6 @@ void AccountHandler::handleRegisterMessage(AccountClient &client,
std::string password = msg.readString();
std::string email = msg.readString();
std::string captcha = msg.readString();
- int minClientVersion = Configuration::getValue("net_clientVersion", 0);
unsigned minNameLength = Configuration::getValue("account_minNameLength", 4);
unsigned maxNameLength = Configuration::getValue("account_maxNameLength", 15);
@@ -472,7 +471,7 @@ void AccountHandler::handleRegisterMessage(AccountClient &client,
{
reply.writeInt8(ERRMSG_FAILURE);
}
- else if (clientVersion < minClientVersion)
+ else if (clientVersion < PROTOCOL_VERSION)
{
reply.writeInt8(REGISTER_INVALID_VERSION);
}
diff --git a/src/account-server/main-account.cpp b/src/account-server/main-account.cpp
index a0e935dd..ae24ee6d 100644
--- a/src/account-server/main-account.cpp
+++ b/src/account-server/main-account.cpp
@@ -40,6 +40,7 @@
#include "utils/stringfilter.h"
#include "utils/timer.h"
#include "defines.h"
+#include "manaserv_protocol.h"
#include <cstdlib>
#include <getopt.h>
@@ -361,6 +362,9 @@ int main(int argc, char *argv[])
#else
LOG_INFO("The Mana Account+Chat Server (unknown version)");
#endif
+ LOG_INFO("Manaserv Protocol version " << ManaServ::PROTOCOL_VERSION
+ << ", " << "Enet version " << ENET_VERSION_MAJOR << "."
+ << ENET_VERSION_MINOR << "." << ENET_VERSION_PATCH);
if (!options.verbosityChanged)
options.verbosity = static_cast<Logger::Level>(
diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp
index 567e19a3..f707198b 100644
--- a/src/game-server/being.cpp
+++ b/src/game-server/being.cpp
@@ -266,7 +266,7 @@ void Being::updateDirection(const Point &currentPos, const Point &destPos)
{
// Compute tan of the angle
if ((currentPos.y - destPos.y) / (currentPos.x - destPos.x) < 1)
- // The angle is less than 45°, we look to the right
+ // The angle is less than 45°, we look to the left
setDirection(LEFT);
else
setDirection(UP);
@@ -276,7 +276,7 @@ void Being::updateDirection(const Point &currentPos, const Point &destPos)
{
// Compute tan of the angle
if ((destPos.y - currentPos.y) / (currentPos.x - destPos.x) < 1)
- // The angle is less than 45°, we look to the right
+ // The angle is less than 45°, we look to the left
setDirection(LEFT);
else
setDirection(DOWN);
diff --git a/src/game-server/main-game.cpp b/src/game-server/main-game.cpp
index 182e4593..682148b3 100644
--- a/src/game-server/main-game.cpp
+++ b/src/game-server/main-game.cpp
@@ -368,6 +368,9 @@ int main(int argc, char *argv[])
#else
LOG_INFO("The Mana Game Server (unknown version)");
#endif
+ LOG_INFO("Manaserv Protocol version " << ManaServ::PROTOCOL_VERSION
+ << ", " << "Enet version " << ENET_VERSION_MAJOR << "."
+ << ENET_VERSION_MINOR << "." << ENET_VERSION_PATCH);
if (!options.verbosityChanged)
options.verbosity = static_cast<Logger::Level>(
diff --git a/src/manaserv_protocol.h b/src/manaserv_protocol.h
index f0dc22b2..6225a145 100644
--- a/src/manaserv_protocol.h
+++ b/src/manaserv_protocol.h
@@ -24,6 +24,8 @@
namespace ManaServ {
+enum { PROTOCOL_VERSION = 0 };
+
/**
* Enumerated type for communicated messages:
*