diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-11-18 19:50:22 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-11-18 19:50:22 +0100 |
commit | d62fdc6d7b84e19c8adb72bca35c0b5b0dfe5405 (patch) | |
tree | ed5e7b6104889f9da9ad18afcfc34987a25b2ab0 | |
parent | 7b187929881570281036b779a518f3f4608b51a8 (diff) | |
download | manaserv-d62fdc6d7b84e19c8adb72bca35c0b5b0dfe5405.tar.gz manaserv-d62fdc6d7b84e19c8adb72bca35c0b5b0dfe5405.tar.bz2 manaserv-d62fdc6d7b84e19c8adb72bca35c0b5b0dfe5405.tar.xz manaserv-d62fdc6d7b84e19c8adb72bca35c0b5b0dfe5405.zip |
Made the server return the number of slots in the login/register responses.
Reviewed-by: CodyMartin.
-rw-r--r-- | src/account-server/accounthandler.cpp | 17 | ||||
-rw-r--r-- | src/protocol.h | 4 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp index e50c817f..44946405 100644 --- a/src/account-server/accounthandler.cpp +++ b/src/account-server/accounthandler.cpp @@ -44,7 +44,15 @@ #include "utils/string.h" #include "utils/xml.h" -static void addUpdateHost(MessageOut *msg) +/** + * Adds server specific info to the current message + * + * The info are made of: + * (String) Update Host URL (or "") + * (String) Client Data URL (or "") + * (Byte) Number of maximum character slots (empty or not) + */ +static void addServerInfo(MessageOut *msg) { std::string updateHost = Configuration::getValue("net_defaultUpdateHost", ""); @@ -56,6 +64,9 @@ static void addUpdateHost(MessageOut *msg) */ std::string dataUrl = Configuration::getValue("net_clientDataUrl", ""); msg->writeString(dataUrl); + + // Send the number of available slots (empty or not) + msg->writeInt8(Configuration::getValue("account_maxCharacters", 3)); } // List of attributes that the client can send at account creation. @@ -378,7 +389,7 @@ void AccountHandler::handleLoginMessage(AccountClient &client, MessageIn &msg) client.status = CLIENT_CONNECTED; reply.writeInt8(ERRMSG_OK); - addUpdateHost(&reply); + addServerInfo(&reply); client.send(reply); // Acknowledge login // Return information about available characters @@ -521,7 +532,7 @@ void AccountHandler::handleRegisterMessage(AccountClient &client, storage->addAccount(acc); reply.writeInt8(ERRMSG_OK); - addUpdateHost(&reply); + addServerInfo(&reply); // Associate account with connection client.setAccount(acc); diff --git a/src/protocol.h b/src/protocol.h index 2a2c6bd3..08539203 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -44,13 +44,13 @@ enum { // Login/Register PAMSG_REGISTER = 0x0000, // D version, S username, S password, S email, S captcha response - APMSG_REGISTER_RESPONSE = 0x0002, // B error, [S updatehost] + APMSG_REGISTER_RESPONSE = 0x0002, // B error, S updatehost, S Client data URL, B Character slots PAMSG_UNREGISTER = 0x0003, // S username, S password APMSG_UNREGISTER_RESPONSE = 0x0004, // B error PAMSG_REQUEST_REGISTER_INFO = 0x0005, // APMSG_REGISTER_INFO_RESPONSE = 0x0006, // B byte registration Allowed, byte minNameLength, byte maxNameLength, string captchaURL, string captchaInstructions PAMSG_LOGIN = 0x0010, // D version, S username, S password - APMSG_LOGIN_RESPONSE = 0x0012, // B error, [S updatehost] + APMSG_LOGIN_RESPONSE = 0x0012, // B error, S updatehost, S Client data URL, B Character slots PAMSG_LOGOUT = 0x0013, // - APMSG_LOGOUT_RESPONSE = 0x0014, // B error PAMSG_CHAR_CREATE = 0x0020, // S name, B hair style, B hair color, B gender, W*6 stats |