Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NPC equip fail message #37824

Merged
merged 1 commit into from
Feb 8, 2020
Merged

Conversation

Ramza13
Copy link
Contributor

@Ramza13 Ramza13 commented Feb 8, 2020

Summary

SUMMARY: Bugfixes "Fix NPC equip due to mutation fail message"

Purpose of change

Fixes #23409
NPC refusing to equip items due to mutation had incorrect message.

Describe the solution

#23409 was already mostly fixed, the NPC would correctly refuse to equip an incompatible item but the message was wrong so I fixed the message.

Describe alternatives you've considered

Testing

Additional context

@ZhilkinSerg ZhilkinSerg added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies labels Feb 8, 2020
@ZhilkinSerg ZhilkinSerg merged commit d4566de into CleverRaven:master Feb 8, 2020
return ret_val<bool>::make_failure( _( "Your %s mutation prevents you from wearing your %s." ),
return ret_val<bool>::make_failure( is_player() ?
_( "Your %s mutation prevents you from wearing your %s." ), branch.name(), it.type_name() :
_( "My %s mutation prevents me from wearing this %s." ), branch.name(), it.type_name(),
Copy link
Contributor

@BevapDin BevapDin Feb 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the second operand of the ternary will evaluate to just the type_name. That second operand consists of some invocations of the comma operator, so it evaluates to the right operand of them.

is_player ? "...", name(), type_name() : ...
// Is parsed as
is_player ? ( "...", name(), type_name() ) : ...
// Which is the same as
is_player ?( type_name() ) : ...

I suggest writing it like this:

make_failure( is ? "text 1" : "text 2", additional, parameters, that, will, apply, to, both, strings )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPC follower can wear items incompatible with mutant anatomy.
3 participants