Skip to content

Commit

Permalink
Merge pull request CleverRaven#60545 from irwiss/fix-folding-and-tent…
Browse files Browse the repository at this point in the history
…-iuse

Fix duplication of folding vehicles and tent in iuse
  • Loading branch information
dseguin authored Aug 29, 2022
2 parents 4123bb0 + abbb2f0 commit 18de8b7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
9 changes: 2 additions & 7 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,12 +490,6 @@ cata::optional<std::string> iuse::can_smoke( const Character &you )
return cata::nullopt;
}

/* iuse methods return the number of charges expended, which is usually "1", or no value.
* Returning 0 indicates the item has not been used up, though it may have been successfully activated.
* 0 may also mean that the consumption and time progress was handled within iuse action.
* If the item is destroyed here the return value must be 0.
* A return of cata::nullopt means it was not used at all.
*/
cata::optional<int> iuse::sewage( Character *p, item *, bool, const tripoint & )
{
if( !p->query_yn( _( "Are you sure you want to drink… this?" ) ) ) {
Expand Down Expand Up @@ -5456,7 +5450,8 @@ cata::optional<int> iuse::unfold_generic( Character *p, item *it, bool, const tr
}

p->moves -= it->get_var( "moves", to_turns<int>( 5_seconds ) );
return 1;
p->i_rem( it );
return 0;
}

cata::optional<int> iuse::adrenaline_injector( Character *p, item *it, bool, const tripoint & )
Expand Down
6 changes: 5 additions & 1 deletion src/iuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ struct iteminfo;
struct tripoint;
template<typename T> class ret_val;

// iuse methods returning a bool indicating whether to consume a charge of the item being used.
// iuse methods return the number of charges expended, which is usually "1", or no value.
// Returning 0 indicates the item has not been used up, though it may have been successfully activated.
// 0 may also mean that the consumption and time progress was handled within iuse action.
// If the item is destroyed here the return value must be 0.
// A return of cata::nullopt means it was not used at all.
namespace iuse
{

Expand Down
4 changes: 2 additions & 2 deletions src/iuse_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4426,8 +4426,8 @@ cata::optional<int> deploy_tent_actor::use( Character &p, item &it, bool, const
player_activity new_act = player_activity( tent_placement_activity_actor( to_moves<int>
( 20_minutes ), direction, radius, it, wall, floor, floor_center, door_closed ) );
get_player_character().assign_activity( new_act, false );

return 1;
p.i_rem( &it );
return 0;
}

bool deploy_tent_actor::check_intact( const tripoint &center ) const
Expand Down

0 comments on commit 18de8b7

Please sign in to comment.