Skip to content
Snippets Groups Projects
Commit ec2f5c4c authored by Élie Bouttier's avatar Élie Bouttier
Browse files

allows taking bonus with already a sender bonus

parent cd597324
Branches
Tags v0.3
No related merge requests found
......@@ -12,6 +12,8 @@ void Bonus::action_on_display() {
}
void Bonus::action_on_take(Ball *ball) {
if(ball->sender->bonus)
return;
ball->sender->bonus = this;
state = IN_USE;
}
......@@ -184,9 +186,12 @@ LifeAddBonus::LifeAddBonus() : Bonus(LIFE_ADD_BONUS_LENGTH, LIFE_ADD_BONUS_PROBA
void LifeAddBonus::action_on_take(Ball *ball) {
ball->sender->life_points++;
if(!ball->bonus)
if(ball->bonus) {
state = NONE;
} else {
ball->bonus = this;
state = IN_USE;
state = IN_USE;
}
}
bool LifeAddBonus::can_be_added() {
......
......@@ -87,7 +87,7 @@ void Game::pingpong() {
ball->display();
if(!ball->sender->bonus && ball->sender->pressing)
if(ball->sender->pressing)
check_for_bonus(ball);
if(ball->receiver->send_back(ball)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment