void HoldEmTable::CollectBlindsAndDeal() { int smblind = _currentblind / 2; int cardsdealtperplayer = 0; if( 2 != GetNumberOfPlayers() ) _actionto = GetNextPosition(_dealerposition); _pot[_actionto] += _seat[_actionto]->CollectBlind(smblind); if( _pot[_actionto] == smblind ) { tablelog << "Position " << _actionto << " paid small blind " << smblind << endl; NotifyAllAction(_actionto, smblind ); } else { BootPlayer(_actionto); } _actionto = GetNextPosition(_actionto); _pot[_actionto] += _seat[_actionto]->CollectBlind(_currentblind); if( _pot[_actionto] == _currentblind ) { tablelog << "Position " << _actionto << " paid big blind " << _currentblind << endl; NotifyAllAction(_actionto, _currentblind ); _option = _actionto; } else { BootPlayer(_actionto); } _actionto = GetNextPosition(_actionto); unsigned int dealto = _dealerposition; do{ dealto = GetNextPosition(dealto); if( dealto == _dealerposition ) cardsdealtperplayer++; Card* c = _deck->DrawCard(); _seat[dealto]->DealCard(c); tablelog << "Dealt Card " << c->GetValue() << " of " << c->GetSuitString() << " to position " << dealto << endl; } while( cardsdealtperplayer != 2 ); }
void Player::Update(const DataForController& /* data */, double dt) { m_position = GetNextPosition(dt); // (1) PerformAction(GetController()->GetNextAction()); // (2) GetController()->ResetNextAction(); // (1) & (2) must be in that order. Otherwise it is possible to walk // through the walls by pressing keys quickly }
void Actor::UpdatePosition() { float dist = sqrt(mPosition.SquaredDistance(mNextPosition)); if(dist<2.f) { SetPosition(GetNextPosition()); return; } Math::Vector2f dirVector = mNextPosition-mPosition; dirVector = dirVector.NormalizeSelf()*2.f; SetPosition(GetPosition()+dirVector); }