Skip to content

Commit

Permalink
Refactor player activites to use item_location
Browse files Browse the repository at this point in the history
The goal here is to remove all raw indexes to items on the map
or in vehicles as indexes to colonies are unstable while pointers
and iterators are stable.

In this commit ACT_MOVE_ITEMS, ACT_PICKUP, and ACT_WEAR were
refactored to use item_location with significant code cleanup.
  • Loading branch information
ifreund committed Jun 15, 2019
1 parent 4f569f2 commit bbff510
Show file tree
Hide file tree
Showing 11 changed files with 241 additions and 379 deletions.
8 changes: 4 additions & 4 deletions src/activity_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2562,9 +2562,9 @@ void activity_handlers::pickup_do_turn( player_activity *, player * )
activity_on_turn_pickup();
}

void activity_handlers::wear_do_turn( player_activity *, player * )
void activity_handlers::wear_do_turn( player_activity *act, player *p )
{
activity_on_turn_wear();
activity_on_turn_wear( *act, *p );
}

// This activity opens the menu (it's not meant to queue consumption of items)
Expand All @@ -2588,9 +2588,9 @@ void activity_handlers::consume_meds_menu_do_turn( player_activity *, player * )
g->eat( game_menus::inv::consume_meds );
}

void activity_handlers::move_items_do_turn( player_activity *, player * )
void activity_handlers::move_items_do_turn( player_activity *act, player *p )
{
activity_on_turn_move_items();
activity_on_turn_move_items( *act, *p );
}

void activity_handlers::move_loot_do_turn( player_activity *act, player *p )
Expand Down
5 changes: 2 additions & 3 deletions src/activity_handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ int butcher_time_to_cut( const player &u, const item &corpse_item, const butcher

// activity_item_handling.cpp
void activity_on_turn_drop();
void activity_on_turn_move_items();
void activity_on_turn_move_items( player_activity &act, player &p );
void activity_on_turn_move_loot( player_activity &act, player &p );
void activity_on_turn_pickup();
void activity_on_turn_wear();
void activity_on_turn_stash();
void activity_on_turn_wear( player_activity &act, player &p );
void try_fuel_fire( player_activity &act, player &p, const bool starting_fire = false );

enum class item_drop_reason {
Expand Down
Loading

0 comments on commit bbff510

Please sign in to comment.