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

Added position query for spray can and markers actions. #37761

Merged
merged 1 commit into from
Feb 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5507,7 +5507,11 @@ int iuse::artifact( player *p, item *it, bool, const tripoint & )

int iuse::spray_can( player *p, item *it, bool, const tripoint & )
{
return handle_ground_graffiti( *p, it, _( "Spray what?" ), p->pos() );
const cata::optional<tripoint> dest_ = choose_adjacent( _( "Spray where?" ) );
if( !dest_ ) {
return 0;
}
return handle_ground_graffiti( *p, it, _( "Spray what?" ), dest_.value() );
}

int iuse::handle_ground_graffiti( player &p, item *it, const std::string &prefix,
Expand All @@ -5532,7 +5536,7 @@ int iuse::handle_ground_graffiti( player &p, item *it, const std::string &prefix
if( grave ) {
p.add_msg_if_player( m_info, _( "You blur the inscription on the grave." ) );
} else {
p.add_msg_if_player( m_info, _( "You manage to get rid of the message on the ground." ) );
p.add_msg_if_player( m_info, _( "You manage to get rid of the message on the surface." ) );
}
} else {
return 0;
Expand All @@ -5542,7 +5546,7 @@ int iuse::handle_ground_graffiti( player &p, item *it, const std::string &prefix
if( grave ) {
p.add_msg_if_player( m_info, _( "You carve an inscription on the grave." ) );
} else {
p.add_msg_if_player( m_info, _( "You write a message on the ground." ) );
p.add_msg_if_player( m_info, _( "You write a message on the surface." ) );
}
move_cost = 2 * message.length();
}
Expand Down
9 changes: 7 additions & 2 deletions src/iuse_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1678,7 +1678,7 @@ int inscribe_actor::use( player &p, item &it, bool t, const tripoint & ) const
if( on_terrain && on_items ) {
uilist imenu;
imenu.text = string_format( _( "%s on what?" ), verb );
imenu.addentry( 0, true, MENU_AUTOASSIGN, _( "The ground" ) );
imenu.addentry( 0, true, MENU_AUTOASSIGN, _( "The terrain" ) );
imenu.addentry( 1, true, MENU_AUTOASSIGN, _( "An item" ) );
imenu.query();
choice = imenu.ret;
Expand All @@ -1693,7 +1693,12 @@ int inscribe_actor::use( player &p, item &it, bool t, const tripoint & ) const
}

if( choice == 0 ) {
return iuse::handle_ground_graffiti( p, &it, string_format( _( "%s what?" ), verb ), p.pos() );
const cata::optional<tripoint> dest_ = choose_adjacent( _( "Write where?" ) );
if( !dest_ ) {
return 0;
}
return iuse::handle_ground_graffiti( p, &it, string_format( _( "%s what?" ), verb ),
dest_.value() );
}

item_location loc = game_menus::inv::titled_menu( g->u, _( "Inscribe which item?" ) );
Expand Down