Skip to content

Commit

Permalink
Finish removing state from points_left
Browse files Browse the repository at this point in the history
  • Loading branch information
hexagonrecursion committed Aug 16, 2021
1 parent fd66c72 commit 97edc31
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 159 deletions.
8 changes: 1 addition & 7 deletions src/avatar.cpp
Expand Up @@ -1534,29 +1534,23 @@ std::unique_ptr<talker> get_talker_for( avatar *me )
return std::make_unique<talker_avatar>( me );
}

int avatar::randomize_hobbies()
void avatar::randomize_hobbies()
{
hobbies.clear();
std::vector<profession_id> choices = profession::get_all_hobbies();

int random = rng( 0, 5 );
int points = 0;

if( random >= 1 ) {
const profession_id hobby = random_entry_removed( choices );
points += hobby->point_cost();
hobbies.insert( &*hobby );
}
if( random >= 3 ) {
const profession_id hobby = random_entry_removed( choices );
points += hobby->point_cost();
hobbies.insert( &*hobby );
}
if( random >= 5 ) {
const profession_id hobby = random_entry_removed( choices );
points += hobby->point_cost();
hobbies.insert( &*hobby );
}

return points;
}
4 changes: 2 additions & 2 deletions src/avatar.h
Expand Up @@ -89,7 +89,7 @@ class avatar : public player
// newcharacter.cpp
bool create( character_type type, const std::string &tempname = "" );
void add_profession_items();
void randomize( bool random_scenario, points_left &points, bool play_now = false );
void randomize( bool random_scenario, bool play_now = false );
bool load_template( const std::string &template_name, points_left &points );
void save_template( const std::string &name, const points_left &points );
void character_to_template( const std::string &name );
Expand Down Expand Up @@ -295,7 +295,7 @@ class avatar : public player
void log_activity_level( float level ) override;
std::string total_daily_calories_string() const;
//set 0-3 random hobbies, with 1 and 2 being twice as likely as 0 and 3
int randomize_hobbies();
void randomize_hobbies();

int movecounter = 0;

Expand Down
1 change: 0 additions & 1 deletion src/character.h
Expand Up @@ -1985,7 +1985,6 @@ class Character : public Creature, public visitable
* And if you do already have them, refunds the points for the trait
*/
void add_traits();
void add_traits( points_left &points );
/** Returns true if the player has crossed a mutation threshold
* Player can only cross one mutation threshold.
*/
Expand Down

0 comments on commit 97edc31

Please sign in to comment.