holdem_engine.HandEngine.AddAction C# (CSharp) Method

AddAction() private method

private AddAction ( int pIdx, System.Action action, List curRoundActions ) : void
pIdx int
action System.Action
curRoundActions List
return void
        private void AddAction(int pIdx, Action action, List<Action> curRoundActions)
        {
            action = _betManager.GetValidatedAction(action);

            _betManager.Commit(action);
            curRoundActions.Add(action);

            if (action.Amount > 0)
                _seats[pIdx].Chips -= action.Amount;

            //update the pots
            _potManager.AddAction(pIdx, action);

            if (action.ActionType == Action.ActionTypes.None)
                throw new Exception("Must have an action");

            //if the player either folded or went all-in, they can no longer
            //bet so remove them from the player pool
            if (action.ActionType == Action.ActionTypes.Fold)
            {
                _playerIndices.Remove(pIdx);
                _history.Folded[pIdx] = true;
            }
            else if (action.AllIn)
            {
                _playerIndices.Remove(pIdx);
                _history.AllIn[pIdx] = true;
            }
        }