Partial rewrite of server_application.cpp

I've also fixed some other issues along the way. However, the next step
requires support for multiple rooms. Finally.
This commit is contained in:
Kayne Ruse
2014-06-07 01:14:54 +10:00
parent 170096b5db
commit cac273da5e
7 changed files with 131 additions and 131 deletions
+12
View File
@@ -283,6 +283,18 @@ void CharacterManager::DeleteCharacter(int uid) {
characterMap.erase(uid);
}
void CharacterManager::UnloadCharacterIf(std::function<bool(std::map<int, CharacterData>::iterator)> f) {
//save this character, then unload it if the parameter returns true
for (std::map<int, CharacterData>::iterator it = characterMap.begin(); it != characterMap.end(); /* EMPTY */ ) {
if (f(it)) {
SaveCharacter(it->first);
it = characterMap.erase(it);
continue;
}
it++;
}
}
//-------------------------
//Define the accessors and mutators
//-------------------------