Skip to content

Commit

Permalink
update enum talent_format.
Browse files Browse the repository at this point in the history
  • Loading branch information
scamille committed Nov 10, 2019
1 parent 855f02d commit 3558fd3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 29 deletions.
2 changes: 1 addition & 1 deletion engine/interfaces/sc_bcp_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ void parse_talents( player_t* p, const player_spec_t& spec_info, const std::stri
}
}

p->recreate_talent_str( TALENT_FORMAT_ARMORY );
p->recreate_talent_str(talent_format::ARMORY );
}

// parse_items ==============================================================
Expand Down
30 changes: 15 additions & 15 deletions engine/player/sc_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,20 +504,20 @@ bool parse_talent_url( sim_t* sim, const std::string& name, const std::string& u
++cut_pt;
if ( url.find( ".battle.net" ) != url.npos || url.find( ".battlenet.com" ) != url.npos )
{
if ( sim->talent_format == TALENT_FORMAT_UNCHANGED )
sim->talent_format = TALENT_FORMAT_ARMORY;
if ( sim->talent_input_format == talent_format::UNCHANGED )
sim->talent_input_format = talent_format::ARMORY;
return p->parse_talents_armory( url.substr( cut_pt ) );
}
else if ( url.find( "worldofwarcraft.com" ) != url.npos || url.find( "www.wowchina.com" ) != url.npos )
{
if ( sim->talent_format == TALENT_FORMAT_UNCHANGED )
sim->talent_format = TALENT_FORMAT_ARMORY;
if ( sim->talent_input_format == talent_format::UNCHANGED )
sim->talent_input_format = talent_format::ARMORY;
return p->parse_talents_armory2( url );
}
else if ( url.find( ".wowhead.com" ) != url.npos )
{
if ( sim->talent_format == TALENT_FORMAT_UNCHANGED )
sim->talent_format = TALENT_FORMAT_WOWHEAD;
if ( sim->talent_input_format == talent_format::UNCHANGED )
sim->talent_input_format = talent_format::WOWHEAD;
std::string::size_type end = url.find( '|', cut_pt );
return p->parse_talents_wowhead( url.substr( cut_pt, end - cut_pt ) );
}
Expand All @@ -531,8 +531,8 @@ bool parse_talent_url( sim_t* sim, const std::string& name, const std::string& u

if ( all_digits )
{
if ( sim->talent_format == TALENT_FORMAT_UNCHANGED )
sim->talent_format = TALENT_FORMAT_NUMBERS;
if ( sim->talent_input_format == talent_format::UNCHANGED )
sim->talent_input_format = talent_format::NUMBERS;
p->parse_talents_numbers( url );
return true;
}
Expand Down Expand Up @@ -10692,16 +10692,16 @@ double player_t::calculate_time_to_bloodlust() const
return 3 * sim->expected_iteration_time.total_seconds();
}

void player_t::recreate_talent_str( talent_format_e format )
void player_t::recreate_talent_str( talent_format format )
{
switch ( format )
{
case TALENT_FORMAT_UNCHANGED:
case talent_format::UNCHANGED:
break;
case TALENT_FORMAT_ARMORY:
case talent_format::ARMORY:
create_talents_armory();
break;
case TALENT_FORMAT_WOWHEAD:
case talent_format::WOWHEAD:
create_talents_wowhead();
break;
default:
Expand Down Expand Up @@ -10760,7 +10760,7 @@ std::string player_t::create_profile( save_e stype )
{
if ( !talents_str.empty() )
{
recreate_talent_str( sim->talent_format );
recreate_talent_str( sim->talent_input_format );
profile_str += "talents=" + talents_str + term;
}

Expand Down Expand Up @@ -11016,7 +11016,7 @@ void player_t::copy_from( player_t* source )
_spec = source->_spec;
position_str = source->position_str;
professions_str = source->professions_str;
source->recreate_talent_str( TALENT_FORMAT_UNCHANGED );
source->recreate_talent_str(talent_format::UNCHANGED );
parse_talent_url( sim, "talents", source->talents_str );

if ( azerite )
Expand Down Expand Up @@ -11411,7 +11411,7 @@ void player_t::analyze( sim_t& s )
}
}

recreate_talent_str( s.talent_format );
recreate_talent_str( s.talent_input_format );
}

/**
Expand Down
11 changes: 5 additions & 6 deletions engine/sc_enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,12 @@ enum class movement_direction_type : int
MAX,
};

enum talent_format_e
enum class talent_format
{
TALENT_FORMAT_NUMBERS = 0,
TALENT_FORMAT_ARMORY,
TALENT_FORMAT_WOWHEAD,
TALENT_FORMAT_UNCHANGED,
TALENT_FORMAT_MAX
NUMBERS,
ARMORY,
WOWHEAD,
UNCHANGED
};

enum race_e
Expand Down
10 changes: 5 additions & 5 deletions engine/sim/sc_sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,19 +319,19 @@ bool parse_talent_format( sim_t* sim,

if ( util::str_compare_ci( value, "unchanged" ) )
{
sim -> talent_format = TALENT_FORMAT_UNCHANGED;
sim -> talent_input_format = talent_format::UNCHANGED;
}
else if ( util::str_compare_ci( value, "armory" ) )
{
sim -> talent_format = TALENT_FORMAT_ARMORY;
sim -> talent_input_format = talent_format::ARMORY;
}
else if ( util::str_compare_ci( value, "wowhead" ) )
{
sim -> talent_format = TALENT_FORMAT_WOWHEAD;
sim -> talent_input_format = talent_format::WOWHEAD;
}
else if ( util::str_compare_ci( value, "numbers" ) || util::str_compare_ci( value, "default" ) )
{
sim -> talent_format = TALENT_FORMAT_NUMBERS;
sim -> talent_input_format = talent_format::NUMBERS;
}

return true;
Expand Down Expand Up @@ -1354,7 +1354,7 @@ sim_t::sim_t() :
default_region_str( "us" ),
save_prefix_str( "save_" ),
save_talent_str( 0 ),
talent_format( TALENT_FORMAT_UNCHANGED ),
talent_input_format(talent_format::UNCHANGED ),
stat_cache( 1 ),
max_aoe_enemies( 20 ),
show_etmi( 0 ),
Expand Down
4 changes: 2 additions & 2 deletions engine/simulationcraft.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ struct sim_t : private sc_thread_t
stat_e normalized_stat;
std::string current_name, default_region_str, default_server_str, save_prefix_str, save_suffix_str;
int save_talent_str;
talent_format_e talent_format;
talent_format talent_input_format;
auto_dispose< std::vector<player_t*> > actor_list;
std::string main_target_str;
int stat_cache;
Expand Down Expand Up @@ -4547,7 +4547,7 @@ struct player_t : public actor_t
virtual expr_t* create_action_expression( action_t&, const std::string& name );

virtual void create_options();
void recreate_talent_str( talent_format_e format = TALENT_FORMAT_NUMBERS );
void recreate_talent_str( talent_format format = talent_format::NUMBERS );
virtual std::string create_profile( save_e = SAVE_ALL );

virtual void copy_from( player_t* source );
Expand Down

0 comments on commit 3558fd3

Please sign in to comment.