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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user