From c8e15550facbdf7e7fdf23155d5db1fcaec66794 Mon Sep 17 00:00:00 2001 From: Alexey Kim Date: Mon, 29 Aug 2022 03:02:41 +0300 Subject: [PATCH 1/2] Fix duplication of folding vehicles and tents --- src/iuse.cpp | 3 ++- src/iuse_actor.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/iuse.cpp b/src/iuse.cpp index fcdb48a7c5337..7fceb6d39bf26 100644 --- a/src/iuse.cpp +++ b/src/iuse.cpp @@ -5456,7 +5456,8 @@ cata::optional iuse::unfold_generic( Character *p, item *it, bool, const tr } p->moves -= it->get_var( "moves", to_turns( 5_seconds ) ); - return 1; + p->i_rem( it ); + return 0; } cata::optional iuse::adrenaline_injector( Character *p, item *it, bool, const tripoint & ) diff --git a/src/iuse_actor.cpp b/src/iuse_actor.cpp index 07eff119730fd..b2ab8a99e062a 100644 --- a/src/iuse_actor.cpp +++ b/src/iuse_actor.cpp @@ -4426,8 +4426,8 @@ cata::optional deploy_tent_actor::use( Character &p, item &it, bool, const player_activity new_act = player_activity( tent_placement_activity_actor( to_moves ( 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 ¢er ) const From abbb2f04cf70676d78e101d95d562ece91b9546b Mon Sep 17 00:00:00 2001 From: Alexey Kim Date: Mon, 29 Aug 2022 03:10:03 +0300 Subject: [PATCH 2/2] Move iuse up to date comment on top of namespace --- src/iuse.cpp | 6 ------ src/iuse.h | 6 +++++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/iuse.cpp b/src/iuse.cpp index 7fceb6d39bf26..9f0c5b491ee87 100644 --- a/src/iuse.cpp +++ b/src/iuse.cpp @@ -490,12 +490,6 @@ cata::optional 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 iuse::sewage( Character *p, item *, bool, const tripoint & ) { if( !p->query_yn( _( "Are you sure you want to drinkā€¦ this?" ) ) ) { diff --git a/src/iuse.h b/src/iuse.h index dead619ad815f..5753bb6285d3a 100644 --- a/src/iuse.h +++ b/src/iuse.h @@ -21,7 +21,11 @@ struct iteminfo; struct tripoint; template 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 {