public bool ReleasePlayer([NotNull] Player player) { if (player == null) { throw new ArgumentNullException("player"); } lock ( SyncRoot ) { if (!playerIndex.Remove(player.Name.ToLower())) { return(false); } // clear undo, selection, and confirmations player.LastDrawOp = null; player.UndoClear(); player.RedoClear(); player.IsRepeatingSelection = false; player.SelectionCancel(); player.ConfirmCancel(); // update player list UpdatePlayerList(); // unload map (if needed) if (playerIndex.Count == 0 && !preload) { IsPendingMapUnload = true; } return(true); } }