Skip to content

Commit

Permalink
Player::string_to_bonus code style
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
tobbi committed Oct 30, 2024
1 parent 2a7025b commit d507bac
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/object/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1909,27 +1909,23 @@ Player::get_coins() const

BonusType
Player::string_to_bonus(const std::string& bonus) const {
BonusType type = NO_BONUS;

if (bonus == "grow") {
type = GROWUP_BONUS;
return GROWUP_BONUS;
} else if (bonus == "fireflower") {
type = FIRE_BONUS;
return FIRE_BONUS;
} else if (bonus == "iceflower") {
type = ICE_BONUS;
return ICE_BONUS;
} else if (bonus == "airflower") {
type = AIR_BONUS;
return AIR_BONUS;
} else if (bonus == "earthflower") {
type = EARTH_BONUS;
return EARTH_BONUS;
} else if (bonus == "none") {
type = NO_BONUS;
return NO_BONUS;
} else {
std::ostringstream msg;
msg << "Unknown bonus type " << bonus;
throw std::runtime_error(msg.str());
}

return type;
}

std::string
Expand Down

0 comments on commit d507bac

Please sign in to comment.