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:
@@ -58,16 +58,6 @@ static const char* DELETE_CHARACTER = "DELETE FROM Characters WHERE uid = ?;";
|
||||
//Define the methods
|
||||
//-------------------------
|
||||
|
||||
CharacterManager::CharacterManager() {
|
||||
//
|
||||
}
|
||||
|
||||
CharacterManager::~CharacterManager() {
|
||||
for (auto& it : characterMap) {
|
||||
SaveCharacter(it.first);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: default stats as a parameter? This would be good for differing beggining states or multiple classes
|
||||
int CharacterManager::CreateCharacter(int owner, std::string handle, std::string avatar) {
|
||||
//Create the character, failing if it exists
|
||||
@@ -294,6 +284,13 @@ void CharacterManager::UnloadCharacterIf(std::function<bool(std::map<int, Charac
|
||||
}
|
||||
}
|
||||
|
||||
void CharacterManager::UnloadAll() {
|
||||
for (auto& it : characterMap) {
|
||||
SaveCharacter(it.first);
|
||||
}
|
||||
characterMap.clear();
|
||||
}
|
||||
|
||||
//-------------------------
|
||||
//Define the accessors and mutators
|
||||
//-------------------------
|
||||
|
||||
Reference in New Issue
Block a user