Skip to content

Commit

Permalink
Update u_buy_monster name to be translatable
Browse files Browse the repository at this point in the history
  • Loading branch information
ralreegorganon committed Aug 23, 2019
1 parent 7a4f8ca commit 26806ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/dialogue.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ struct talk_effect_fun_t {
void set_npc_gets_item( bool to_use );
void set_add_mission( std::string mission_id );
void set_u_buy_monster( const std::string &monster_id, int cost, int count, bool pacified,
const std::string &name );
const translation &name );

void operator()( const dialogue &d ) const {
if( !function ) {
Expand Down
7 changes: 4 additions & 3 deletions src/npctalk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2099,7 +2099,7 @@ void talk_effect_fun_t::set_add_mission( const std::string mission_id )
}

void talk_effect_fun_t::set_u_buy_monster( const std::string &monster_type_id, int cost, int count,
bool pacified, const std::string &name )
bool pacified, const translation &name )
{
function = [monster_type_id, cost, count, pacified, name]( const dialogue & d ) {
npc &p = *d.beta;
Expand All @@ -2126,7 +2126,7 @@ void talk_effect_fun_t::set_u_buy_monster( const std::string &monster_type_id, i
}

if( !name.empty() ) {
tmp.unique_name = name;
tmp.unique_name = name.translated();
}

if( const cata::optional<tripoint> pos = random_point( points, [&]( const tripoint & p ) {
Expand Down Expand Up @@ -2348,7 +2348,8 @@ void talk_effect_t::parse_sub_effect( JsonObject jo )
const int cost = jo.get_int( "cost", 0 );
const int count = jo.get_int( "count", 1 );
const bool pacified = jo.get_bool( "pacified", false );
const std::string &name = jo.get_string( "name", "" );
translation name;
jo.read( "name", name );
subeffect_fun.set_u_buy_monster( monster_type_id, cost, count, pacified, name );
} else {
jo.throw_error( "invalid sub effect syntax :" + jo.str() );
Expand Down

0 comments on commit 26806ba

Please sign in to comment.