private void accessObservedGame(int observerId, int gameId, ClientCode clientCode, Team team, out Observer observer, out GameModel game) { lock (_gameLock) { observer = getObserver(observerId, clientCode); game = getGame(gameId); checkGameAccess(game, team); game.CheckRunState(); } }
private GameModel accessLiveGame(int playerId, ClientCode clientCode) { lock (_gameLock) { Player player = getPlayer(playerId); checkPlayerAccess(player, clientCode); GameModel game = player.Game; if (game == null) { throw new ApplicationException("Player is not in a game"); } game.CheckRunState(); return(game); } }