Replaced lambda implementations with calls to the 'full unload' methods

IT should be noted that ClientManager::CheckConnections() no longer
removes a client; instead, it returns a client index that needs to be
removed via another means. This allows ServerApplication to use the 'full
unload' method.
This commit is contained in:
Kayne Ruse
2014-12-19 17:58:50 +11:00
parent 0d9dfad4a5
commit 15ea360b8a
3 changed files with 6 additions and 53 deletions
+1 -21
View File
@@ -182,27 +182,7 @@ void ServerApplication::Proc() {
//Check connections
int disconnected = clientMgr.CheckConnections();
if (disconnected != -1) {
//find and unload the accounts associated with this client
accountMgr.UnloadIf([&](std::pair<const int, AccountData> account) -> bool {
if (account.second.GetClientIndex() == disconnected) {
//find and unload the characters associated with this account
characterMgr.UnloadIf([&](std::pair<const int, CharacterData> character) -> bool {
if (character.second.GetOwner() == account.first) {
//pump character delete
CharacterPacket newPacket;
newPacket.type = SerialPacketType::CHARACTER_DELETE;
newPacket.characterIndex = character.first;
PumpPacket(static_cast<SerialPacket*>(&newPacket));
//unload this character
return true;
}
return false;
});
return true;
}
return false;
});
FullClientUnload(disconnected);
}
//give the computer a break