From 555862b34ccbbdbcd44241a00ec168a6a2716411 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Thu, 16 Dec 2010 16:36:03 +0100 Subject: Made the client handle the number of slots given by the server. I turned the CharacterEntries into a vector. As for now, it's basically working but I discovered bugs about slots handling mainly for Manaserv that were already present before that patch. Hence, there are three remaining issues: - Under ManaServ, the character's slots numbers aren't handled when loading the characters but used when sending selection or deletion attempts. For instance, if you delete the character at slot 1, you won't be able to select or delete characters at slots 2 and 3, since the server believes that the characters are now in slots 1 and 2, even thought the client still displays them at the former slots. - Also under manaserv, you won't be able to create a character at slot 1 and 3, the server will automatically add the new one to the next slot, which is not corresponding to where you clicked to the 'Create' button. I propose to make Manaserv send again the character slots numbers and store them in database since we used them in creation, selection, and deletion attempts. It would make more sense IMHO. - The last remaining issue found is that when switching between different servers, the loginData don't get cleaned up, make the characterSelect dialog look crazy when the number of slots is different between two servers. If this one is accepted, my next patch will make the logindata be cleaned up between each login attempts (as for the slot number, and maybe other sensible data) and the next ones will readd character slot handling server and client side. Reviewed-by: Jaxad0127. --- src/net/manaserv/loginhandler.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/net/manaserv/loginhandler.cpp') diff --git a/src/net/manaserv/loginhandler.cpp b/src/net/manaserv/loginhandler.cpp index 29418124..05a51efe 100644 --- a/src/net/manaserv/loginhandler.cpp +++ b/src/net/manaserv/loginhandler.cpp @@ -251,7 +251,7 @@ void LoginHandler::handleLoginResponse(Net::MessageIn &msg) if (errMsg == ERRMSG_OK) { - readUpdateHost(msg); + readServerInfo(msg); // No worlds atm, but future use :-D Client::setState(STATE_WORLD_SELECT); } @@ -289,7 +289,7 @@ void LoginHandler::handleRegisterResponse(Net::MessageIn &msg) if (errMsg == ERRMSG_OK) { - readUpdateHost(msg); + readServerInfo(msg); Client::setState(STATE_WORLD_SELECT); } else @@ -320,7 +320,7 @@ void LoginHandler::handleRegisterResponse(Net::MessageIn &msg) } } -void LoginHandler::readUpdateHost(Net::MessageIn &msg) +void LoginHandler::readServerInfo(Net::MessageIn &msg) { // Safety check for outdated manaserv versions (remove me later) if (msg.getUnreadLength() == 0) @@ -332,6 +332,13 @@ void LoginHandler::readUpdateHost(Net::MessageIn &msg) mLoginData->updateHost = updateHost; else logger->log("Warning: server does not have an update host set!"); + + // Read the client data folder for dynamic data loading. + // This is only used by the QT client. + msg.readString(); + + // Read the number of character slots + mLoginData->characterSlots = msg.readInt8(); } void LoginHandler::connect() -- cgit v1.2.3-70-g09d2