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"
@@ -464,7 +463,7 @@ void aim_activity_actor::unload_RAS_weapon()
464
463
}
465
464
}
466
465
467
- void autodrive_activity_actor::start ( player_activity &act , Character &who )
466
+ void autodrive_activity_actor::start ( player_activity &, Character &who )
468
467
{
469
468
const bool in_vehicle = who.in_vehicle && who.controlling_vehicle ;
470
469
const optional_vpart_position vp = get_map ().veh_at ( who.pos () );
@@ -475,7 +474,6 @@ void autodrive_activity_actor::start( player_activity &act, Character &who )
475
474
476
475
player_vehicle = &vp->vehicle ();
477
476
player_vehicle->is_autodriving = true ;
478
- act.moves_left = calendar::INDEFINITELY_LONG;
479
477
}
480
478
481
479
void autodrive_activity_actor::do_turn ( player_activity &act, Character &who )
@@ -2572,7 +2570,7 @@ std::unique_ptr<activity_actor> open_gate_activity_actor::deserialize( JsonValue
2572
2570
2573
2571
void consume_activity_actor::start ( player_activity &act, Character &guy )
2574
2572
{
2575
- int moves;
2573
+ int moves = 0 ;
2576
2574
Character &player_character = get_player_character ();
2577
2575
if ( consume_location ) {
2578
2576
ret_val<edible_rating> ret = ret_val<edible_rating>::make_success ();
@@ -2587,9 +2585,9 @@ void consume_activity_actor::start( player_activity &act, Character &guy )
2587
2585
consume_menu_selections = std::vector<int >();
2588
2586
consume_menu_selected_items.clear ();
2589
2587
consume_menu_filter.clear ();
2590
- return ;
2588
+ } else {
2589
+ moves = to_moves<int >( guy.get_consume_time ( *consume_location ) );
2591
2590
}
2592
- moves = to_moves<int >( guy.get_consume_time ( *consume_location ) );
2593
2591
} else if ( !consume_item.is_null () ) {
2594
2592
ret_val<edible_rating> ret = ret_val<edible_rating>::make_success ();
2595
2593
if ( refuel ) {
@@ -2602,13 +2600,12 @@ void consume_activity_actor::start( player_activity &act, Character &guy )
2602
2600
consume_menu_selections = std::vector<int >();
2603
2601
consume_menu_selected_items.clear ();
2604
2602
consume_menu_filter.clear ();
2605
- return ;
2603
+ } else {
2604
+ moves = to_moves<int >( guy.get_consume_time ( consume_item ) );
2606
2605
}
2607
- moves = to_moves<int >( guy.get_consume_time ( consume_item ) );
2608
2606
} else {
2609
2607
debugmsg ( " Item/location to be consumed should not be null." );
2610
2608
canceled = true ;
2611
- return ;
2612
2609
}
2613
2610
2614
2611
act.moves_total = moves;
@@ -3038,7 +3035,6 @@ void craft_activity_actor::start( player_activity &act, Character &crafter )
3038
3035
if ( !check_if_craft_okay ( craft_item, crafter ) ) {
3039
3036
act.set_to_null ();
3040
3037
}
3041
- act.moves_left = calendar::INDEFINITELY_LONG;
3042
3038
activity_override = craft_item.get_item ()->get_making ().exertion_level ();
3043
3039
cached_crafting_speed = 0 ;
3044
3040
}
@@ -4438,7 +4434,6 @@ void disassemble_activity_actor::start( player_activity &act, Character &who )
4438
4434
// Mark the item, not available for other characters
4439
4435
target->set_var ( " activity_var" , who.name );
4440
4436
4441
- act.moves_left = calendar::INDEFINITELY_LONG;
4442
4437
activity_override = target->get_making ().exertion_level ();
4443
4438
}
4444
4439
@@ -5570,6 +5565,10 @@ std::unique_ptr<activity_actor> forage_activity_actor::deserialize( JsonValue &j
5570
5565
void longsalvage_activity_actor::start ( player_activity &act, Character & )
5571
5566
{
5572
5567
act.index = index;
5568
+
5569
+ // todo: refactor the actor to process items in ::do_turn, then remove setting the moves to 0
5570
+ // this currently still can't get interrupted before you get attacked
5571
+ act.moves_left = 0 ;
5573
5572
}
5574
5573
5575
5574
void longsalvage_activity_actor::finish ( player_activity &act, Character &who )
0 commit comments