diff --git a/src/character.cpp b/src/character.cpp index b9de3ee2e8f9a..2b1133942be17 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -1,6 +1,7 @@ #include "character.h" #include +#include #include #include #include @@ -10,6 +11,7 @@ #include #include #include +#include #include #include "action.h" @@ -5046,20 +5048,26 @@ std::pair Character::get_thirst_description() const std::pair Character::get_hunger_description() const { - std::map > hunger_states = { - { effect_hunger_engorged, std::make_pair( translate_marker( "Engorged" ), c_red ) }, - { effect_hunger_full, std::make_pair( translate_marker( "Full" ), c_yellow ) }, - { effect_hunger_satisfied, std::make_pair( translate_marker( "Satisfied" ), c_green ) }, - { effect_hunger_blank, std::make_pair( "", c_white ) }, - { effect_hunger_hungry, std::make_pair( translate_marker( "Hungry" ), c_yellow ) }, - { effect_hunger_very_hungry, std::make_pair( translate_marker( "Very Hungry" ), c_yellow ) }, - { effect_hunger_near_starving, std::make_pair( translate_marker( "Near starving" ), c_red ) }, - { effect_hunger_starving, std::make_pair( translate_marker( "Starving!" ), c_red ) }, - { effect_hunger_famished, std::make_pair( translate_marker( "Famished" ), c_light_red ) } + // clang 3.8 has some sort of issue where if the initializer list contains const arguments, + // like all of the effect_* string_id variables which are const string_id, then it fails to + // initialize the array with tuples successfully complaining that + // "chosen constructor is explicit in copy-initialization". Using std::forward_as_tuple + // returns a tuple consisting of correctly implcitly copyable types. + static const std::array, 9> hunger_states{ { + std::forward_as_tuple( effect_hunger_engorged, translate_marker( "Engorged" ), c_red ), + std::forward_as_tuple( effect_hunger_full, translate_marker( "Full" ), c_yellow ), + std::forward_as_tuple( effect_hunger_satisfied, translate_marker( "Satisfied" ), c_green ), + std::forward_as_tuple( effect_hunger_blank, "", c_white ), + std::forward_as_tuple( effect_hunger_hungry, translate_marker( "Hungry" ), c_yellow ), + std::forward_as_tuple( effect_hunger_very_hungry, translate_marker( "Very Hungry" ), c_yellow ), + std::forward_as_tuple( effect_hunger_near_starving, translate_marker( "Near starving" ), c_red ), + std::forward_as_tuple( effect_hunger_starving, translate_marker( "Starving!" ), c_red ), + std::forward_as_tuple( effect_hunger_famished, translate_marker( "Famished" ), c_light_red ) + } }; for( auto &hunger_state : hunger_states ) { - if( has_effect( hunger_state.first ) ) { - return std::make_pair( _( hunger_state.second.first ), hunger_state.second.second ); + if( has_effect( std::get<0>( hunger_state ) ) ) { + return std::make_pair( _( std::get<1>( hunger_state ) ), std::get<2>( hunger_state ) ); } } return std::make_pair( _( "ERROR!" ), c_light_red );