21
21
#include " avatar.h"
22
22
#include " avatar_action.h"
23
23
#include " bodypart.h"
24
- #include " calendar.h"
25
24
#include " character.h"
26
25
#include " coordinates.h"
27
26
#include " contents_change_handler.h"
@@ -469,7 +468,7 @@ void aim_activity_actor::unload_RAS_weapon()
469
468
}
470
469
}
471
470
472
- void autodrive_activity_actor::start ( player_activity &act , Character &who )
471
+ void autodrive_activity_actor::start ( player_activity &, Character &who )
473
472
{
474
473
const bool in_vehicle = who.in_vehicle && who.controlling_vehicle ;
475
474
const optional_vpart_position vp = get_map ().veh_at ( who.pos () );
@@ -480,7 +479,6 @@ void autodrive_activity_actor::start( player_activity &act, Character &who )
480
479
481
480
player_vehicle = &vp->vehicle ();
482
481
player_vehicle->is_autodriving = true ;
483
- act.moves_left = calendar::INDEFINITELY_LONG;
484
482
}
485
483
486
484
void autodrive_activity_actor::do_turn ( player_activity &act, Character &who )
@@ -2577,7 +2575,7 @@ std::unique_ptr<activity_actor> open_gate_activity_actor::deserialize( JsonValue
2577
2575
2578
2576
void consume_activity_actor::start ( player_activity &act, Character &guy )
2579
2577
{
2580
- int moves;
2578
+ int moves = 0 ;
2581
2579
Character &player_character = get_player_character ();
2582
2580
if ( consume_location ) {
2583
2581
ret_val<edible_rating> ret = ret_val<edible_rating>::make_success ();
@@ -2592,9 +2590,9 @@ void consume_activity_actor::start( player_activity &act, Character &guy )
2592
2590
consume_menu_selections = std::vector<int >();
2593
2591
consume_menu_selected_items.clear ();
2594
2592
consume_menu_filter.clear ();
2595
- return ;
2593
+ } else {
2594
+ moves = to_moves<int >( guy.get_consume_time ( *consume_location ) );
2596
2595
}
2597
- moves = to_moves<int >( guy.get_consume_time ( *consume_location ) );
2598
2596
} else if ( !consume_item.is_null () ) {
2599
2597
ret_val<edible_rating> ret = ret_val<edible_rating>::make_success ();
2600
2598
if ( refuel ) {
@@ -2607,13 +2605,12 @@ void consume_activity_actor::start( player_activity &act, Character &guy )
2607
2605
consume_menu_selections = std::vector<int >();
2608
2606
consume_menu_selected_items.clear ();
2609
2607
consume_menu_filter.clear ();
2610
- return ;
2608
+ } else {
2609
+ moves = to_moves<int >( guy.get_consume_time ( consume_item ) );
2611
2610
}
2612
- moves = to_moves<int >( guy.get_consume_time ( consume_item ) );
2613
2611
} else {
2614
2612
debugmsg ( " Item/location to be consumed should not be null." );
2615
2613
canceled = true ;
2616
- return ;
2617
2614
}
2618
2615
2619
2616
act.moves_total = moves;
@@ -3043,7 +3040,6 @@ void craft_activity_actor::start( player_activity &act, Character &crafter )
3043
3040
if ( !check_if_craft_okay ( craft_item, crafter ) ) {
3044
3041
act.set_to_null ();
3045
3042
}
3046
- act.moves_left = calendar::INDEFINITELY_LONG;
3047
3043
activity_override = craft_item.get_item ()->get_making ().exertion_level ();
3048
3044
cached_crafting_speed = 0 ;
3049
3045
}
@@ -4443,7 +4439,6 @@ void disassemble_activity_actor::start( player_activity &act, Character &who )
4443
4439
// Mark the item, not available for other characters
4444
4440
target->set_var ( " activity_var" , who.name );
4445
4441
4446
- act.moves_left = calendar::INDEFINITELY_LONG;
4447
4442
activity_override = target->get_making ().exertion_level ();
4448
4443
}
4449
4444
@@ -5804,6 +5799,10 @@ std::unique_ptr<activity_actor> forage_activity_actor::deserialize( JsonValue &j
5804
5799
void longsalvage_activity_actor::start ( player_activity &act, Character & )
5805
5800
{
5806
5801
act.index = index;
5802
+
5803
+ // todo: refactor the actor to process items in ::do_turn, then remove setting the moves to 0
5804
+ // this currently still can't get interrupted before you get attacked
5805
+ act.moves_left = 0 ;
5807
5806
}
5808
5807
5809
5808
void longsalvage_activity_actor::finish ( player_activity &act, Character &who )
0 commit comments