//-----------------------------------------------------------------------------
void CardReceiveMoneyFromPlayers::action(
        PlayerManager &i_players
        )
{
	//Uses method in PlayerManager 
    i_players.takeBalance(i_players.getMoneyFromEachPlayer(m_balanceToAdd));
}
Exemplo n.º 2
0
void NormalProperty::payRent(
        PlayerManager &i_players
        )
{
    if(i_players.takeBalance(m_rentPrices[m_numOfHouse]))
    {
        i_players.addBalance(m_rentPrices[m_numOfHouse],m_owner);
        std::cout << "Rent paid: " << m_rentPrices[m_numOfHouse] << std::endl;
    }
    else
    {
        std::cout << "Player does not have enough money to pay\n";
    }
}
Exemplo n.º 3
0
//-------------------------------------------------------------------------
void Station::payRent(
        PlayerManager & i_players
        )
{
    unsigned int rent = m_rentPrices[0];
    std::cout << "You have to pay " << rent << " for Rent\n";
    if(i_players.takeBalance(rent))
    {
        i_players.addBalance(rent,m_owner);
    }
    else
    {
        std::cout << "Player do not have enough money to pay";
        rent = i_players.withdrawGame();
        i_players.addBalance(rent);
    }
}
Exemplo n.º 4
0
//-----------------------------------------------------------------------------
void Utility::payRent(
        PlayerManager & i_players
        )
{
    Dice dice;
    dice.roll();
    const unsigned int amountTobePaid = dice.getTotal() *m_rentPrices[0];
    if(i_players.takeBalance(amountTobePaid))
    {
        std::cout << "You have paid " << amountTobePaid << " rent.\n";
        i_players.addBalance(amountTobePaid,m_owner);
    }
    else
    {
        std::cout << "You do not have enough money to pay!\n";
        i_players.withdrawGame();
    }
}