From 910e51f63712a6bfe0c077ff73dab756f774d2b1 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Mon, 5 May 2014 23:57:07 +1000 Subject: [PATCH 1/6] Began to implement user accounts using the database I'm mostly just testing the waters at this stage, and i've left some debug code in. There's no way to unload, delete, etc. the accounts, but that comes later. --- server/{client_data.cpp => account_data.hpp} | 16 ++- server/character_data.hpp | 1 - ...character_data.cpp => combat_instance.hpp} | 10 +- server/server_application.hpp | 10 ++ server/server_connections.cpp | 8 +- server/server_database.cpp | 120 ++++++++++++++++++ server/server_internals.cpp | 8 ++ todo.txt | 7 + 8 files changed, 174 insertions(+), 6 deletions(-) rename server/{client_data.cpp => account_data.hpp} (81%) rename server/{character_data.cpp => combat_instance.hpp} (88%) create mode 100644 server/server_database.cpp diff --git a/server/client_data.cpp b/server/account_data.hpp similarity index 81% rename from server/client_data.cpp rename to server/account_data.hpp index d05f95c..220d831 100644 --- a/server/client_data.cpp +++ b/server/account_data.hpp @@ -19,6 +19,18 @@ * 3. This notice may not be removed or altered from any source * distribution. */ -#include "client_data.hpp" +#ifndef ACCOUNTDATA_HPP_ +#define ACCOUNTDATA_HPP_ -int ClientData::uidCounter = 0; +#include + +struct AccountData { + std::string username; + //password + bool blackListed = false; + bool whiteListed = true; + + int clientIndex; +}; + +#endif diff --git a/server/character_data.hpp b/server/character_data.hpp index 5cdad1c..3a12f36 100644 --- a/server/character_data.hpp +++ b/server/character_data.hpp @@ -31,7 +31,6 @@ struct CharacterData { //metadata int clientIndex; - std::string username; std::string handle; std::string avatar; diff --git a/server/character_data.cpp b/server/combat_instance.hpp similarity index 88% rename from server/character_data.cpp rename to server/combat_instance.hpp index 6761b2c..9f4dedb 100644 --- a/server/character_data.cpp +++ b/server/combat_instance.hpp @@ -19,6 +19,12 @@ * 3. This notice may not be removed or altered from any source * distribution. */ -#include "character_data.hpp" +#ifndef COMBATINSTANCE_HPP_ +#define COMBATINSTANCE_HPP_ -int CharacterData::uidCounter = 0; +struct CombatInstance { + //uid + static int uidCounter; +}; + +#endif diff --git a/server/server_application.hpp b/server/server_application.hpp index a465707..c2114d2 100644 --- a/server/server_application.hpp +++ b/server/server_application.hpp @@ -24,7 +24,9 @@ //server specific stuff #include "client_data.hpp" +#include "account_data.hpp" #include "character_data.hpp" +#include "combat_instance.hpp" //maps #include "map_allocator.hpp" @@ -75,6 +77,12 @@ private: void PumpPacket(SerialPacket); //TODO: manage the database + int CreateUserAccount(std::string username, int clientIndex); + int LoadUserAccount(std::string username, int clientIndex); + void SaveUserAccount(std::string username); + void UnloadUserAccount(std::string username); + void DeleteUserAccount(std::string username); + //TODO: combat systems //APIs @@ -84,7 +92,9 @@ private: //server tables std::map clientMap; + std::map accountMap; std::map characterMap; + std::map CombatMap; //maps //TODO: I need to handle multiple map objects diff --git a/server/server_connections.cpp b/server/server_connections.cpp index f43eb80..0876fb1 100644 --- a/server/server_connections.cpp +++ b/server/server_connections.cpp @@ -46,11 +46,17 @@ void ServerApplication::HandleJoinRequest(SerialPacket packet) { ClientData newClient; newClient.address = packet.meta.srcAddress; + //debug + std::cout << "Function Return: " << LoadUserAccount(packet.clientInfo.username, ClientData::uidCounter) << std::endl; + + for (auto& it : accountMap) { + std::cout << "Account(" << it.first << "): " << it.second.username << std::endl; + } + //TODO: move this into the character management code //create the new character CharacterData newCharacter; newCharacter.clientIndex = ClientData::uidCounter; - newCharacter.username = packet.clientInfo.username; newCharacter.handle = packet.clientInfo.handle; newCharacter.avatar = packet.clientInfo.avatar; diff --git a/server/server_database.cpp b/server/server_database.cpp new file mode 100644 index 0000000..2ec01b0 --- /dev/null +++ b/server/server_database.cpp @@ -0,0 +1,120 @@ +/* Copyright: (c) Kayne Ruse 2014 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. +*/ +#include "server_application.hpp" + +#include "sqlite3/sqlite3.h" + +#include +#include + +//------------------------- +//Define the queries +//------------------------- + +static const char* CREATE_USER_ACCOUNT = "INSERT INTO UserAccounts (username) VALUES (?);"; +static const char* LOAD_USER_ACCOUNT = "SELECT uid, username, blacklisted, whitelisted FROM UserAccounts WHERE username = ?;"; + +//------------------------- +//Define the methods +//------------------------- + +int ServerApplication::CreateUserAccount(std::string username, int clientIndex) { + std::cout << "Calling CreateUserAccount(" << username << ")\n"; + //create this user account, failing if it exists, leave this account in memory + sqlite3_stmt* statement = nullptr; + + //prep + if (sqlite3_prepare_v2(database, CREATE_USER_ACCOUNT, -1, &statement, nullptr) != SQLITE_OK) { + throw( std::runtime_error(std::string() + "Failed to prepare an SQL statement: " + sqlite3_errmsg(database)) ); + } + + //parameter + if (sqlite3_bind_text(statement, 1, username.c_str(), username.size() + 1, SQLITE_STATIC) != SQLITE_OK) { + throw( std::runtime_error(std::string() + "Failed to replace a prepared statement's parameter: " + sqlite3_errmsg(database)) ); + } + + //execute + if (sqlite3_step(statement) != SQLITE_DONE) { + //if this returns something, than this account exists + sqlite3_finalize(statement); + return -1; + } + + sqlite3_finalize(statement); + + //load this account into memory + return LoadUserAccount(username, clientIndex); +} + +int ServerApplication::LoadUserAccount(std::string username, int clientIndex) { + std::cout << "Calling LoadUserAccount(" << username << ")\n"; + //load this user account, creating it if it doesn't exist + sqlite3_stmt* statement = nullptr; + + //prep + if (sqlite3_prepare_v2(database, LOAD_USER_ACCOUNT, -1, &statement, nullptr) != SQLITE_OK) { + throw( std::runtime_error(std::string() + "Failed to prepare an SQL statement: " + sqlite3_errmsg(database)) ); + } + + //parameter + if (sqlite3_bind_text(statement, 1, username.c_str(), username.size() + 1, SQLITE_STATIC) != SQLITE_OK) { + throw( std::runtime_error(std::string() + "Failed to replace a prepared statement's parameter: " + sqlite3_errmsg(database)) ); + } + + //execute + int ret = sqlite3_step(statement); + + //process the result + if (ret == SQLITE_ROW) { + std::cout << "ret = ROW\n"; + //extract the data into memory + int uid = sqlite3_column_int(statement, 0); + accountMap[uid].username = reinterpret_cast(sqlite3_column_text(statement, 1)); + accountMap[uid].blackListed = sqlite3_column_int(statement, 2); + accountMap[uid].whiteListed = sqlite3_column_int(statement, 3); + accountMap[uid].clientIndex = clientIndex; + return uid; + } + + if (ret == SQLITE_DONE) { + std::cout << "ret = DONE\n"; + //create the non-existant account instead + return CreateUserAccount(username, clientIndex); + } + + throw(std::runtime_error(std::string() + "Unknown SQL error in LoadUserAccount: " + sqlite3_errmsg(database) )); +} + +void ServerApplication::SaveUserAccount(std::string username) { + //save this user account, replacing it if it exists + //TODO +} + +void ServerApplication::UnloadUserAccount(std::string username) { + //save this user account, and then unload it + //TODO +} + +void ServerApplication::DeleteUserAccount(std::string username) { + //delete a user account from the database, and remove it from memory + //TODO +} diff --git a/server/server_internals.cpp b/server/server_internals.cpp index f3ad870..d4fd93b 100644 --- a/server/server_internals.cpp +++ b/server/server_internals.cpp @@ -27,6 +27,14 @@ #include #include +//------------------------- +//Define the various UIDs +//------------------------- + +int ClientData::uidCounter = 0; +int CharacterData::uidCounter = 0; +int CombatInstance::uidCounter = 0; + //------------------------- //Define the public members //------------------------- diff --git a/todo.txt b/todo.txt index c392799..3123187 100644 --- a/todo.txt +++ b/todo.txt @@ -28,3 +28,10 @@ These interact with the database file, making the server a persistent system. * UnloadCharacter * DeleteCharacter +--Battle System-- + +CombatPortal: + x, y + list + list + //... \ No newline at end of file From 7c210e04a5bd9690149ec7e782249ec10aa814be Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Tue, 6 May 2014 00:17:50 +1000 Subject: [PATCH 2/6] Switched to using a wildcard symbol --- server/server_database.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/server_database.cpp b/server/server_database.cpp index 2ec01b0..34d48b8 100644 --- a/server/server_database.cpp +++ b/server/server_database.cpp @@ -31,7 +31,7 @@ //------------------------- static const char* CREATE_USER_ACCOUNT = "INSERT INTO UserAccounts (username) VALUES (?);"; -static const char* LOAD_USER_ACCOUNT = "SELECT uid, username, blacklisted, whitelisted FROM UserAccounts WHERE username = ?;"; +static const char* LOAD_USER_ACCOUNT = "SELECT * FROM UserAccounts WHERE username = ?;"; //------------------------- //Define the methods From 5dd0fb9e23d2d6b25421ba1d23d5c45d9a92db2b Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Tue, 6 May 2014 16:41:08 +1000 Subject: [PATCH 3/6] BUGFIX: Signal when a duplicate account is being loaded If a duplicate account is being created or loaded then the functions return -1. The higher code can take it from there. --- server/server_database.cpp | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/server/server_database.cpp b/server/server_database.cpp index 34d48b8..7536728 100644 --- a/server/server_database.cpp +++ b/server/server_database.cpp @@ -24,7 +24,6 @@ #include "sqlite3/sqlite3.h" #include -#include //------------------------- //Define the queries @@ -38,7 +37,6 @@ static const char* LOAD_USER_ACCOUNT = "SELECT * FROM UserAccounts WHERE usernam //------------------------- int ServerApplication::CreateUserAccount(std::string username, int clientIndex) { - std::cout << "Calling CreateUserAccount(" << username << ")\n"; //create this user account, failing if it exists, leave this account in memory sqlite3_stmt* statement = nullptr; @@ -54,7 +52,7 @@ int ServerApplication::CreateUserAccount(std::string username, int clientIndex) //execute if (sqlite3_step(statement) != SQLITE_DONE) { - //if this returns something, than this account exists + //if this fails, than this account exists sqlite3_finalize(statement); return -1; } @@ -66,8 +64,7 @@ int ServerApplication::CreateUserAccount(std::string username, int clientIndex) } int ServerApplication::LoadUserAccount(std::string username, int clientIndex) { - std::cout << "Calling LoadUserAccount(" << username << ")\n"; - //load this user account, creating it if it doesn't exist + //load this user account, failing if it is in memory, creating it if it doesn't exist sqlite3_stmt* statement = nullptr; //prep @@ -85,18 +82,30 @@ int ServerApplication::LoadUserAccount(std::string username, int clientIndex) { //process the result if (ret == SQLITE_ROW) { - std::cout << "ret = ROW\n"; - //extract the data into memory + //get the index int uid = sqlite3_column_int(statement, 0); - accountMap[uid].username = reinterpret_cast(sqlite3_column_text(statement, 1)); - accountMap[uid].blackListed = sqlite3_column_int(statement, 2); - accountMap[uid].whiteListed = sqlite3_column_int(statement, 3); - accountMap[uid].clientIndex = clientIndex; + + //check to see if this account is already loaded + if (accountMap.find(uid) != accountMap.end()) { + sqlite3_finalize(statement); + return -1; + } + + //extract the data into memory + AccountData& newAccount = accountMap[uid]; + newAccount.username = reinterpret_cast(sqlite3_column_text(statement, 1)); + newAccount.blackListed = sqlite3_column_int(statement, 2); + newAccount.whiteListed = sqlite3_column_int(statement, 3); + newAccount.clientIndex = clientIndex; + + //finish the routine + sqlite3_finalize(statement); return uid; } + sqlite3_finalize(statement); + if (ret == SQLITE_DONE) { - std::cout << "ret = DONE\n"; //create the non-existant account instead return CreateUserAccount(username, clientIndex); } From 9b5b48a8ab0e2273ef975ba614bd233ba0e52d9e Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Tue, 6 May 2014 18:33:20 +1000 Subject: [PATCH 4/6] Implemented saving of user accounts (read more) To modify an existing user account, change the in memory copy and then call the function SaveUserAccount(uid), where uid is the index of the modified account. If the save function is not called immediately, then the behaviour of the server is undefined. --- server/server_application.hpp | 6 ++--- server/server_connections.cpp | 11 +++++--- server/server_database.cpp | 48 +++++++++++++++++++++++++++++++---- 3 files changed, 53 insertions(+), 12 deletions(-) diff --git a/server/server_application.hpp b/server/server_application.hpp index c2114d2..7336402 100644 --- a/server/server_application.hpp +++ b/server/server_application.hpp @@ -79,9 +79,9 @@ private: //TODO: manage the database int CreateUserAccount(std::string username, int clientIndex); int LoadUserAccount(std::string username, int clientIndex); - void SaveUserAccount(std::string username); - void UnloadUserAccount(std::string username); - void DeleteUserAccount(std::string username); + int SaveUserAccount(int uid); + void UnloadUserAccount(int uid); + void DeleteUserAccount(int uid); //TODO: combat systems diff --git a/server/server_connections.cpp b/server/server_connections.cpp index 0876fb1..d0105e0 100644 --- a/server/server_connections.cpp +++ b/server/server_connections.cpp @@ -47,11 +47,14 @@ void ServerApplication::HandleJoinRequest(SerialPacket packet) { newClient.address = packet.meta.srcAddress; //debug - std::cout << "Function Return: " << LoadUserAccount(packet.clientInfo.username, ClientData::uidCounter) << std::endl; - - for (auto& it : accountMap) { - std::cout << "Account(" << it.first << "): " << it.second.username << std::endl; + int uid = LoadUserAccount(packet.clientInfo.username, ClientData::uidCounter); + if (uid < 0) { + std::cerr << "Error: Account already loaded: " << uid << std::endl; + return; } + accountMap[uid].blackListed = true; + accountMap[uid].whiteListed = false; + SaveUserAccount(uid); //TODO: move this into the character management code //create the new character diff --git a/server/server_database.cpp b/server/server_database.cpp index 7536728..1b9f4b5 100644 --- a/server/server_database.cpp +++ b/server/server_database.cpp @@ -31,6 +31,7 @@ static const char* CREATE_USER_ACCOUNT = "INSERT INTO UserAccounts (username) VALUES (?);"; static const char* LOAD_USER_ACCOUNT = "SELECT * FROM UserAccounts WHERE username = ?;"; +static const char* SAVE_USER_ACCOUNT = "INSERT OR REPLACE INTO UserAccounts VALUES (?, ?, ?, ?);"; //------------------------- //Define the methods @@ -113,17 +114,54 @@ int ServerApplication::LoadUserAccount(std::string username, int clientIndex) { throw(std::runtime_error(std::string() + "Unknown SQL error in LoadUserAccount: " + sqlite3_errmsg(database) )); } -void ServerApplication::SaveUserAccount(std::string username) { - //save this user account, replacing it if it exists - //TODO +int ServerApplication::SaveUserAccount(int uid) { + //save this user account from memory, replacing it if it exists in the database + //DOCS: To use this method, change the in-memory copy, and then call this function using that object's UID. + + //this method fails if this account is not loaded + if (accountMap.find(uid) == accountMap.end()) { + return -1; + } + + AccountData& account = accountMap[uid]; + sqlite3_stmt* statement = nullptr; + + //prep + if (sqlite3_prepare_v2(database, SAVE_USER_ACCOUNT, -1, &statement, nullptr) != SQLITE_OK) { + throw( std::runtime_error(std::string() + "Failed to prepare an SQL statement: " + sqlite3_errmsg(database)) ); + } + + //parameters + bool ret = false; + ret |= sqlite3_bind_int(statement, 1, uid) != SQLITE_OK; + ret |= sqlite3_bind_text(statement, 2, account.username.c_str(), account.username.size() + 1, SQLITE_STATIC) != SQLITE_OK; + ret |= sqlite3_bind_int(statement, 3, account.blackListed) != SQLITE_OK; + ret |= sqlite3_bind_int(statement, 4, account.whiteListed) != SQLITE_OK; + + //check for binding errors + if (ret) { + throw( std::runtime_error(std::string() + "Failed to replace a prepared statement's parameter: " + sqlite3_errmsg(database)) ); + } + + //execute + if (sqlite3_step(statement) != SQLITE_DONE) { + //if this fails, than something went horribly wrong + sqlite3_finalize(statement); + throw( std::runtime_error(std::string() + "Unknown SQL error when saving an account: " + sqlite3_errmsg(database)) ); + } + + sqlite3_finalize(statement); + + //successful execution + return 0; } -void ServerApplication::UnloadUserAccount(std::string username) { +void ServerApplication::UnloadUserAccount(int uid) { //save this user account, and then unload it //TODO } -void ServerApplication::DeleteUserAccount(std::string username) { +void ServerApplication::DeleteUserAccount(int uid) { //delete a user account from the database, and remove it from memory //TODO } From 0ff787abda492fa1c2b68d687875bbf32c3dc037 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Tue, 6 May 2014 18:57:49 +1000 Subject: [PATCH 5/6] Added Unloading and Deletion of user accounts --- server/server_connections.cpp | 9 +++++++++ server/server_database.cpp | 27 +++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/server/server_connections.cpp b/server/server_connections.cpp index d0105e0..08fcba1 100644 --- a/server/server_connections.cpp +++ b/server/server_connections.cpp @@ -122,6 +122,15 @@ void ServerApplication::HandleDisconnect(SerialPacket packet) { network.Send(&clientMap[packet.clientInfo.clientIndex].address, buffer, PACKET_BUFFER_SIZE); clientMap.erase(packet.clientInfo.clientIndex); + //unload the client's account + //TODO: change clientIndex to accountIndex for player ID + for (auto it : accountMap) { + if (it.second.clientIndex == packet.clientInfo.clientIndex) { + UnloadUserAccount(it.first); + break; + } + } + //prep the delete packet SerialPacket delPacket; delPacket.meta.type = SerialPacket::Type::CHARACTER_DELETE; diff --git a/server/server_database.cpp b/server/server_database.cpp index 1b9f4b5..4f34947 100644 --- a/server/server_database.cpp +++ b/server/server_database.cpp @@ -32,6 +32,7 @@ static const char* CREATE_USER_ACCOUNT = "INSERT INTO UserAccounts (username) VALUES (?);"; static const char* LOAD_USER_ACCOUNT = "SELECT * FROM UserAccounts WHERE username = ?;"; static const char* SAVE_USER_ACCOUNT = "INSERT OR REPLACE INTO UserAccounts VALUES (?, ?, ?, ?);"; +static const char* DELETE_USER_ACCOUNT = "DELETE FROM UserAccounts WHERE uid = ?;"; //------------------------- //Define the methods @@ -158,10 +159,32 @@ int ServerApplication::SaveUserAccount(int uid) { void ServerApplication::UnloadUserAccount(int uid) { //save this user account, and then unload it - //TODO + SaveUserAccount(uid); + accountMap.erase(uid); } void ServerApplication::DeleteUserAccount(int uid) { //delete a user account from the database, and remove it from memory - //TODO + sqlite3_stmt* statement = nullptr; + + //prep + if (sqlite3_prepare_v2(database, DELETE_USER_ACCOUNT, -1, &statement, nullptr) != SQLITE_OK) { + throw( std::runtime_error(std::string() + "Failed to prepare an SQL statement: " + sqlite3_errmsg(database)) ); + } + + //parameter + if (sqlite3_bind_int(statement, 1, uid) != SQLITE_OK) { + throw( std::runtime_error(std::string() + "Failed to replace a prepared statement's parameter: " + sqlite3_errmsg(database)) ); + } + + //execute + if (sqlite3_step(statement) != SQLITE_DONE) { + //if this fails, than something went horribly wrong + sqlite3_finalize(statement); + throw( std::runtime_error(std::string() + "Unknown SQL error when deleting an account: " + sqlite3_errmsg(database)) ); + } + + //finish the routine + sqlite3_finalize(statement); + accountMap.erase(uid); } From 4ebff4a25ad3dfb073881b03e9214d81ecafca89 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Tue, 6 May 2014 19:18:53 +1000 Subject: [PATCH 6/6] Minor tweaks, prepping for a merge --- client/scenes/in_world.cpp | 1 - common/network/serial_packet.hpp | 1 + server/server_application.hpp | 6 ++++-- server/server_connections.cpp | 5 +---- todo.txt | 1 + 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client/scenes/in_world.cpp b/client/scenes/in_world.cpp index 74a24df..6d43e9d 100644 --- a/client/scenes/in_world.cpp +++ b/client/scenes/in_world.cpp @@ -277,7 +277,6 @@ void InWorld::HandleDisconnect(SerialPacket packet) { void InWorld::HandleRegionContent(SerialPacket packet) { //replace existing regions - //TODO: account for map index if (regionPager.FindRegion(packet.regionInfo.x, packet.regionInfo.y)) { regionPager.UnloadRegion(packet.regionInfo.x, packet.regionInfo.y); } diff --git a/common/network/serial_packet.hpp b/common/network/serial_packet.hpp index 4c052fa..7da184a 100644 --- a/common/network/serial_packet.hpp +++ b/common/network/serial_packet.hpp @@ -88,6 +88,7 @@ union SerialPacket { //information about the client struct ClientInformation { Metadata meta; + //TODO: change clientIndex to accountIndex for player ID int clientIndex; int characterIndex; char username[PACKET_STRING_SIZE]; diff --git a/server/server_application.hpp b/server/server_application.hpp index 7336402..ea58017 100644 --- a/server/server_application.hpp +++ b/server/server_application.hpp @@ -76,13 +76,15 @@ private: //TODO: a function that only sends to characters in a certain proximity void PumpPacket(SerialPacket); - //TODO: manage the database + //Account management int CreateUserAccount(std::string username, int clientIndex); int LoadUserAccount(std::string username, int clientIndex); int SaveUserAccount(int uid); void UnloadUserAccount(int uid); void DeleteUserAccount(int uid); + //TODO: character management + //TODO: combat systems //APIs @@ -94,7 +96,7 @@ private: std::map clientMap; std::map accountMap; std::map characterMap; - std::map CombatMap; + std::map combatMap; //maps //TODO: I need to handle multiple map objects diff --git a/server/server_connections.cpp b/server/server_connections.cpp index 08fcba1..3d1387b 100644 --- a/server/server_connections.cpp +++ b/server/server_connections.cpp @@ -46,15 +46,12 @@ void ServerApplication::HandleJoinRequest(SerialPacket packet) { ClientData newClient; newClient.address = packet.meta.srcAddress; - //debug + //load the user account int uid = LoadUserAccount(packet.clientInfo.username, ClientData::uidCounter); if (uid < 0) { std::cerr << "Error: Account already loaded: " << uid << std::endl; return; } - accountMap[uid].blackListed = true; - accountMap[uid].whiteListed = false; - SaveUserAccount(uid); //TODO: move this into the character management code //create the new character diff --git a/todo.txt b/todo.txt index 3123187..7eff173 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,5 @@ I need to keep the documentation up to date. Namey, the GDD is getting out of date. +change clientIndex to accountIndex for player ID --Naming conventions--