diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-08-29 15:36:33 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-08-29 15:36:33 +0000 |
commit | eb905a28219dc7af2669b8b0db8415c3e8c4ab23 (patch) | |
tree | 0f70ec07541e8448808ba17417e168fec81c848d | |
parent | 26b3e1094d85ef89c90376688000836c8ee43979 (diff) | |
download | manaserv-eb905a28219dc7af2669b8b0db8415c3e8c4ab23.tar.gz manaserv-eb905a28219dc7af2669b8b0db8415c3e8c4ab23.tar.bz2 manaserv-eb905a28219dc7af2669b8b0db8415c3e8c4ab23.tar.xz manaserv-eb905a28219dc7af2669b8b0db8415c3e8c4ab23.zip |
Fixed handling of account levels.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/account-server/account.cpp | 24 | ||||
-rw-r--r-- | src/account-server/account.hpp | 15 | ||||
-rw-r--r-- | src/account-server/accounthandler.cpp | 2 | ||||
-rw-r--r-- | src/account-server/dalstorage.cpp | 3 | ||||
-rw-r--r-- | src/game-server/command.cpp | 4 |
6 files changed, 14 insertions, 38 deletions
@@ -22,6 +22,10 @@ use the new event system. * src/game-server/quest.cpp: Fixed event listener on character removal and/or disconnection. + * src/account-server/account.hpp, src/account-server/dalstorage.cpp, + src/account-server/accounthandler.cpp, src/account-server/account.cpp: + Fixed account levels not being loaded from the database. + * src/game-server/command.cpp: Fixed level checking. 2007-08-28 Guillaume Melquiond <guillaume.melquiond@gmail.com> diff --git a/src/account-server/account.cpp b/src/account-server/account.cpp index fb4e0572..883654f6 100644 --- a/src/account-server/account.cpp +++ b/src/account-server/account.cpp @@ -20,10 +20,10 @@ * $Id$ */ -#include "account-server/account.hpp" - #include <cassert> +#include "account-server/account.hpp" + #include "account-server/accountclient.hpp" #include "utils/functors.h" @@ -33,30 +33,14 @@ Account::Account(const std::string& name, const std::string& password, const std::string& email, + int level, int id) : mName(name), mPassword(password), mEmail(email), mCharacters(), mID(id), - mLevel(AL_NORMAL) -{ - // NOOP -} - - -/** - * Constructor with initial account info. - */ -Account::Account(const std::string& name, - const std::string& password, - const std::string& email, - const Characters& characters) - : mName(name), - mPassword(password), - mEmail(email), - mCharacters(characters), - mLevel(AL_NORMAL) + mLevel(level) { // NOOP } diff --git a/src/account-server/account.hpp b/src/account-server/account.hpp index 6b1cf8a2..7c5b5703 100644 --- a/src/account-server/account.hpp +++ b/src/account-server/account.hpp @@ -56,24 +56,11 @@ class Account Account(const std::string& name, const std::string& password, const std::string& email, + int level, int id = -1); /** - * Constructor with initial account info. - * - * @param name the user name. - * @param password the user password. - * @param email the user email. - * @param characters the characters. - */ - Account(const std::string& name, - const std::string& password, - const std::string& email, - const Characters& characters); - - - /** * Destructor. */ ~Account(); diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp index a199a96a..edb72b7e 100644 --- a/src/account-server/accounthandler.cpp +++ b/src/account-server/accounthandler.cpp @@ -337,7 +337,7 @@ AccountHandler::handleRegisterMessage(AccountClient &computer, MessageIn &msg) } else { - AccountPtr acc(new Account(username, password, email)); + AccountPtr acc(new Account(username, password, email, AL_NORMAL)); store.addAccount(acc); reply.writeByte(ERRMSG_OK); diff --git a/src/account-server/dalstorage.cpp b/src/account-server/dalstorage.cpp index 612d0565..5709fb76 100644 --- a/src/account-server/dalstorage.cpp +++ b/src/account-server/dalstorage.cpp @@ -234,7 +234,8 @@ AccountPtr DALStorage::getAccountBySQL(std::string const &query) // and initialize it with information about the user. AccountPtr account(new Account(accountInfo(0, 1), accountInfo(0, 2), - accountInfo(0, 3), id)); + accountInfo(0, 3), + toUint(accountInfo(0, 4)), id)); mAccounts.insert(std::make_pair(id, account)); diff --git a/src/game-server/command.cpp b/src/game-server/command.cpp index 342a14fd..41bee298 100644 --- a/src/game-server/command.cpp +++ b/src/game-server/command.cpp @@ -85,9 +85,9 @@ template<> struct Argument< MonsterClass * > struct Command { char const *name; - char type[4]; void (*handler)(void (*f)(), Character *, intptr_t[]); void (*target)(); + char type[4]; unsigned char level; }; @@ -254,7 +254,7 @@ void runCommand(Character *ch, std::string const &text) } } - if (!c || c->level < ch->getAccountLevel()) + if (!c || c->level > ch->getAccountLevel()) { // No such command or no sufficient rights. return; |