close server when empty

This commit is contained in:
2023-08-12 14:43:28 +02:00
parent 88a9020da7
commit f3adb639c3

View File

@@ -145,6 +145,10 @@ void Server::OnPlayerJoin(std::uint8_t id) {
void Server::OnPlayerLeave(std::uint8_t id) { void Server::OnPlayerLeave(std::uint8_t id) {
protocol::PlayerLeavePacket packet(id); protocol::PlayerLeavePacket packet(id);
BroadcastPacket(&packet); BroadcastPacket(&packet);
if (GetPlayers().empty()) {
Close();
}
} }
} // namespace server } // namespace server