Skip to content

Commit

Permalink
typified character.h + npc.h
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrikLundell committed Dec 17, 2024
1 parent 32e2b3c commit b566339
Show file tree
Hide file tree
Showing 50 changed files with 257 additions and 299 deletions.
8 changes: 4 additions & 4 deletions src/activity_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,15 +529,15 @@ static void set_up_butchery( player_activity &act, Character &you, butcher_type
const requirement_id butchery_requirement = butchery_requirements.second;

if( !butchery_requirement->can_make_with_inventory(
you.crafting_inventory( you.pos(), PICKUP_RANGE ), is_crafting_component ) ) {
you.crafting_inventory( you.pos_bub(), PICKUP_RANGE ), is_crafting_component ) ) {
std::string popup_output = _( "You can't butcher this; you are missing some tools.\n" );

for( const std::string &str : butchery_requirement->get_folded_components_list(
45, c_light_gray, you.crafting_inventory( you.pos(), PICKUP_RANGE ), is_crafting_component ) ) {
45, c_light_gray, you.crafting_inventory( you.pos_bub(), PICKUP_RANGE ), is_crafting_component ) ) {
popup_output += str + '\n';
}
for( const std::string &str : butchery_requirement->get_folded_tools_list(
45, c_light_gray, you.crafting_inventory( you.pos(), PICKUP_RANGE ) ) ) {
45, c_light_gray, you.crafting_inventory( you.pos_bub(), PICKUP_RANGE ) ) ) {
popup_output += str + '\n';
}

Expand Down Expand Up @@ -3192,7 +3192,7 @@ void activity_handlers::operation_do_turn( player_activity *act, Character *you
}

you->perform_install( bid, upbio_uid, act->values[0], act->values[1], act->values[3],
act->str_values[installer_name], bid->canceled_mutations, you->pos() );
act->str_values[installer_name], bid->canceled_mutations, you->pos_bub() );
} else {
debugmsg( _( "%s is no a valid bionic_id" ), bid.c_str() );
you->remove_effect( effect_under_operation );
Expand Down
14 changes: 7 additions & 7 deletions src/activity_item_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ static activity_reason_info can_do_activity_there( const activity_id &act, Chara
}
item base( vpinfo.base_item );
// TODO: fix point types
const units::mass max_lift = you.best_nearby_lifting_assist( src_loc.raw() );
const units::mass max_lift = you.best_nearby_lifting_assist( src_loc );
const bool use_aid = max_lift >= base.weight();
const bool use_str = you.can_lift( base );
if( !( use_aid || use_str ) ) {
Expand Down Expand Up @@ -1125,7 +1125,7 @@ static activity_reason_info can_do_activity_there( const activity_id &act, Chara
const requirement_data &reqs = vpinfo.repair_requirements();
// TODO: fix point types
const inventory &inv =
you.crafting_inventory( src_loc.raw(), PICKUP_RANGE - 1, false );
you.crafting_inventory( src_loc, PICKUP_RANGE - 1, false );
const bool can_make = reqs.can_make_with_inventory( inv, is_crafting_component );
you.set_value( "veh_index_type", vpinfo.name() );
// temporarily store the intended index, we do this so two NPCs don't try and work on the same part at same time.
Expand Down Expand Up @@ -1289,7 +1289,7 @@ static activity_reason_info can_do_activity_there( const activity_id &act, Chara
nearest_src_loc = route.back();
}
// TODO: fix point types
const inventory pre_inv = you.crafting_inventory( nearest_src_loc.raw(), PICKUP_RANGE );
const inventory pre_inv = you.crafting_inventory( nearest_src_loc, PICKUP_RANGE );
if( !zones.empty() ) {
const blueprint_options &options = dynamic_cast<const blueprint_options &>
( zones.front().get_options() );
Expand Down Expand Up @@ -1369,7 +1369,7 @@ static activity_reason_info can_do_activity_there( const activity_id &act, Chara
if( p ) {
item_location to_craft = p->get_item_to_craft();
if( to_craft && to_craft->is_craft() ) {
const inventory &inv = you.crafting_inventory( src_loc.raw(), PICKUP_RANGE, false );
const inventory &inv = you.crafting_inventory( src_loc, PICKUP_RANGE, false );
const recipe &r = to_craft->get_making();
std::vector<std::vector<item_comp>> item_comp_vector =
to_craft->get_continue_reqs().get_components();
Expand All @@ -1388,7 +1388,7 @@ static activity_reason_info can_do_activity_there( const activity_id &act, Chara
} else if( act == ACT_MULTIPLE_DIS ) {
// Is there anything to be disassembled?
// TODO: fix point types
const inventory &inv = you.crafting_inventory( src_loc.raw(), PICKUP_RANGE, false );
const inventory &inv = you.crafting_inventory( src_loc, PICKUP_RANGE, false );
requirement_data req;
for( item &i : here.i_at( src_loc ) ) {
// Skip items marked by other ppl.
Expand Down Expand Up @@ -2656,7 +2656,7 @@ static std::unordered_set<tripoint_abs_ms> generic_multi_activity_locations(
}
}
// remove tiles in darkness, if we aren't lit-up ourselves
if( !dark_capable && you.fine_detail_vision_mod( set_pt.raw() ) > 4.0 ) {
if( !dark_capable && you.fine_detail_vision_mod( set_pt ) > 4.0 ) {
it2 = src_set.erase( it2 );
continue;
}
Expand Down Expand Up @@ -3311,7 +3311,7 @@ bool generic_multi_activity_handler( player_activity &act, Character &you, bool
activity_to_restore != ACT_MULTIPLE_MOP &&
activity_to_restore != ACT_MOVE_LOOT &&
activity_to_restore != ACT_FETCH_REQUIRED &&
you.fine_detail_vision_mod( you.pos() ) > 4.0 ) {
you.fine_detail_vision_mod( you.pos_bub() ) > 4.0 ) {
you.add_msg_if_player( m_info, _( "It is too dark to work here." ) );
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/avatar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1236,8 +1236,8 @@ void avatar::rebuild_aim_cache() const

double pi = 2 * acos( 0.0 );

const tripoint_bub_ms local_last_target = get_map().bub_from_abs( tripoint_abs_ms(
last_target_pos.value() ) );
const tripoint_bub_ms local_last_target = get_map().bub_from_abs(
last_target_pos.value() );

float base_angle = atan2f( local_last_target.y() - posy(),
local_last_target.x() - posx() );
Expand Down
12 changes: 6 additions & 6 deletions src/avatar_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,12 @@ bool avatar_action::move( avatar &you, map &m, const tripoint_rel_ms &d )
weapon->ammo_sufficient( &you ) ) {
you.invoke_item( &*weapon, "JACKHAMMER", dest_loc );
// don't move into the tile until done mining
you.defer_move( dest_loc.raw() );
you.defer_move( dest_loc );
return true;
} else if( weapon->type->can_use( "PICKAXE" ) ) {
you.invoke_item( &*weapon, "PICKAXE", dest_loc );
// don't move into the tile until done mining
you.defer_move( dest_loc.raw() );
you.defer_move( dest_loc );
return true;
}
}
Expand Down Expand Up @@ -479,7 +479,7 @@ bool avatar_action::move( avatar &you, map &m, const tripoint_rel_ms &d )
bool fromBoat = veh0 != nullptr;
bool toBoat = veh1 != nullptr;
if( is_riding ) {
if( !you.check_mount_will_move( dest_loc.raw() ) ) {
if( !you.check_mount_will_move( dest_loc ) ) {
if( you.is_auto_moving() ) {
you.abort_automove();
}
Expand Down Expand Up @@ -523,7 +523,7 @@ bool avatar_action::move( avatar &you, map &m, const tripoint_rel_ms &d )
you.add_msg_if_player( _( "You open the %s." ), door_name );
// if auto move is on, continue moving next turn
if( you.is_auto_moving() ) {
you.defer_move( dest_loc.raw() );
you.defer_move( dest_loc );
}
return true;
}
Expand Down Expand Up @@ -553,7 +553,7 @@ bool avatar_action::move( avatar &you, map &m, const tripoint_rel_ms &d )
you.mod_moves( -you.get_speed() );
// if auto move is on, continue moving next turn
if( you.is_auto_moving() ) {
you.defer_move( dest_loc.raw() );
you.defer_move( dest_loc );
}
return true;
}
Expand All @@ -569,7 +569,7 @@ bool avatar_action::move( avatar &you, map &m, const tripoint_rel_ms &d )
}
// if auto move is on, continue moving next turn
if( you.is_auto_moving() ) {
you.defer_move( dest_loc.raw() );
you.defer_move( dest_loc );
}
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/basecamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,10 +1039,10 @@ void basecamp_action_components::consume_components()
{
map &target_map = base_.get_camp_map();
avatar &player_character = get_avatar();
std::vector<tripoint> src;
std::vector<tripoint_bub_ms> src;
src.reserve( base_.src_set.size() );
for( const tripoint_abs_ms &p : base_.src_set ) {
src.emplace_back( target_map.bub_from_abs( p ).raw() );
src.emplace_back( target_map.bub_from_abs( p ) );
}
for( const comp_selection<item_comp> &sel : item_selections_ ) {
std::list<item> empty_consumed = player_character.consume_items( target_map, sel, batch_size_,
Expand Down
6 changes: 3 additions & 3 deletions src/bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2453,7 +2453,7 @@ bool Character::install_bionics( const itype &type, Character &installer, bool a
if( installer.has_trait( trait_DEBUG_BIONICS ) ||
installer.has_flag( json_flag_MANUAL_CBM_INSTALLATION ) ) {
perform_install( bioid, upbio_uid, difficulty, success, pl_skill, "NOT_MED",
bioid->canceled_mutations, pos() );
bioid->canceled_mutations, pos_bub() );
return true;
}
assign_activity( ACT_OPERATION, to_moves<int>( difficulty * 20_minutes ) );
Expand Down Expand Up @@ -2483,7 +2483,7 @@ bool Character::install_bionics( const itype &type, Character &installer, bool a

void Character::perform_install( const bionic_id &bid, bionic_uid upbio_uid, int difficulty,
int success, int pl_skill, const std::string &installer_name,
const std::vector<trait_id> &trait_to_rem, const tripoint &patient_pos )
const std::vector<trait_id> &trait_to_rem, const tripoint_bub_ms &patient_pos )
{
// if we chop off a limb, our stored kcal should decrease proportionally
float cached_healthy_kcal = get_healthy_kcal();
Expand Down Expand Up @@ -2529,7 +2529,7 @@ void Character::perform_install( const bionic_id &bid, bionic_uid upbio_uid, int
}

void Character::bionics_install_failure( const bionic_id &bid, const std::string &installer,
int difficulty, int success, float adjusted_skill, const tripoint &patient_pos )
int difficulty, int success, float adjusted_skill, const tripoint_bub_ms &patient_pos )
{
// "success" should be passed in as a negative integer representing how far off we
// were for a successful install. We use this to determine consequences for failing.
Expand Down
Loading

0 comments on commit b566339

Please sign in to comment.