Worked these changes into the client & server (read more)
The changes were fairly easy, and I was actually able to find and fix an out-of-sequence bug: The destructors for the AccountManager and the CharacterManager were using SQL code after the call to SQLite3_close_v2(), so I added and called UnloadAll() for both of them.
This commit is contained in:
@@ -36,16 +36,6 @@ static const char* DELETE_USER_ACCOUNT = "DELETE FROM Accounts WHERE uid = ?;";
|
||||
//Define the public methods
|
||||
//-------------------------
|
||||
|
||||
AccountManager::AccountManager() {
|
||||
//
|
||||
}
|
||||
|
||||
AccountManager::~AccountManager() {
|
||||
for (auto& it : accountMap) {
|
||||
SaveAccount(it.first);
|
||||
}
|
||||
}
|
||||
|
||||
int AccountManager::CreateAccount(std::string username, int clientIndex) {
|
||||
//create this user account, failing if it exists, leave this account in memory
|
||||
sqlite3_stmt* statement = nullptr;
|
||||
@@ -202,6 +192,13 @@ void AccountManager::DeleteAccount(int uid) {
|
||||
accountMap.erase(uid);
|
||||
}
|
||||
|
||||
void AccountManager::UnloadAll() {
|
||||
for (auto& it : accountMap) {
|
||||
SaveAccount(it.first);
|
||||
}
|
||||
accountMap.clear();
|
||||
}
|
||||
|
||||
//-------------------------
|
||||
//Define the accessors and mutators
|
||||
//-------------------------
|
||||
@@ -226,4 +223,4 @@ sqlite3* AccountManager::SetDatabase(sqlite3* db) {
|
||||
|
||||
sqlite3* AccountManager::GetDatabase() {
|
||||
return database;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user