Skip to content

Commit

Permalink
Set random cosmetic traits when beginning creation of custom character (
Browse files Browse the repository at this point in the history
#60959)

* Extract randomizing cosmetic traits into a new function and apply it when begin creating custom character

* Astyle
  • Loading branch information
Night-Pryanik authored Sep 14, 2022
1 parent ec5e754 commit 0262cf2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/avatar.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class avatar : public Character
bool create( character_type type, const std::string &tempname = "" );
void add_profession_items();
void randomize( bool random_scenario, bool play_now = false );
void randomize_cosmetics();
bool load_template( const std::string &template_name, pool_type & );
void save_template( const std::string &name, pool_type );
void character_to_template( const std::string &name );
Expand Down
12 changes: 9 additions & 3 deletions src/newcharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,16 +579,21 @@ void avatar::randomize( const bool random_scenario, bool play_now )
}
}

randomize_cosmetics();

// Restart cardio accumulator
reset_cardio_acc();
}

void avatar::randomize_cosmetics()
{
randomize_cosmetic_trait( type_hair_style );
randomize_cosmetic_trait( type_skin_tone );
randomize_cosmetic_trait( type_eye_color );
//arbitrary 50% chance to add beard to male characters
if( male && one_in( 2 ) ) {
randomize_cosmetic_trait( type_facial_hair );
}

// Restart cardio accumulator
reset_cardio_acc();
}

void avatar::add_profession_items()
Expand Down Expand Up @@ -672,6 +677,7 @@ bool avatar::create( character_type type, const std::string &tempname )

switch( type ) {
case character_type::CUSTOM:
randomize_cosmetics();
break;
case character_type::RANDOM:
//random scenario, default name if exist
Expand Down

0 comments on commit 0262cf2

Please sign in to comment.