diff --git a/data/json/player_activities.json b/data/json/player_activities.json index 6616de354dfd1..10cdcb3f353d4 100644 --- a/data/json/player_activities.json +++ b/data/json/player_activities.json @@ -34,14 +34,6 @@ "type": "activity_type", "stop_phrase": "Stop crafting?", "based_on": "neither", - "refuel_fires": true, - "no_resume": true - }, - { - "id": "ACT_LONGCRAFT", - "type": "activity_type", - "stop_phrase": "Stop crafting?", - "based_on": "neither", "refuel_fires": true }, { diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index 46ad2b477dcd3..cbe0b32fb716e 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -58,7 +58,6 @@ const std::map< activity_id, std::function activity_handlers::do_turn_functions = { { activity_id( "ACT_BURROW" ), burrow_do_turn }, { activity_id( "ACT_CRAFT" ), craft_do_turn }, - { activity_id( "ACT_LONGCRAFT" ), craft_do_turn }, { activity_id( "ACT_FILL_LIQUID" ), fill_liquid_do_turn }, { activity_id( "ACT_PICKAXE" ), pickaxe_do_turn }, { activity_id( "ACT_DROP" ), drop_do_turn }, @@ -138,8 +137,6 @@ activity_handlers::finish_functions = { { activity_id( "ACT_WAIT_NPC" ), wait_npc_finish }, { activity_id( "ACT_SOCIALIZE" ), socialize_finish }, { activity_id( "ACT_TRY_SLEEP" ), try_sleep_finish }, - // { activity_id( "ACT_CRAFT" ), craft_finish }, - // { activity_id( "ACT_LONGCRAFT" ), longcraft_finish }, { activity_id( "ACT_DISASSEMBLE" ), disassemble_finish }, { activity_id( "ACT_BUILD" ), build_finish }, { activity_id( "ACT_VIBE" ), vibe_finish }, @@ -2627,7 +2624,7 @@ void activity_handlers::try_sleep_finish( player_activity *act, player *p ) void activity_handlers::craft_do_turn( player_activity *act, player *p ) { - int pos = act->values.front(); + const int pos = act->values.front(); item &craft = p->i_at( pos ); const recipe &rec = craft.get_making(); @@ -2650,7 +2647,7 @@ void activity_handlers::craft_do_turn( player_activity *act, player *p ) craft.item_counter += crafting_speed * p->get_moves(); p->set_moves( 0 ); act->set_to_null(); - + if( craft.item_counter >= rec.time ) { item craft_copy = craft; p->i_rem( pos ); diff --git a/src/activity_handlers.h b/src/activity_handlers.h index 701679432a221..6aa199caca506 100644 --- a/src/activity_handlers.h +++ b/src/activity_handlers.h @@ -121,8 +121,6 @@ void wait_weather_finish( player_activity *act, player *p ); void wait_npc_finish( player_activity *act, player *p ); void socialize_finish( player_activity *act, player *p ); void try_sleep_finish( player_activity *act, player *p ); -// void craft_finish( player_activity *act, player *p ); -// void longcraft_finish( player_activity *act, player *p ); void disassemble_finish( player_activity *act, player *p ); void build_finish( player_activity *act, player *p ); void vibe_finish( player_activity *act, player *p ); diff --git a/src/crafting.cpp b/src/crafting.cpp index fa1154b556641..b85a8f87b5711 100644 --- a/src/crafting.cpp +++ b/src/crafting.cpp @@ -516,12 +516,11 @@ void player::start_craft( const recipe &making, int batch_size, bool is_long ) { if( making.ident().is_null() ) { debugmsg( "no recipe with id %s found", activity.name ); - // activity.set_to_null(); return; } // Use up the components and tools - std::list used = consume_components_for_craft( making, batch_size ); + const std::list used = consume_components_for_craft( making, batch_size ); if( last_craft->has_cached_selections() && used.empty() ) { // This signals failure, even though there seem to be several paths where it shouldn't... return; @@ -532,7 +531,7 @@ void player::start_craft( const recipe &making, int batch_size, bool is_long ) item craft( &making, batch_size, std::vector( used.begin(), used.end() ) ); - int pos = get_item_position( set_item_inventory( *this, craft ) ); + const int pos = get_item_position( set_item_inventory( *this, craft ) ); if( pos == INT_MIN ) { add_msg_if_player( _( "Activate the %s to start crafting" ), craft.tname() ); } else { @@ -551,7 +550,7 @@ void player::start_craft( const recipe &making, int batch_size, bool is_long ) void player::complete_craft( item &craft ) { const recipe &making = craft.get_making(); // Which recipe is it? - int batch_size = craft.charges; + const int batch_size = craft.charges; /* to be modified and moved to ACT_CRAFT */ int secondary_dice = 0; diff --git a/src/player.cpp b/src/player.cpp index 65b506fb6800b..6000c5382d205 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -11235,7 +11235,6 @@ void player::assign_activity( const player_activity &act, bool allow_resume ) add_msg_if_player( _( "You resume your task." ) ); activity = backlog.front(); backlog.pop_front(); - activity.resume_with( act ); } else { if( activity ) { backlog.push_front( activity ); diff --git a/src/player_activity.cpp b/src/player_activity.cpp index bb85a4c886b55..dcefdbd053335 100644 --- a/src/player_activity.cpp +++ b/src/player_activity.cpp @@ -158,20 +158,7 @@ bool player_activity::can_resume_with( const player_activity &other, const Chara return false; } - if( id() == activity_id( "ACT_CRAFT" ) || id() == activity_id( "ACT_LONGCRAFT" ) ) { - // The last value is a time stamp, and the last coord is the player - // position. We want to allow either to have changed. - // (This would be much less hacky in the hypothetical future of - // activity_handler_actors). - if( !( values.size() == other.values.size() && - !values.empty() && - std::equal( values.begin(), values.end() - 1, other.values.begin() ) && - coords.size() == other.coords.size() && - !coords.empty() && - std::equal( coords.begin(), coords.end() - 1, other.coords.begin() ) ) ) { - return false; - } - } else if( id() == activity_id( "ACT_CLEAR_RUBBLE" ) ) { + if( id() == activity_id( "ACT_CLEAR_RUBBLE" ) ) { if( other.coords.empty() || other.coords[0] != coords[0] ) { return false; } @@ -195,22 +182,6 @@ bool player_activity::can_resume_with( const player_activity &other, const Chara position == other.position && name == other.name && targets == other.targets; } -void player_activity::resume_with( const player_activity &other ) -{ - if( id() == activity_id( "ACT_CRAFT" ) || id() == activity_id( "ACT_LONGCRAFT" ) ) { - // For crafting actions, we need to update the start turn and position - // to the resumption time values. These are stored in the last - // elements of values and coords respectively. - if( !( !values.empty() && values.size() == other.values.size() && - !coords.empty() && coords.size() == other.coords.size() ) ) { - debugmsg( "Activities incompatible; should not have resumed" ); - return; - } - values.back() = other.values.back(); - coords.back() = other.coords.back(); - } -} - bool player_activity::is_distraction_ignored( distraction_type type ) const { return ignored_distractions.find( type ) != ignored_distractions.end(); diff --git a/src/player_activity.h b/src/player_activity.h index f325b93c1115c..11cf30e1d968d 100644 --- a/src/player_activity.h +++ b/src/player_activity.h @@ -100,13 +100,6 @@ class player_activity * can be resumed instead of starting the other activity. */ bool can_resume_with( const player_activity &other, const Character &who ) const; - /** - * When an old activity A is resumed by a new activity B, normally B is - * discarded and the saved A is simply used in its place. However, - * this will be called on A, passing B as an argument, in case A needs - * to grab any values from B. - */ - void resume_with( const player_activity &other ); bool is_distraction_ignored( distraction_type type ) const; void ignore_distraction( distraction_type type ); diff --git a/src/savegame_legacy.cpp b/src/savegame_legacy.cpp index 50b013aeabc8e..3e08f4e3abda1 100644 --- a/src/savegame_legacy.cpp +++ b/src/savegame_legacy.cpp @@ -540,7 +540,7 @@ void player_activity::deserialize_legacy_type( int legacy_type, activity_id &des activity_id( "ACT_GAME" ), activity_id( "ACT_WAIT" ), activity_id( "ACT_CRAFT" ), - activity_id( "ACT_LONGCRAFT" ), + activity_id::NULL_ID(), // ACT_LONGCRAFT is deprecated activity_id( "ACT_DISASSEMBLE" ), activity_id( "ACT_BUTCHER" ), activity_id( "ACT_LONGSALVAGE" ),