Deleting players on logout

This commit is contained in:
Kayne Ruse
2013-06-24 23:34:48 +10:00
parent 6d1ba24404
commit 50bef9736c
3 changed files with 44 additions and 5 deletions
+10 -2
View File
@@ -292,9 +292,17 @@ void ServerApplication::AddPlayer(Packet& p) {
}
void ServerApplication::RemovePlayer(Packet& p) {
//TODO remove a player
if (players.find(p.playerInfo.index) == players.end()) {
throw(runtime_error("Player to delete not found"));
}
players.erase(p.playerInfo.index);
}
void ServerApplication::UpdatePlayer(Packet& p) {
//TODO update a player
if (players.find(p.playerInfo.index) == players.end()) {
throw(runtime_error("Player to update not found"));
}
players[p.playerInfo.index].position = p.playerInfo.position;
players[p.playerInfo.index].motion = p.playerInfo.motion;
}