Skip to content

Commit

Permalink
Merge pull request #37761 from eilaattwood/write-on-walls
Browse files Browse the repository at this point in the history
Added position query for spray can and markers actions.
  • Loading branch information
ZhilkinSerg authored Feb 6, 2020
2 parents 7173d8a + 59e0b5d commit e43e9ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
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

0 comments on commit e43e9ec

Please sign in to comment.