diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index 0f7c025065b8e..70e0bafcbff88 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -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'; } @@ -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 ); diff --git a/src/activity_item_handling.cpp b/src/activity_item_handling.cpp index 3775a76811ca7..f9d73d1d9fdde 100644 --- a/src/activity_item_handling.cpp +++ b/src/activity_item_handling.cpp @@ -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 ) ) { @@ -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. @@ -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 ( zones.front().get_options() ); @@ -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> item_comp_vector = to_craft->get_continue_reqs().get_components(); @@ -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. @@ -2656,7 +2656,7 @@ static std::unordered_set 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; } @@ -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; } diff --git a/src/avatar.cpp b/src/avatar.cpp index 41cf12f9e9e96..056d20cbf2fd8 100644 --- a/src/avatar.cpp +++ b/src/avatar.cpp @@ -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() ); diff --git a/src/avatar_action.cpp b/src/avatar_action.cpp index 3a7c1482725ef..71c928d0a83bc 100644 --- a/src/avatar_action.cpp +++ b/src/avatar_action.cpp @@ -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; } } @@ -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(); } @@ -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; } @@ -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; } @@ -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; } diff --git a/src/basecamp.cpp b/src/basecamp.cpp index 0271f96d76d79..f5e181d1f94b4 100644 --- a/src/basecamp.cpp +++ b/src/basecamp.cpp @@ -1039,10 +1039,10 @@ void basecamp_action_components::consume_components() { map &target_map = base_.get_camp_map(); avatar &player_character = get_avatar(); - std::vector src; + std::vector 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 &sel : item_selections_ ) { std::list empty_consumed = player_character.consume_items( target_map, sel, batch_size_, diff --git a/src/bionics.cpp b/src/bionics.cpp index 0ec63968d6e39..181f28d4088af 100644 --- a/src/bionics.cpp +++ b/src/bionics.cpp @@ -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( difficulty * 20_minutes ) ); @@ -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_to_rem, const tripoint &patient_pos ) + const std::vector &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(); @@ -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. diff --git a/src/character.cpp b/src/character.cpp index 0e25335baec46..df3afb07a74c2 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -1709,7 +1709,7 @@ void Character::mount_creature( monster &z ) mod_moves( -100 ); } -bool Character::check_mount_will_move( const tripoint &dest_loc ) +bool Character::check_mount_will_move( const tripoint_bub_ms &dest_loc ) { if( !is_mounted() || mounted_creature->has_flag( mon_flag_COMBAT_MOUNT ) ) { return true; @@ -1721,7 +1721,7 @@ bool Character::check_mount_will_move( const tripoint &dest_loc ) } Attitude att = critter.attitude_to( *this ); if( att == Attitude::HOSTILE && sees( critter ) && rl_dist( pos_bub(), critter.pos_bub() ) <= 15 && - rl_dist( dest_loc, critter.pos_bub().raw() ) < rl_dist( pos_bub(), critter.pos_bub() ) ) { + rl_dist( dest_loc, critter.pos_bub() ) < rl_dist( pos_bub(), critter.pos_bub() ) ) { add_msg_if_player( _( "You fail to budge your %s!" ), mounted_creature->get_name() ); return false; } @@ -2857,7 +2857,7 @@ bool Character::practice( const skill_id &id, int amount, int cap, bool suppress // 6.0 is LIGHT_AMBIENT_DIM // 7.3 is LIGHT_AMBIENT_MINIMAL, a dark cloudy night, unlit indoors // 11.0 is zero light or blindness -float Character::fine_detail_vision_mod( const tripoint &p ) const +float Character::fine_detail_vision_mod( const tripoint_bub_ms &p ) const { // PER_SLIME_OK implies you can get enough eyes around the bile // that you can generally see. There still will be the haze, but @@ -2874,7 +2874,7 @@ float Character::fine_detail_vision_mod( const tripoint &p ) const // Same calculation as above, but with a result 3 lower. float ambient_light{}; - tripoint_bub_ms const check_p = p.is_invalid() ? pos_bub() : tripoint_bub_ms( p ); + tripoint_bub_ms const check_p = p.is_invalid() ? pos_bub() : p; tripoint_bub_ms const avatar_p = get_avatar().pos_bub(); if( is_avatar() || check_p.z() == avatar_p.z() ) { ambient_light = std::max( 1.0f, @@ -3199,10 +3199,10 @@ void Character::invalidate_weight_carried_cache() units::mass Character::best_nearby_lifting_assist() const { - return best_nearby_lifting_assist( this->pos() ); + return best_nearby_lifting_assist( this->pos_bub() ); } -units::mass Character::best_nearby_lifting_assist( const tripoint &world_pos ) const +units::mass Character::best_nearby_lifting_assist( const tripoint_bub_ms &world_pos ) const { int mech_lift = 0; if( is_mounted() ) { @@ -3213,7 +3213,7 @@ units::mass Character::best_nearby_lifting_assist( const tripoint &world_pos ) c } int lift_quality = std::max( { this->max_quality( qual_LIFT ), mech_lift, map_selector( this->pos_bub(), PICKUP_RANGE ).max_quality( qual_LIFT ), - vehicle_selector( tripoint_bub_ms( world_pos ), 4, true, true ).max_quality( qual_LIFT ) + vehicle_selector( world_pos, 4, true, true ).max_quality( qual_LIFT ) } ); return lifting_quality_to_mass( lift_quality ); } @@ -6091,7 +6091,7 @@ float Character::rest_quality() const if( has_effect( effect_sleep ) ) { // Beds should normally have a maximum of 2C warmth, rest == 1.0 on a pristine bed. Less comfortable beds provide less rest quality. // Cannot be lower than 0, even though some beds(like *the bare ground*) have negative floor_bedding_warmth. Maybe this should change? - rest += ( std::max( units::to_kelvin_delta( floor_bedding_warmth( your_pos.raw() ) ), + rest += ( std::max( units::to_kelvin_delta( floor_bedding_warmth( your_pos ) ), 0.f ) / 2.0f ) ; return std::max( rest, 0.0f ); } @@ -6102,9 +6102,9 @@ float Character::rest_quality() const if( here.has_flag_ter_or_furn( "CAN_SIT", your_pos.xy() ) || has_vehicle_seat ) { // If not performing any real exercise (not even moving around), chairs allow you to rest a little bit. rest += 0.2f; - } else if( floor_bedding_warmth( your_pos.raw() ) > 0_C_delta ) { + } else if( floor_bedding_warmth( your_pos ) > 0_C_delta ) { // Any comfortable bed can substitute for a chair, but only if you don't have one. - rest += 0.2f * ( units::to_celsius_delta( floor_bedding_warmth( your_pos.raw() ) ) / 2.0f ); + rest += 0.2f * ( units::to_celsius_delta( floor_bedding_warmth( your_pos ) ) / 2.0f ); } if( ur_act_level <= NO_EXERCISE ) { rest += 0.2f; @@ -7499,9 +7499,9 @@ void Character::vomit() } // adjacent_tile() returns a safe, unoccupied adjacent tile. If there are no such tiles, returns player position instead. -tripoint Character::adjacent_tile() const +tripoint_bub_ms Character::adjacent_tile() const { - std::vector ret; + std::vector ret; ret.reserve( 4 ); int dangerous_fields = 0; map &here = get_map(); @@ -7534,11 +7534,11 @@ tripoint Character::adjacent_tile() const } if( dangerous_fields == 0 ) { - ret.push_back( p.raw() ); + ret.push_back( p ); } } - return random_entry( ret, pos() ); // player position if no valid adjacent tiles + return random_entry( ret, pos_bub() ); // player position if no valid adjacent tiles } void Character::set_fac_id( const std::string &my_fac_id ) @@ -9112,7 +9112,7 @@ bool Character::can_use_floor_warmth() const has_activity( ACT_STUDY_SPELL ); } -units::temperature_delta Character::floor_bedding_warmth( const tripoint &pos ) +units::temperature_delta Character::floor_bedding_warmth( const tripoint_bub_ms &pos ) { map &here = get_map(); const trap &trap_at_pos = here.tr_at( pos ); @@ -9133,7 +9133,7 @@ units::temperature_delta Character::floor_bedding_warmth( const tripoint &pos ) } } -units::temperature_delta Character::floor_item_warmth( const tripoint &pos ) +units::temperature_delta Character::floor_item_warmth( const tripoint_bub_ms &pos ) { units::temperature_delta item_warmth = 0_C_delta; @@ -9164,7 +9164,7 @@ units::temperature_delta Character::floor_item_warmth( const tripoint &pos ) return item_warmth; } -units::temperature_delta Character::floor_warmth( const tripoint &pos ) const +units::temperature_delta Character::floor_warmth( const tripoint_bub_ms &pos ) const { const units::temperature_delta item_warmth = floor_item_warmth( pos ); units::temperature_delta bedding_warmth = floor_bedding_warmth( pos ); @@ -9613,7 +9613,7 @@ std::list Character::use_charges( const itype_id &what, int qty, const int const std::function &filter, bool in_tools ) { std::list res; - inventory inv = crafting_inventory( pos(), radius, true ); + inventory inv = crafting_inventory( pos_bub(), radius, true ); if( qty <= 0 ) { return res; @@ -10483,7 +10483,7 @@ void Character::echo_pulse() const std::string direction = direction_name( direction_from( pos_bub(), origin ) ); add_msg_if_player( m_warning, _( "You detect a %1$s to the %2$s!" ), tr.name(), direction ); - add_known_trap( origin.raw(), tr ); + add_known_trap( origin, tr ); } Creature *critter = get_creature_tracker().creature_at( origin, true ); if( critter && here.sees( pos_bub(), origin, pulse_range, false ) ) { @@ -10592,18 +10592,13 @@ void Character::echo_pulse() } } -bool Character::knows_trap( const tripoint &pos ) const -{ - return Character::knows_trap( tripoint_bub_ms( pos ) ); -} - bool Character::knows_trap( const tripoint_bub_ms &pos ) const { const tripoint_abs_ms p = get_map().getglobal( pos ); return known_traps.count( p.raw() ) > 0; } -void Character::add_known_trap( const tripoint &pos, const trap &t ) +void Character::add_known_trap( const tripoint_bub_ms &pos, const trap &t ) { const tripoint_abs_ms p = get_map().getglobal( pos ); if( t.is_null() ) { @@ -10614,17 +10609,17 @@ void Character::add_known_trap( const tripoint &pos, const trap &t ) } } -bool Character::can_hear( const tripoint &source, const int volume ) const +bool Character::can_hear( const tripoint_bub_ms &source, const int volume ) const { if( is_deaf() ) { return false; } // source is in-ear and at our square, we can hear it - if( source == pos_bub().raw() && volume == 0 ) { + if( source == pos_bub() && volume == 0 ) { return true; } - const int dist = rl_dist( source, pos_bub().raw() ); + const int dist = rl_dist( source, pos_bub() ); const float volume_multiplier = hearing_ability(); return ( volume - get_weather().weather_id->sound_attn ) * volume_multiplier >= dist; } @@ -11159,12 +11154,12 @@ bool Character::can_sleep() return result; } -const comfort_data &Character::get_comfort_data_for( const tripoint &p ) const +const comfort_data &Character::get_comfort_data_for( const tripoint_bub_ms &p ) const { const comfort_data *worst = nullptr; for( const trait_id trait : get_mutations() ) { for( const comfort_data &data : trait->comfort ) { - if( data.are_conditions_true( *this, p ) ) { + if( data.are_conditions_true( *this, p.raw() ) ) { if( worst == nullptr || worst->base_comfort > data.base_comfort ) { worst = &data; } @@ -11175,32 +11170,22 @@ const comfort_data &Character::get_comfort_data_for( const tripoint &p ) const return worst == nullptr ? comfort_data::human() : *worst; } -const comfort_data &Character::get_comfort_data_for( const tripoint_bub_ms &p ) const -{ - return get_comfort_data_for( p.raw() ); -} - -const comfort_data::response &Character::get_comfort_at( const tripoint &p ) +const comfort_data::response &Character::get_comfort_at( const tripoint_bub_ms &p ) { - if( comfort_cache.last_time == calendar::turn && comfort_cache.last_position == p ) { + if( comfort_cache.last_time == calendar::turn && comfort_cache.last_position == p.raw() ) { return comfort_cache; } - return comfort_cache = get_comfort_data_for( p ).get_comfort_at( p ); -} - -const comfort_data::response &Character::get_comfort_at( const tripoint_bub_ms &p ) -{ - return get_comfort_at( p.raw() ); + return comfort_cache = get_comfort_data_for( p ).get_comfort_at( p.raw() ); } -void Character::shift_destination( const point &shift ) +void Character::shift_destination( const point_rel_ms &shift ) { if( next_expected_position ) { - *next_expected_position += shift; + *next_expected_position += {shift, 0}; } for( tripoint_bub_ms &elem : auto_move_route ) { - elem += shift; + elem += {shift, 0}; } } @@ -11311,7 +11296,7 @@ void Character::set_destination( const std::vector &route, { auto_move_route = route; set_destination_activity( new_destination_activity ); - destination_point.emplace( get_map().getglobal( route.back() ).raw() ); + destination_point.emplace( get_map().getglobal( route.back() ) ); } void Character::clear_destination() @@ -11349,7 +11334,7 @@ bool Character::has_destination() const bool Character::has_destination_activity() const { return !get_destination_activity().is_null() && destination_point && - pos_bub() == get_map().bub_from_abs( tripoint_abs_ms( *destination_point ) ); + pos_bub() == get_map().bub_from_abs( *destination_point ); } void Character::start_destination_activity() @@ -11441,15 +11426,15 @@ int Character::intimidation() const return ret; } -bool Character::defer_move( const tripoint &next ) +bool Character::defer_move( const tripoint_bub_ms &next ) { // next must be adjacent to current pos - if( square_dist( next, pos_bub().raw() ) != 1 ) { + if( square_dist( next, pos_bub() ) != 1 ) { return false; } // next must be adjacent to subsequent move in any preexisting automove route // TODO: fix point types - if( has_destination() && square_dist( auto_move_route.front().raw(), next ) != 1 ) { + if( has_destination() && square_dist( auto_move_route.front(), next ) != 1 ) { return false; } // TODO: fix point types @@ -12827,7 +12812,7 @@ void Character::search_surroundings() const std::string direction = direction_name( direction_from( pos_bub(), tp ) ); add_msg_if_player( m_warning, _( "Your ground sonar detected a %1$s to the %2$s!" ), tr.name(), direction ); - add_known_trap( tp.raw(), tr ); + add_known_trap( tp, tr ); } if( !sees( tp ) ) { continue; @@ -12849,7 +12834,7 @@ void Character::search_surroundings() add_msg_if_player( _( "You've spotted a %1$s to the %2$s!" ), tr.name(), direction ); } - add_known_trap( tp.raw(), tr ); + add_known_trap( tp, tr ); } } } @@ -13039,7 +13024,7 @@ void Character::use( item_location loc, int pre_obtain_moves, std::string const } } -int Character::climbing_cost( const tripoint &from, const tripoint &to ) const +int Character::climbing_cost( const tripoint_bub_ms &from, const tripoint_bub_ms &to ) const { map &here = get_map(); if( !here.valid_move( from, to, false, true ) ) { diff --git a/src/character.h b/src/character.h index 35066a3a120b3..67d845a6a8169 100644 --- a/src/character.h +++ b/src/character.h @@ -1452,7 +1452,7 @@ class Character : public Creature, public visitable void mount_creature( monster &z ); bool cant_do_mounted( bool msg = true ) const; bool is_mounted() const; - bool check_mount_will_move( const tripoint &dest_loc ); + bool check_mount_will_move( const tripoint_bub_ms &dest_loc ); bool check_mount_is_spooked(); void dismount(); void forced_dismount(); @@ -1780,9 +1780,9 @@ class Character : public Creature, public visitable /**Success or failure of installation happens here*/ void 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_to_rem, const tripoint &patient_pos ); + const std::vector &trait_to_rem, const tripoint_bub_ms &patient_pos ); void bionics_install_failure( const bionic_id &bid, const std::string &installer, int difficulty, - int success, float adjusted_skill, const tripoint &patient_pos ); + int success, float adjusted_skill, const tripoint_bub_ms &patient_pos ); /** * Try to wield a contained item consuming moves proportional to weapon skill and volume. * @param container Container containing the item to be wielded @@ -2234,7 +2234,7 @@ class Character : public Creature, public visitable units::mass best_nearby_lifting_assist() const; /// Alternate version if you need to specify a different origin point for nearby vehicle sources of lifting /// used for operations on distant objects (e.g. vehicle installation/uninstallation) - units::mass best_nearby_lifting_assist( const tripoint &world_pos ) const; + units::mass best_nearby_lifting_assist( const tripoint_bub_ms &world_pos ) const; // weapon + worn (for death, etc) std::vector inv_dump(); @@ -2390,8 +2390,8 @@ class Character : public Creature, public visitable /** Returns all items that must be taken off before taking off this item */ std::list get_dependent_worn_items( const item &it ); /** Drops an item to the specified location */ - void drop( item_location loc, const tripoint &where ); - virtual void drop( const drop_locations &what, const tripoint &target, bool stash = false ); + void drop( item_location loc, const tripoint_bub_ms &where ); + virtual void drop( const drop_locations &what, const tripoint_bub_ms &target, bool stash = false ); /** Assigns character activity to pick up items from the given drop_locations. * Requires sufficient storage; items cannot be wielded or worn from this activity. */ @@ -2520,7 +2520,7 @@ class Character : public Creature, public visitable // gets all the spells known by this character that have this spell class // spells returned are a copy, do not try to edit them from here, instead use known_magic::get_spell std::vector spells_known_of_class( const trait_id &spell_class ) const; - bool cast_spell( spell &sp, bool fake_spell, const std::optional &target ); + bool cast_spell( spell &sp, bool fake_spell, const std::optional &target ); /** Called when a player triggers a trap, returns true if they don't set it off */ bool avoid_trap( const tripoint_bub_ms &pos, const trap &tr ) const override; @@ -2703,7 +2703,7 @@ class Character : public Creature, public visitable * 0 means climbing is not possible. * Return value can depend on the orientation of the terrain. */ - int climbing_cost( const tripoint &from, const tripoint &to ) const; + int climbing_cost( const tripoint_bub_ms &from, const tripoint_bub_ms &to ) const; /** Which body part has the most staunchable bleeding, and what is the max improvement */ bodypart_id most_staunchable_bp(); @@ -2746,7 +2746,7 @@ class Character : public Creature, public visitable player_activity stashed_outbounds_backlog; player_activity activity; std::list backlog; - std::optional destination_point; + std::optional destination_point; pimpl inv; itype_id last_item; private: @@ -2798,7 +2798,7 @@ class Character : public Creature, public visitable public: int cash = 0; weak_ptr_fast last_target; - std::optional last_target_pos; + std::optional last_target_pos; // Save favorite ammo location item_location ammo_location; // FIXME: The presence of camps should be global objects, this should only be knowledge of camps (at best) @@ -3199,7 +3199,7 @@ class Character : public Creature, public visitable /** Called when a stat is changed */ void on_stat_change( const std::string &stat, int value ) override; /** Returns an unoccupied, safe adjacent point. If none exists, returns player position. */ - tripoint adjacent_tile() const; + tripoint_bub_ms adjacent_tile() const; /** Returns true if the player has a trait which cancels the entered trait */ bool has_opposite_trait( const trait_id &flag ) const; /** Returns traits that cancel the entered trait */ @@ -3316,11 +3316,11 @@ class Character : public Creature, public visitable * Warmth from terrain, furniture, vehicle furniture and traps. * Can be negative. **/ - static units::temperature_delta floor_bedding_warmth( const tripoint &pos ); + static units::temperature_delta floor_bedding_warmth( const tripoint_bub_ms &pos ); /** Warmth from clothing on the floor **/ - static units::temperature_delta floor_item_warmth( const tripoint &pos ); + static units::temperature_delta floor_item_warmth( const tripoint_bub_ms &pos ); /** Final warmth from the floor **/ - units::temperature_delta floor_warmth( const tripoint &pos ) const; + units::temperature_delta floor_warmth( const tripoint_bub_ms &pos ) const; /** Correction factor of the body temperature due to traits and mutations **/ units::temperature_delta bodytemp_modifier_traits( bool overheated ) const; @@ -3490,7 +3490,7 @@ class Character : public Creature, public visitable * @param clear_path True to select only items within view. False to select all within the radius. * @returns Craftable inventory items found. * */ - const inventory &crafting_inventory( const tripoint &src_pos = tripoint::zero, + const inventory &crafting_inventory( const tripoint_bub_ms &src_pos = tripoint_bub_ms::zero, int radius = PICKUP_RANGE, bool clear_path = true ) const; void invalidate_crafting_inventory(); @@ -3499,11 +3499,11 @@ class Character : public Creature, public visitable * above 4.0 means these activities cannot be performed. * takes pos as a parameter so that remote spots can be judged * if they will potentially have enough light when player gets there */ - float fine_detail_vision_mod( const tripoint &p = tripoint::invalid ) const; + float fine_detail_vision_mod( const tripoint_bub_ms &p = tripoint_bub_ms::invalid ) const; // ---- CRAFTING ---- void make_craft_with_command( const recipe_id &id_to_make, int batch_size, bool is_long, - const std::optional &loc ); + const std::optional &loc ); pimpl last_craft; recipe_id lastrecipe; @@ -3554,11 +3554,8 @@ class Character : public Creature, public visitable // crafting.cpp float morale_crafting_speed_multiplier( const recipe &rec ) const; float lighting_craft_speed_multiplier( const recipe &rec, - const tripoint &p = tripoint::invalid ) const; + const tripoint_bub_ms &p = tripoint_bub_ms::invalid ) const; float crafting_speed_multiplier( const recipe &rec ) const; - // TODO: Get rid of untyped overload - float workbench_crafting_speed_multiplier( const item &craft, - const std::optional &loc )const; float workbench_crafting_speed_multiplier( const item &craft, const std::optional &loc )const; /** For use with in progress crafts. @@ -3566,10 +3563,6 @@ class Character : public Creature, public visitable * is expensive when numorous items are around. * So use pre-calculated cache if possible. */ - // TODO: Get rid of untyped overload - float crafting_speed_multiplier( const item &craft, const std::optional &loc, - bool use_cached_workbench_multiplier = false, float cached_workbench_multiplier = 0.0f - ) const; float crafting_speed_multiplier( const item &craft, const std::optional &loc, bool use_cached_workbench_multiplier = false, float cached_workbench_multiplier = 0.0f ) const; @@ -3594,17 +3587,17 @@ class Character : public Creature, public visitable * @param loc the location of the workbench. std::nullopt indicates crafting from inventory. * @param goto_recipe the recipe to display initially. A null recipe_id opens the default crafting screen. */ - void craft( const std::optional &loc = std::nullopt, + void craft( const std::optional &loc = std::nullopt, const recipe_id &goto_recipe = recipe_id(), const std::string &filterstring = "" ); - void recraft( const std::optional &loc = std::nullopt ); - void long_craft( const std::optional &loc = std::nullopt, + void recraft( const std::optional &loc = std::nullopt ); + void long_craft( const std::optional &loc = std::nullopt, const recipe_id &goto_recipe = recipe_id() ); void make_craft( const recipe_id &id, int batch_size, - const std::optional &loc = std::nullopt ); + const std::optional &loc = std::nullopt ); void make_all_craft( const recipe_id &id, int batch_size, - const std::optional &loc ); + const std::optional &loc ); /** consume components and create an active, in progress craft containing them */ - void start_craft( craft_command &command, const std::optional &loc ); + void start_craft( craft_command &command, const std::optional &loc ); struct craft_roll_data { float center; @@ -3624,8 +3617,6 @@ class Character : public Creature, public visitable float item_destruction_chance( const recipe &making ) const; craft_roll_data recipe_success_roll_data( const recipe &making ) const; craft_roll_data recipe_failure_roll_data( const recipe &making ) const; - // TODO: Get rid of untyped overload - void complete_craft( item &craft, const std::optional &loc ); void complete_craft( item &craft, const std::optional &loc ); /** * Check if the player meets the requirements to continue the in progress craft and if @@ -3691,7 +3682,7 @@ class Character : public Creature, public visitable const std::function &filter = return_true, bool select_ind = false ); std::list consume_items( map &m, const comp_selection &is, int batch, const std::function &filter = return_true, - const std::vector &reachable_pts = {}, bool select_ind = false ); + const std::vector &reachable_pts = {}, bool select_ind = false ); // Selects one entry in components using select_item_component and consumes those items. std::list consume_items( const std::vector &components, int batch = 1, const std::function &filter = return_true, @@ -3707,10 +3698,10 @@ class Character : public Creature, public visitable bool craft_consume_tools( item &craft, int multiplier, bool start_craft ); void consume_tools( const comp_selection &tool, int batch ); void consume_tools( map &m, const comp_selection &tool, int batch, - const tripoint &origin = tripoint::zero, int radius = PICKUP_RANGE, + const tripoint_bub_ms &origin = tripoint_bub_ms::zero, int radius = PICKUP_RANGE, basecamp *bcp = nullptr ); void consume_tools( map &m, const comp_selection &tool, int batch, - const std::vector &reachable_pts = {}, basecamp *bcp = nullptr ); + const std::vector &reachable_pts = {}, basecamp *bcp = nullptr ); void consume_tools( const std::vector &tools, int batch = 1 ); /** Checks permanent morale for consistency and recovers it when an inconsistency is found. */ @@ -3762,17 +3753,15 @@ class Character : public Creature, public visitable std::vector short_description_parts() const; std::string short_description() const; // Checks whether a player can hear a sound at a given volume and location. - bool can_hear( const tripoint &source, int volume ) const; + bool can_hear( const tripoint_bub_ms &source, int volume ) const; // Returns a multiplier indicating the keenness of a player's hearing. float hearing_ability() const; using trap_map = std::map; // Use @ref trap::can_see to check whether a character knows about a // specific trap - it will consider visible and known traps. - // TODO: Get rid of untyped overload. - bool knows_trap( const tripoint &pos ) const; bool knows_trap( const tripoint_bub_ms &pos ) const; - void add_known_trap( const tripoint &pos, const trap &t ); + void add_known_trap( const tripoint_bub_ms &pos, const trap &t ); // see Creature::sees bool sees( const tripoint &t, bool is_avatar = false, int range_mod = 0 ) const override; @@ -3785,7 +3774,7 @@ class Character : public Creature, public visitable // used in debugging all health int get_lowest_hp() const; bool has_weapon() const override; - void shift_destination( const point &shift ); + void shift_destination( const point_rel_ms &shift ); // Auto move methods void set_destination( const std::vector &route, const player_activity &new_destination_activity = player_activity() ); @@ -3805,7 +3794,7 @@ class Character : public Creature, public visitable void start_destination_activity(); std::vector &get_auto_move_route(); action_id get_next_auto_move_direction(); - bool defer_move( const tripoint &next ); + bool defer_move( const tripoint_bub_ms &next ); time_duration get_consume_time( const item &it ) const; // For display purposes mainly, how far we are from the next level of weariness @@ -3876,7 +3865,6 @@ class Character : public Creature, public visitable * selected. Out of each mutation with selected comfort data, the comfort data with the * lowest `base_comfort` is selected and returned. */ - const comfort_data &get_comfort_data_for( const tripoint &p ) const; const comfort_data &get_comfort_data_for( const tripoint_bub_ms &p ) const; /** * Calculates and caches the comfort of a location. Returns cached comfort if valid. @@ -3885,7 +3873,6 @@ class Character : public Creature, public visitable * Comfort is considered valid until any time has passed or a new location is evaluated. * Gaining or losing mutations does not currently invalidate cached comfort. */ - const comfort_data::response &get_comfort_at( const tripoint &p ); const comfort_data::response &get_comfort_at( const tripoint_bub_ms &p ); comfort_data::response comfort_cache; @@ -4134,7 +4121,7 @@ class Character : public Creature, public visitable bool valid = false; // other fields are only valid if this flag is true time_point time; int moves; - tripoint position; + tripoint_bub_ms position; int radius; pimpl crafting_inventory; }; diff --git a/src/character_body.cpp b/src/character_body.cpp index 654b832273920..42e5754e50dc3 100644 --- a/src/character_body.cpp +++ b/src/character_body.cpp @@ -508,7 +508,8 @@ void Character::update_bodytemp() 0_C_delta; const int best_fire = get_best_fire( pos_bub() ); - const units::temperature_delta lying_warmth = use_floor_warmth ? floor_warmth( pos() ) : 0_C_delta; + const units::temperature_delta lying_warmth = use_floor_warmth ? floor_warmth( + pos_bub() ) : 0_C_delta; const units::temperature water_temperature = get_weather().get_cur_weather_gen().get_water_temperature(); diff --git a/src/character_escape.cpp b/src/character_escape.cpp index 188f386a0a148..5d16770b8f7fa 100644 --- a/src/character_escape.cpp +++ b/src/character_escape.cpp @@ -258,7 +258,7 @@ bool Character::try_remove_grab( bool attacking ) pd[index]->get_name(), sturdiness, chance ); // the item is ripped off your character if( sturdiness < chance ) { - pd[index]->spill_contents( adjacent_tile() ); + pd[index]->spill_contents( adjacent_tile().raw() ); add_msg_player_or_npc( m_bad, _( "As you struggle to escape the grab something comes loose and falls to the ground!" ), _( "As struggles to escape the grab something comes loose and falls to the ground!" ) ); diff --git a/src/character_inventory.cpp b/src/character_inventory.cpp index 7fc9c54a62ef8..7ccaf27c76cf3 100644 --- a/src/character_inventory.cpp +++ b/src/character_inventory.cpp @@ -581,13 +581,13 @@ int Character::get_item_position( const item *it ) const return inv->position_by_item( it ); } -void Character::drop( item_location loc, const tripoint &where ) +void Character::drop( item_location loc, const tripoint_bub_ms &where ) { drop( { std::make_pair( loc, loc->count() ) }, where ); invalidate_inventory_validity_cache(); } -void Character::drop( const drop_locations &what, const tripoint &target, +void Character::drop( const drop_locations &what, const tripoint_bub_ms &target, bool stash ) { if( what.empty() ) { @@ -595,14 +595,14 @@ void Character::drop( const drop_locations &what, const tripoint &target, } invalidate_leak_level_cache(); const std::optional vp = get_map().veh_at( target ).cargo(); - if( rl_dist( pos_bub().raw(), target ) > 1 || !( stash || get_map().can_put_items( target ) ) + if( rl_dist( pos_bub(), target ) > 1 || !( stash || get_map().can_put_items( target ) ) || ( vp.has_value() && vp->part().is_cleaner_on() ) ) { add_msg_player_or_npc( m_info, _( "You can't place items here!" ), _( " can't place items here!" ) ); return; } - const tripoint_rel_ms placement = tripoint_rel_ms( target - pos() ); + const tripoint_rel_ms placement = target - pos_bub(); std::vector items; for( drop_location item_pair : what ) { if( is_avatar() && vp.has_value() && item_pair.first->is_bucket_nonempty() && diff --git a/src/condition.cpp b/src/condition.cpp index f05c395bbf597..d6faf1a8dcff1 100644 --- a/src/condition.cpp +++ b/src/condition.cpp @@ -937,7 +937,7 @@ conditional_t::func f_has_items_sum( const JsonObject &jo, const std::string_vie double charges_present; double total_present; const Character *you = d.const_actor( is_npc )->get_const_character(); - inventory inventory_and_around = you->crafting_inventory( you->pos(), PICKUP_RANGE ); + inventory inventory_and_around = you->crafting_inventory( you->pos_bub(), PICKUP_RANGE ); for( const auto &pair : item_and_amount ) { item_to_find = itype_id( pair.first.evaluate( d ) ); diff --git a/src/construction.cpp b/src/construction.cpp index 8fca679b5dead..59d51ff14bbc4 100644 --- a/src/construction.cpp +++ b/src/construction.cpp @@ -2127,8 +2127,7 @@ void construct::do_turn_shovel( const tripoint_bub_ms &p, Character &who ) //~ Sound of a shovel digging a pit at work! sounds::sound( p.raw(), 10, sounds::sound_t::activity, _( "hsh!" ) ); } - // TODO: fix point types - if( !who.knows_trap( p.raw() ) ) { + if( !who.knows_trap( p ) ) { get_map().maybe_trigger_trap( p, who, true ); } } diff --git a/src/craft_command.cpp b/src/craft_command.cpp index fee98317cfeff..dcc0ba44698b3 100644 --- a/src/craft_command.cpp +++ b/src/craft_command.cpp @@ -115,7 +115,13 @@ template void comp_selection::deserialize( const JsonObject &data ); void craft_command::execute( const std::optional &new_loc ) { - loc = new_loc; + // TODO: Get rid of this when operation typified. + std::optional temp; + if( new_loc.has_value() ) { + temp = tripoint_bub_ms( new_loc.value() ); + } + + loc = temp; execute(); } diff --git a/src/craft_command.h b/src/craft_command.h index d96000de7dcbc..0c2a05b08e96f 100644 --- a/src/craft_command.h +++ b/src/craft_command.h @@ -116,7 +116,7 @@ class craft_command // Location of the workbench to place the item on // zero_tripoint indicates crafting without a workbench - std::optional loc; + std::optional loc; std::vector> item_selections; std::vector> tool_selections; diff --git a/src/crafting.cpp b/src/crafting.cpp index d3ea3b5f4a8ba..932d545b4ed08 100644 --- a/src/crafting.cpp +++ b/src/crafting.cpp @@ -165,7 +165,8 @@ static bool crafting_allowed( const Character &p, const recipe &rec ) return true; } -float Character::lighting_craft_speed_multiplier( const recipe &rec, const tripoint &p ) const +float Character::lighting_craft_speed_multiplier( const recipe &rec, + const tripoint_bub_ms &p ) const { // negative is bright, 0 is just bright enough, positive is dark, +7.0f is pitch black float darkness = fine_detail_vision_mod( p ) - 4.0f; @@ -245,7 +246,7 @@ static float lerped_multiplier( const T &value, const T &low, const T &high ) } float Character::workbench_crafting_speed_multiplier( const item &craft, - const std::optional &loc )const + const std::optional &loc )const { float multiplier; units::mass allowed_mass; @@ -299,16 +300,6 @@ float Character::workbench_crafting_speed_multiplier( const item &craft, return multiplier; } -float Character::workbench_crafting_speed_multiplier( const item &craft, - const std::optional &loc )const -{ - std::optional tmp; - if( loc.has_value() ) { - tmp = loc.value().raw(); - } - return Character::workbench_crafting_speed_multiplier( craft, tmp ); -} - float Character::crafting_speed_multiplier( const recipe &rec ) const { @@ -331,7 +322,7 @@ float Character::crafting_speed_multiplier( const recipe &rec ) const } float Character::crafting_speed_multiplier( const item &craft, - const std::optional &loc, bool use_cached_workbench_multiplier, + const std::optional &loc, bool use_cached_workbench_multiplier, float cached_workbench_multiplier ) const { if( !craft.is_craft() ) { @@ -353,7 +344,7 @@ float Character::crafting_speed_multiplier( const item &craft, const float limb_score = rec.has_flag( flag_NO_MANIP ) ? 1.0f : get_limb_score( limb_score_manip ); const float pain_multi = rec.has_flag( flag_AFFECTED_BY_PAIN ) ? std::max( 0.0f, - 1.0f - ( get_perceived_pain() / 100.0f ) ) : 1.0f ; + 1.0f - ( get_perceived_pain() / 100.0f ) ) : 1.0f; const float total_multi = light_multi * bench_multi * morale_multi * mut_multi * limb_score * pain_multi; @@ -399,24 +390,12 @@ float Character::crafting_speed_multiplier( const item &craft, return total_multi; } -float Character::crafting_speed_multiplier( const item &craft, - const std::optional &loc, bool use_cached_workbench_multiplier, - float cached_workbench_multiplier ) const -{ - std::optional tmp; - if( loc.has_value() ) { - tmp = loc.value().raw(); - } - return Character::crafting_speed_multiplier( craft, tmp, use_cached_workbench_multiplier, - cached_workbench_multiplier ); -} - bool Character::has_morale_to_craft() const { return get_morale_level() >= -50; } -void Character::craft( const std::optional &loc, const recipe_id &goto_recipe, +void Character::craft( const std::optional &loc, const recipe_id &goto_recipe, const std::string &filterstring ) { int batch_size = 0; @@ -434,7 +413,7 @@ void Character::craft( const std::optional &loc, const recipe_id &goto } } -void Character::recraft( const std::optional &loc ) +void Character::recraft( const std::optional &loc ) { if( lastrecipe.str().empty() ) { popup( _( "Craft something first" ) ); @@ -443,7 +422,8 @@ void Character::recraft( const std::optional &loc ) } } -void Character::long_craft( const std::optional &loc, const recipe_id &goto_recipe ) +void Character::long_craft( const std::optional &loc, + const recipe_id &goto_recipe ) { int batch_size = 0; const auto [crafter, rec] = select_crafter_and_crafting_recipe( batch_size, goto_recipe, this ); @@ -653,15 +633,15 @@ bool Character::can_start_craft( const recipe *rec, recipe_filter_flags flags, const inventory &Character::crafting_inventory( bool clear_path ) const { - return crafting_inventory( tripoint::zero, PICKUP_RANGE, clear_path ); + return crafting_inventory( tripoint_bub_ms::zero, PICKUP_RANGE, clear_path ); } -const inventory &Character::crafting_inventory( const tripoint &src_pos, int radius, +const inventory &Character::crafting_inventory( const tripoint_bub_ms &src_pos, int radius, bool clear_path ) const { - tripoint inv_pos = src_pos; - if( src_pos == tripoint::zero ) { - inv_pos = pos(); + tripoint_bub_ms inv_pos = src_pos; + if( src_pos == tripoint_bub_ms::zero ) { + inv_pos = pos_bub(); } if( crafting_cache.valid && moves == crafting_cache.moves @@ -673,7 +653,7 @@ const inventory &Character::crafting_inventory( const tripoint &src_pos, int rad } crafting_cache.crafting_inventory->clear(); if( radius >= 0 ) { - crafting_cache.crafting_inventory->form_from_map( inv_pos, radius, this, false, clear_path ); + crafting_cache.crafting_inventory->form_from_map( inv_pos.raw(), radius, this, false, clear_path ); } std::map tmp_liq_list; @@ -721,19 +701,19 @@ void Character::invalidate_crafting_inventory() } void Character::make_craft( const recipe_id &id_to_make, int batch_size, - const std::optional &loc ) + const std::optional &loc ) { make_craft_with_command( id_to_make, batch_size, false, loc ); } void Character::make_all_craft( const recipe_id &id_to_make, int batch_size, - const std::optional &loc ) + const std::optional &loc ) { make_craft_with_command( id_to_make, batch_size, true, loc ); } void Character::make_craft_with_command( const recipe_id &id_to_make, int batch_size, bool is_long, - const std::optional &loc ) + const std::optional &loc ) { const recipe &recipe_to_make = *id_to_make; @@ -741,7 +721,13 @@ void Character::make_craft_with_command( const recipe_id &id_to_make, int batch_ return; } - *last_craft = craft_command( &recipe_to_make, batch_size, is_long, this, loc ); + // TODO: Get rid of this when craft_command is typified. + std::optional temp; + if( loc.has_value() ) { + temp = loc.value().raw(); + } + + *last_craft = craft_command( &recipe_to_make, batch_size, is_long, this, temp ); last_craft->execute(); } @@ -801,7 +787,8 @@ static item_location set_item_map( const tripoint &loc, item &newit ) /** * Set an item on the map or in a vehicle and return the new location */ -static item_location set_item_map_or_vehicle( const Character &p, const tripoint &loc, item &newit ) +static item_location set_item_map_or_vehicle( const Character &p, const tripoint_bub_ms &loc, + item &newit ) { map &here = get_map(); if( const std::optional vp = here.veh_at( loc ).cargo() ) { @@ -824,7 +811,7 @@ static item_location set_item_map_or_vehicle( const Character &p, const tripoint "Not enough space on the %1$s. drops the %2$s on the ground." ), vp->part().name(), newit.tname() ); - return set_item_map( loc, newit ); + return set_item_map( loc.raw(), newit ); } else { if( here.has_furn( loc ) ) { @@ -840,12 +827,12 @@ static item_location set_item_map_or_vehicle( const Character &p, const tripoint pgettext( "item", " puts the %s on the ground." ), newit.tname() ); } - return set_item_map( loc, newit ); + return set_item_map( loc.raw(), newit ); } } static item_location place_craft_or_disassembly( - Character &ch, item &craft, std::optional target ) + Character &ch, item &craft, std::optional target ) { item_location craft_in_world; @@ -859,14 +846,14 @@ static item_location place_craft_or_disassembly( if( const cata::value_ptr &wb = here.furn( adj ).obj().workbench ) { if( wb->multiplier > best_bench_multi ) { best_bench_multi = wb->multiplier; - target = adj.raw(); + target = adj; } } else if( const std::optional vp = here.veh_at( adj ).part_with_feature( "WORKBENCH", true ) ) { if( const std::optional &wb_info = vp->part().info().workbench_info ) { if( wb_info->multiplier > best_bench_multi ) { best_bench_multi = wb_info->multiplier; - target = adj.raw(); + target = adj; } } else { debugmsg( "part '%s' with WORKBENCH flag has no workbench info", vp->part().name() ); @@ -877,7 +864,7 @@ static item_location place_craft_or_disassembly( // Crafting without a workbench if( !target ) { if( !ch.has_two_arms_lifting() ) { - craft_in_world = set_item_map_or_vehicle( ch, ch.pos(), craft ); + craft_in_world = set_item_map_or_vehicle( ch, ch.pos_bub(), craft ); } else if( !ch.has_wield_conflicts( craft ) || ch.is_npc() ) { // NPC always tries wield craft first if( std::optional it_loc = wield_craft( ch, craft ) ) { @@ -919,7 +906,7 @@ static item_location place_craft_or_disassembly( break; } case DROP_CRAFT: { - craft_in_world = set_item_map_or_vehicle( ch, ch.pos(), craft ); + craft_in_world = set_item_map_or_vehicle( ch, ch.pos_bub(), craft ); break; } case STASH: { @@ -934,6 +921,7 @@ static item_location place_craft_or_disassembly( } } else { // We have a workbench, put the item there. + craft_in_world = set_item_map_or_vehicle( ch, *target, craft ); } @@ -944,7 +932,7 @@ static item_location place_craft_or_disassembly( return craft_in_world; } -void Character::start_craft( craft_command &command, const std::optional &loc ) +void Character::start_craft( craft_command &command, const std::optional &loc ) { if( command.empty() ) { debugmsg( "Attempted to start craft with empty command" ); @@ -1472,7 +1460,7 @@ static void set_temp_rot( item &newit, const double relative_rot, const bool sho } static void spawn_items( Character &guy, std::vector &results, - const std::optional &loc, const double relative_rot, const bool should_heat, + const std::optional &loc, const double relative_rot, const bool should_heat, bool allow_wield = false ) { for( item &newit : results ) { @@ -1493,12 +1481,12 @@ static void spawn_items( Character &guy, std::vector &results, } else if( !loc ) { set_item_inventory( guy, newit ); } else { - set_item_map_or_vehicle( guy, loc.value_or( guy.pos() ), newit ); + set_item_map_or_vehicle( guy, loc.value_or( guy.pos_bub() ), newit ); } } } -void Character::complete_craft( item &craft, const std::optional &loc ) +void Character::complete_craft( item &craft, const std::optional &loc ) { if( !craft.is_craft() ) { debugmsg( "complete_craft() called on non-craft '%s.' Aborting.", craft.tname() ); @@ -1583,15 +1571,6 @@ void Character::complete_craft( item &craft, const std::optional &loc } } -void Character::complete_craft( item &craft, const std::optional &loc ) -{ - std::optional tmp; - if( loc.has_value() ) { - tmp = loc.value().raw(); - } - Character::complete_craft( craft, tmp ); -} - bool Character::can_continue_craft( item &craft ) { if( !craft.is_craft() ) { @@ -2078,13 +2057,14 @@ std::list Character::consume_items( const comp_selection &is, i return ret; } // populate a grid of spots that can be reached - std::vector reachable_pts; - m.reachable_flood_steps( reachable_pts, pos(), PICKUP_RANGE, 1, 100 ); + std::vector reachable_pts; + m.reachable_flood_steps( reachable_pts, pos_bub(), PICKUP_RANGE, 1, 100 ); return consume_items( m, is, batch, filter, reachable_pts, select_ind ); } std::list Character::consume_items( map &m, const comp_selection &is, int batch, - const std::function &filter, const std::vector &reachable_pts, + const std::function &filter, + const std::vector &reachable_pts, bool select_ind ) { auto preferred_filter = [&filter]( const item & it ) { @@ -2236,7 +2216,7 @@ Character::select_tool_component( const std::vector &tools, int batch itype_id type = it->type; if( it->count > 0 ) { const int count = calc_charges( *it ); - if( player_inv && crafting_inventory( pos(), -1 ).has_charges( type, count ) ) { + if( player_inv && crafting_inventory( pos_bub(), -1 ).has_charges( type, count ) ) { player_has.push_back( *it ); } if( map_inv.has_charges( type, count ) ) { @@ -2445,12 +2425,12 @@ bool Character::craft_consume_tools( item &craft, int multiplier, bool start_cra void Character::consume_tools( const comp_selection &tool, int batch ) { - consume_tools( get_map(), tool, batch, pos(), PICKUP_RANGE ); + consume_tools( get_map(), tool, batch, pos_bub(), PICKUP_RANGE ); } /* we use this if we selected the tool earlier */ void Character::consume_tools( map &m, const comp_selection &tool, int batch, - const tripoint &origin, int radius, basecamp *bcp ) + const tripoint_bub_ms &origin, int radius, basecamp *bcp ) { if( has_trait( trait_DEBUG_HS ) ) { return; @@ -2474,7 +2454,7 @@ void Character::consume_tools( map &m, const comp_selection &tool, in } void Character::consume_tools( map &m, const comp_selection &tool, int batch, - const std::vector &reachable_pts, basecamp *bcp ) + const std::vector &reachable_pts, basecamp *bcp ) { if( has_trait( trait_DEBUG_HS ) ) { return; @@ -3161,7 +3141,7 @@ item_location npc::get_item_to_craft() return to_craft; } -void npc::do_npc_craft( const std::optional &loc, const recipe_id &goto_recipe ) +void npc::do_npc_craft( const std::optional &loc, const recipe_id &goto_recipe ) { std::vector craft_item_list; std::string dummy; diff --git a/src/debug_menu.cpp b/src/debug_menu.cpp index 60a7c7f994a35..2bfd911e463a4 100644 --- a/src/debug_menu.cpp +++ b/src/debug_menu.cpp @@ -2429,7 +2429,7 @@ static void character_edit_menu() you.remove_weapon(); break; case D_DROP_ITEMS: - you.drop( game_menus::inv::multidrop( you ), you.pos() ); + you.drop( game_menus::inv::multidrop( you ), you.pos_bub() ); break; case D_ITEM_WORN: { item_location loc = game_menus::inv::titled_menu( player_character, _( "Make target equip" ) ); diff --git a/src/game.cpp b/src/game.cpp index 903f90b411de9..97bc2e170c103 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2372,7 +2372,7 @@ int game::inventory_item_menu( item_location locThisItem, u.takeoff( locThisItem.obtain( u ) ); break; case 'd': - u.drop( locThisItem, u.pos() ); + u.drop( locThisItem, u.pos_bub() ); break; case 'U': u.unload( locThisItem ); @@ -9289,13 +9289,13 @@ void game::insert_item() void game::unload_container() { if( const std::optional pnt = choose_adjacent_bub( _( "Unload where?" ) ) ) { - u.drop( game_menus::inv::unload_container(), pnt->raw() ); + u.drop( game_menus::inv::unload_container(), *pnt ); } } void game::drop_in_direction( const tripoint_bub_ms &pnt ) { - u.drop( game_menus::inv::multidrop( u ), pnt.raw() ); + u.drop( game_menus::inv::multidrop( u ), pnt ); } // Used to set up the first Hotkey in the display set @@ -12179,7 +12179,7 @@ void game::vertical_move( int movez, bool force, bool peeking ) return; } - const int cost = u.climbing_cost( u.pos_bub().raw(), stairs.raw() ); + const int cost = u.climbing_cost( u.pos_bub(), stairs ); add_msg_debug( debugmode::DF_GAME, "Climb cost %d", cost ); const bool can_climb_here = cost > 0 || u.has_flag( json_flag_CLIMB_NO_LADDER ) || wall_cling || climb_flying; @@ -12876,11 +12876,11 @@ point_rel_sm game::update_map( int &x, int &y, bool z_level_changed ) // Shift monsters shift_monsters( { shift, 0 } ); const point_rel_ms shift_ms = coords::project_to( shift ); - u.shift_destination( -shift_ms.raw() ); + u.shift_destination( -shift_ms ); // Shift NPCs for( auto it = critter_tracker->active_npc.begin(); it != critter_tracker->active_npc.end(); ) { - ( *it )->shift( shift.raw() ); + ( *it )->shift( shift ); if( ( *it )->posx() < 0 || ( *it )->posx() >= MAPSIZE_X || ( *it )->posy() < 0 || ( *it )->posy() >= MAPSIZE_Y ) { //Remove the npc from the active list. It remains in the overmap list. @@ -13796,7 +13796,7 @@ void game::climb_down_using( const tripoint_bub_ms &examp, climbing_aid_id aid_i // Scan the height of the drop and what's in the way. const climbing_aid::fall_scan fall( examp.raw() ); - int estimated_climb_cost = you.climbing_cost( fall.pos_bottom(), examp.raw() ); + int estimated_climb_cost = you.climbing_cost( tripoint_bub_ms( fall.pos_bottom() ), examp ); const float fall_mod = you.fall_damage_mod(); add_msg_debug( debugmode::DF_IEXAMINE, "Climb cost %d", estimated_climb_cost ); add_msg_debug( debugmode::DF_IEXAMINE, "Fall damage modifier %.2f", fall_mod ); diff --git a/src/handle_action.cpp b/src/handle_action.cpp index 527f0f6243d84..80704eb911ea3 100644 --- a/src/handle_action.cpp +++ b/src/handle_action.cpp @@ -1882,7 +1882,7 @@ static void cast_spell() // returns true if the spell was assigned bool Character::cast_spell( spell &sp, bool fake_spell, - const std::optional &target = std::nullopt ) + const std::optional &target = std::nullopt ) { if( is_armed() && !sp.no_hands() && !has_flag( json_flag_SUBTLE_SPELL ) && !get_wielded_item()->has_flag( flag_MAGIC_FOCUS ) && !sp.check_if_component_in_hand( *this ) ) { diff --git a/src/iexamine.cpp b/src/iexamine.cpp index c5f5b5ac48820..fb7f80e7588d8 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -7291,7 +7291,7 @@ void iexamine::workbench_internal( Character &you, const tripoint_bub_ms &examp, } else if( you.has_effect( effect_incorporeal ) ) { add_msg( m_info, _( "You lack the substance to affect anything." ) ); } else { - you.craft( examp.raw() ); + you.craft( examp ); } break; } @@ -7301,7 +7301,7 @@ void iexamine::workbench_internal( Character &you, const tripoint_bub_ms &examp, } else if( you.has_effect( effect_incorporeal ) ) { add_msg( m_info, _( "You lack the substance to affect anything." ) ); } else { - you.recraft( examp.raw() ); + you.recraft( examp ); } break; } @@ -7311,7 +7311,7 @@ void iexamine::workbench_internal( Character &you, const tripoint_bub_ms &examp, } else if( you.has_effect( effect_incorporeal ) ) { add_msg( m_info, _( "You lack the substance to affect anything." ) ); } else { - you.long_craft( examp.raw() ); + you.long_craft( examp ); } break; } diff --git a/src/iuse.cpp b/src/iuse.cpp index c917647e26000..f437826283e7e 100644 --- a/src/iuse.cpp +++ b/src/iuse.cpp @@ -3263,7 +3263,7 @@ std::optional iuse::geiger_active( Character *, item *, const tripoint_bub_ rads > 25 ? _( "geiger_medium" ) : _( "geiger_low" ); sounds::sound( pos, 6, sounds::sound_t::alarm, description, true, "tool", sound_var ); - if( !get_avatar().can_hear( pos.raw(), 6 ) ) { + if( !get_avatar().can_hear( pos, 6 ) ) { // can not hear it, but may have alarmed other creatures return 1; } @@ -3865,7 +3865,7 @@ void iuse::play_music( Character *p, const tripoint_bub_ms &source, const int vo std::string sound = "music"; auto lambda_should_do_effects = [&source, &volume]( Character * p ) { - return p && p->can_hear( source.raw(), volume ) && !p->in_sleep_state(); + return p && p->can_hear( source, volume ) && !p->in_sleep_state(); }; auto lambda_add_music_effects = [&max_morale, &volume]( Character & guy ) { @@ -4146,7 +4146,7 @@ std::optional iuse::portable_game( Character *p, item *it, const tripoint_b // number of nearby friends with gaming devices std::vector friends_w_game = g->get_npcs_if( [&it, p]( const npc & n ) { return n.is_player_ally() && p->sees( n ) && - n.can_hear( p->pos(), p->get_shout_volume() ) && + n.can_hear( p->pos_bub(), p->get_shout_volume() ) && n.has_item_with( [&it]( const item & i ) { return i.typeId() == it->typeId() && i.ammo_sufficient( nullptr ); } ); @@ -8862,7 +8862,7 @@ std::optional iuse::play_game( Character *p, item *it, const tripoint_bub_m { if( p->is_avatar() ) { std::vector followers = g->get_npcs_if( [p]( const npc & n ) { - return n.is_ally( *p ) && p->sees( n ) && n.can_hear( p->pos(), p->get_shout_volume() ); + return n.is_ally( *p ) && p->sees( n ) && n.can_hear( p->pos_bub(), p->get_shout_volume() ); } ); int fcount = followers.size(); if( fcount > 0 ) { diff --git a/src/iuse_actor.cpp b/src/iuse_actor.cpp index 333faba88848b..bec793fffd336 100644 --- a/src/iuse_actor.cpp +++ b/src/iuse_actor.cpp @@ -2324,7 +2324,7 @@ std::optional musical_instrument_actor::use( Character *p, item &it, it.typeId().str() ); } - if( !p->has_effect( effect_music ) && p->can_hear( p->pos(), volume ) ) { + if( !p->has_effect( effect_music ) && p->can_hear( p->pos_bub(), volume ) ) { // Sound code doesn't describe noises at the player position if( desc != "music" ) { p->add_msg_if_player( m_info, desc ); @@ -3971,7 +3971,7 @@ static void place_and_add_as_known( Character &p, const tripoint_bub_ms &pos, here.trap_set( pos, id ); const trap &tr = here.tr_at( pos ); if( !tr.can_see( pos, p ) ) { - p.add_known_trap( pos.raw(), tr ); + p.add_known_trap( pos, tr ); } } diff --git a/src/magic.cpp b/src/magic.cpp index a5e591525165c..a713504748cb0 100644 --- a/src/magic.cpp +++ b/src/magic.cpp @@ -1188,7 +1188,7 @@ bool spell::can_cast( const Character &guy ) const } if( !type->spell_components.is_empty() && - !type->spell_components->can_make_with_inventory( guy.crafting_inventory( guy.pos(), 0, false ), + !type->spell_components->can_make_with_inventory( guy.crafting_inventory( guy.pos_bub(), 0, false ), return_true ) ) { return false; } @@ -2851,14 +2851,14 @@ void spellcasting_callback::display_spell_info( size_t index ) ImGui::NewLine(); if( !sp.components().get_components().empty() ) { for( const std::string &line : sp.components().get_folded_components_list( - 0, c_light_gray, pc.crafting_inventory( pc.pos(), 0, false ), return_true ) ) { + 0, c_light_gray, pc.crafting_inventory( pc.pos_bub(), 0, false ), return_true ) ) { cataimgui::TextColoredParagraph( c_white, line ); ImGui::NewLine(); } } if( !( sp.components().get_tools().empty() && sp.components().get_qualities().empty() ) ) { for( const std::string &line : sp.components().get_folded_tools_list( - 0, c_light_gray, pc.crafting_inventory( pc.pos(), 0, false ) ) ) { + 0, c_light_gray, pc.crafting_inventory( pc.pos_bub(), 0, false ) ) ) { cataimgui::TextColoredParagraph( c_white, line ); ImGui::NewLine(); } diff --git a/src/map.cpp b/src/map.cpp index 403803ca041e2..5bf5c9b18b78a 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -6693,7 +6693,7 @@ void map::remove_trap( const tripoint_bub_ms &p ) if( player_character.sees( p ) ) { player_character.memorize_clear_decoration( getglobal( p ), "tr_" ); } - player_character.add_known_trap( p.raw(), tr_null.obj() ); + player_character.add_known_trap( p, tr_null.obj() ); } current_submap->set_trap( l, tr_null ); @@ -10451,7 +10451,7 @@ void map::maybe_trigger_prox_trap( const tripoint_bub_ms &pos, Creature &c, Character *const pl = c.as_character(); if( !tr.is_always_invisible() && pl && !pl->knows_trap( pos ) ) { pl->add_msg_if_player( _( "You've spotted a %1$s!" ), tr.name() ); - pl->add_known_trap( pos.raw(), tr ); + pl->add_known_trap( pos, tr ); } return; } @@ -10614,7 +10614,7 @@ void map::maybe_trigger_trap( const tripoint_bub_ms &pos, Creature &c, const boo Character *const pl = c.as_character(); if( !tr.is_always_invisible() && pl && !pl->knows_trap( pos ) ) { pl->add_msg_if_player( _( "You've spotted a %1$s!" ), tr.name() ); - pl->add_known_trap( pos.raw(), tr ); + pl->add_known_trap( pos, tr ); } return; } diff --git a/src/mattack_actors.cpp b/src/mattack_actors.cpp index 701471698ffc8..97f51ecacdf32 100644 --- a/src/mattack_actors.cpp +++ b/src/mattack_actors.cpp @@ -1266,7 +1266,7 @@ bool gun_actor::shoot( monster &z, const tripoint_bub_ms &target, const gun_mode return false; } z.mod_moves( -move_cost ); - standard_npc tmp( _( "The " ) + z.name(), z.pos(), {}, 8, + standard_npc tmp( _( "The " ) + z.name(), z.pos_bub(), {}, 8, fake_str, fake_dex, fake_int, fake_per ); tmp.worn.wear_item( tmp, item( "backpack" ), false, false, true, true ); tmp.set_fake( true ); diff --git a/src/monexamine.cpp b/src/monexamine.cpp index 4c6fc0b128716..bac20cbf2c1d4 100644 --- a/src/monexamine.cpp +++ b/src/monexamine.cpp @@ -309,7 +309,7 @@ bool give_items_to( monster &z ) return true; } z.add_effect( effect_controlled, 5_turns ); - player_character.drop( to_move, z.pos(), true ); + player_character.drop( to_move, z.pos_bub(), true ); // Print an appropriate message for the inserted item or items if( to_move.size() > 1 ) { add_msg( _( "You put %1$s items in the %2$s on your %3$s." ), to_move.size(), storage.tname(), diff --git a/src/npc.cpp b/src/npc.cpp index b12d6c78a2f05..9426d4c7af9b6 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -267,12 +267,12 @@ npc::npc() } } -standard_npc::standard_npc( const std::string &name, const tripoint &pos, +standard_npc::standard_npc( const std::string &name, const tripoint_bub_ms &pos, const std::vector &clothing, int sk_lvl, int s_str, int s_dex, int s_int, int s_per ) { this->name = name; - set_pos_only( tripoint_bub_ms( pos ) ); + set_pos_only( pos ); if( !getID().is_valid() ) { setID( g->assign_npc_id() ); } @@ -1554,7 +1554,7 @@ bool npc::wield( item &it ) return true; } -void npc::drop( const drop_locations &what, const tripoint &target, +void npc::drop( const drop_locations &what, const tripoint_bub_ms &target, bool stash ) { Character::drop( what, target, stash ); @@ -2897,11 +2897,11 @@ static void maybe_shift( tripoint_bub_ms &pos, const point &d ) } } -void npc::shift( const point &s ) +void npc::shift( const point_rel_sm &s ) { - const point shift = coords::project_to( point_rel_sm( s ) ).raw(); + const point_rel_ms shift = coords::project_to( s ); // TODO: convert these to absolute coords and get rid of shift() - maybe_shift( wanted_item_pos, point( -shift.x, -shift.y ) ); + maybe_shift( wanted_item_pos, point( -shift.x(), -shift.y() ) ); path.clear(); } @@ -2936,7 +2936,7 @@ void npc::reboot() ai_cache.ally.reset(); ai_cache.can_heal.clear_all(); ai_cache.sound_alerts.clear(); - ai_cache.s_abs_pos = tripoint::zero; + ai_cache.s_abs_pos = tripoint_abs_ms::zero; ai_cache.stuck = 0; ai_cache.guard_pos = std::nullopt; ai_cache.my_weapon_value = 0; diff --git a/src/npc.h b/src/npc.h index 59466cfdc7f87..b640d177e7659 100644 --- a/src/npc.h +++ b/src/npc.h @@ -504,7 +504,7 @@ struct npc_follower_rules { }; struct dangerous_sound { - tripoint abs_pos; + tripoint_abs_ms abs_pos; sounds::sound_t type = sounds::sound_t::LAST; int volume = 0; }; @@ -539,7 +539,7 @@ struct npc_short_term_cache { // map of positions / type / volume of suspicious sounds std::vector sound_alerts; // current sound position being investigated - tripoint s_abs_pos; + tripoint_abs_ms s_abs_pos; // number of times we haven't moved when investigating a sound int stuck = 0; // Position to return to guarding @@ -558,7 +558,7 @@ struct npc_short_term_cache { std::vector dangerous_explosives; std::map threat_map; // Cache of locations the NPC has searched recently in npc::find_item() - lru_cache searched_tiles; + lru_cache searched_tiles; // returns the value of the distance between a friendly creature and the closest enemy to that // friendly creature. // returns nullopt if not applicable @@ -955,7 +955,7 @@ class npc : public Character void do_npc_read( bool ebook = false ); void stow_item( item &it ); bool wield( item &it ) override; - void drop( const drop_locations &what, const tripoint &target, + void drop( const drop_locations &what, const tripoint_bub_ms &target, bool stash ) override; bool adjust_worn(); bool has_healing_item( healing_options try_to_fix ); @@ -1072,7 +1072,8 @@ class npc : public Character // wrapper for complain_about that warns about a specific type of threat, with // different warnings for hostile or friendly NPCs and hostile NPCs always complaining void warn_about( const std::string &type, const time_duration &d = 10_minutes, - const std::string &name = "", int range = -1, const tripoint &danger_pos = tripoint::zero ); + const std::string &name = "", int range = -1, + const tripoint_bub_ms &danger_pos = tripoint_bub_ms::zero ); // return snippet strings by given range std::string distance_string( int range ) const; @@ -1080,7 +1081,7 @@ class npc : public Character bool complain(); void handle_sound( sounds::sound_t priority, const std::string &description, - int heard_volume, const tripoint &spos ); + int heard_volume, const tripoint_bub_ms &spos ); void witness_thievery( item *it ) override; @@ -1088,7 +1089,7 @@ class npc : public Character * from one submap to an adjacent submap. It updates our position (shifting by * 12 tiles), as well as our plans. */ - void shift( const point &s ); + void shift( const point_rel_sm &s ); // Movement; the following are defined in npcmove.cpp void move(); // Picks an action & a target and calls execute_action @@ -1303,7 +1304,7 @@ class npc : public Character npc_mission get_previous_mission() const; void revert_after_activity(); // Craft related stuff - void do_npc_craft( const std::optional &loc = std::nullopt, + void do_npc_craft( const std::optional &loc = std::nullopt, const recipe_id &goto_recipe = recipe_id() ); item_location get_item_to_craft(); @@ -1470,7 +1471,7 @@ class standard_npc : public npc { public: explicit standard_npc( const std::string &name = "", - const tripoint &pos = tripoint( HALF_MAPSIZE_X, HALF_MAPSIZE_Y, 0 ), + const tripoint_bub_ms &pos = tripoint_bub_ms( HALF_MAPSIZE_X, HALF_MAPSIZE_Y, 0 ), const std::vector &clothing = {}, int sk_lvl = 4, int s_str = 8, int s_dex = 8, int s_int = 8, int s_per = 8 ); }; diff --git a/src/npc_attack.cpp b/src/npc_attack.cpp index 88cb3c8fd99eb..da87d0a8547b6 100644 --- a/src/npc_attack.cpp +++ b/src/npc_attack.cpp @@ -107,7 +107,7 @@ void npc_attack_spell::use( npc &source, const tripoint_bub_ms &location ) const source.unwield(); } add_msg_debug( debugmode::debug_filter::DF_NPC, "%s is casting %s", source.disp_name(), sp.name() ); - source.cast_spell( sp, false, location.raw() ); + source.cast_spell( sp, false, location ); } npc_attack_rating npc_attack_spell::evaluate( const npc &source, @@ -732,7 +732,7 @@ npc_attack_rating npc_attack_throw::evaluate( // please don't throw your pants... return effectiveness; } - const inventory &available_weapons = source.crafting_inventory( tripoint::zero, -1 ); + const inventory &available_weapons = source.crafting_inventory( tripoint_bub_ms::zero, -1 ); if( &thrown_item == source.evaluate_best_weapon() && available_weapons.amount_of( thrown_item.typeId() ) <= 1 && available_weapons.charges_of( thrown_item.typeId() ) <= 1 ) { diff --git a/src/npcmove.cpp b/src/npcmove.cpp index 2c137685878ed..dd4b22e912864 100644 --- a/src/npcmove.cpp +++ b/src/npcmove.cpp @@ -841,7 +841,7 @@ void npc::assess_danger() "%s ignored %s because there's an obstacle in between. Might warn about it.", name, critter.type->nname() ); if( critter_threat > 2 * ( 8.0f + personality.bravery + rng( 0, 5 ) ) ) { - warn_about( "monster", 10_minutes, critter.type->nname(), dist, critter.pos() ); + warn_about( "monster", 10_minutes, critter.type->nname(), dist, critter.pos_bub() ); } } else { add_msg_debug( debugmode::DF_NPC_COMBATAI, @@ -854,7 +854,7 @@ void npc::assess_danger() if( is_enemy() || !critter.friendly ) { mem_combat.assess_enemy += critter_threat; if( critter_threat > ( 8.0f + personality.bravery + rng( 0, 5 ) ) ) { - warn_about( "monster", 10_minutes, critter.type->nname(), dist, critter.pos() ); + warn_about( "monster", 10_minutes, critter.type->nname(), dist, critter.pos_bub() ); } if( dist < preferred_medium_range ) { hostile_count += 1; @@ -927,7 +927,7 @@ void npc::assess_danger() // still warn about enemies behind impassable glass walls, but not as often. // since NPC threats have a higher chance of ignoring soft obstacles, we'll ignore them here. if( foe_threat > 2 * ( 8.0f + personality.bravery + rng( 0, 5 ) ) ) { - warn_about( "monster", 10_minutes, bogey, dist, foe.pos() ); + warn_about( "monster", 10_minutes, bogey, dist, foe.pos_bub() ); } return 0.0f; } else { @@ -935,7 +935,7 @@ void npc::assess_danger() name, bogey ); } if( foe_threat > ( 8.0f + personality.bravery + rng( 0, 5 ) ) ) { - warn_about( "monster", 10_minutes, bogey, dist, foe.pos() ); + warn_about( "monster", 10_minutes, bogey, dist, foe.pos_bub() ); } int scaled_distance = std::max( 1, ( 100 * dist ) / foe.get_speed() ); @@ -1381,7 +1381,7 @@ void npc::move() } else if( target != nullptr && ai_cache.danger > 0 ) { action = method_of_attack(); } else if( !ai_cache.sound_alerts.empty() && !is_walking_with() ) { - tripoint cur_s_abs_pos = ai_cache.s_abs_pos; + tripoint_abs_ms cur_s_abs_pos = ai_cache.s_abs_pos; if( !ai_cache.guard_pos ) { ai_cache.guard_pos = get_location(); } @@ -1412,7 +1412,7 @@ void npc::move() } if( action == npc_investigate_sound ) { add_msg_debug( debugmode::DF_NPC, "NPC %s: investigating sound at x(%d) y(%d)", get_name(), - ai_cache.s_abs_pos.x, ai_cache.s_abs_pos.y ); + ai_cache.s_abs_pos.x(), ai_cache.s_abs_pos.y() ); } } else { // No present danger @@ -1466,7 +1466,7 @@ void npc::move() if( !activity_route.empty() && !has_destination_activity() ) { tripoint_bub_ms final_destination; if( destination_point ) { - final_destination = here.bub_from_abs( tripoint_abs_ms( *destination_point ) ); + final_destination = here.bub_from_abs( *destination_point ); } else { final_destination = activity_route.back(); } @@ -2047,7 +2047,7 @@ int npc::evaluate_sleep_spot( tripoint_bub_ms p ) // This opt-out is necessary to allow mutant NPCs to find desired non-bed sleeping spaces if( sleep_eval < comfort_data::COMFORT_VERY_COMFORTABLE - 1 ) { const units::temperature_delta ideal_bed_value = 2_C_delta; - const units::temperature_delta sleep_spot_value = floor_bedding_warmth( p.raw() ); + const units::temperature_delta sleep_spot_value = floor_bedding_warmth( p ); if( sleep_spot_value < ideal_bed_value ) { double bed_similarity = sleep_spot_value / ideal_bed_value; // bed_similarity^2, exponentially diminishing the value of non-bed sleeping spots the more not-bed-like they are @@ -2976,7 +2976,7 @@ void npc::move_to( const tripoint_bub_ms &pt, bool no_bashing, std::sethas_destination_activity() ) { tripoint_bub_ms final_destination; if( destination_point ) { - final_destination = here.bub_from_abs( tripoint_abs_ms( *destination_point ) ); + final_destination = here.bub_from_abs( *destination_point ); } else { final_destination = activity_route.back(); } @@ -3558,7 +3558,7 @@ void npc::find_item() continue; } - const tripoint abs_p = get_location().raw() - pos() + p.raw(); + const tripoint_abs_ms abs_p = get_location() + ( p - pos_bub() ); const int prev_num_items = ai_cache.searched_tiles.get( abs_p, -1 ); // Prefetch the number of items present so we can bail out if we already checked here. map_stack m_stack = here.i_at( p ); @@ -5136,7 +5136,7 @@ std::string npc::distance_string( int range ) const } void npc::warn_about( const std::string &type, const time_duration &d, const std::string &name, - int range, const tripoint &danger_pos ) + int range, const tripoint_bub_ms &danger_pos ) { std::string snip; sounds::sound_t spriority = sounds::sound_t::alert; @@ -5186,7 +5186,7 @@ void npc::warn_about( const std::string &type, const time_duration &d, const std } else { const std::string range_str = range < 1 ? "" : string_format( _( " %s, %s" ), - direction_name( direction_from( pos(), danger_pos ) ), + direction_name( direction_from( pos_bub(), danger_pos ) ), distance_string( range ) ); const std::string speech = string_format( _( "%s %s%s" ), snip, _( name ), range_str ); complain_about( warning_name, d, speech, is_enemy(), spriority ); diff --git a/src/npctalk.cpp b/src/npctalk.cpp index 08d6c8a3d2911..3a1a8ca3e3267 100644 --- a/src/npctalk.cpp +++ b/src/npctalk.cpp @@ -976,18 +976,18 @@ void game::chat() } ); const int available_count = available.size(); const std::vector followers = get_npcs_if( [&]( const npc & guy ) { - return guy.is_player_ally() && guy.is_following() && guy.can_hear( u.pos(), volume ); + return guy.is_player_ally() && guy.is_following() && guy.can_hear( u.pos_bub(), volume ); } ); const int follower_count = followers.size(); const std::vector guards = get_npcs_if( [&]( const npc & guy ) { return guy.mission == NPC_MISSION_GUARD_ALLY && guy.companion_mission_role_id != "FACTION_CAMP" && - guy.can_hear( u.pos(), volume ); + guy.can_hear( u.pos_bub(), volume ); } ); const int guard_count = guards.size(); const std::vector available_for_activities = get_npcs_if( [&]( const npc & guy ) { - return guy.is_player_ally() && guy.can_hear( u.pos(), volume ) && + return guy.is_player_ally() && guy.can_hear( u.pos_bub(), volume ) && guy.companion_mission_role_id != "FACTION CAMP"; } ); const int available_for_activities_count = available_for_activities.size(); @@ -1425,7 +1425,7 @@ void game::chat() } void npc::handle_sound( const sounds::sound_t spriority, const std::string &description, - int heard_volume, const tripoint &spos ) + int heard_volume, const tripoint_bub_ms &spos ) { const map &here = get_map(); const tripoint_abs_ms s_abs_pos = here.getglobal( spos ); @@ -1437,7 +1437,7 @@ void npc::handle_sound( const sounds::sound_t spriority, const std::string &desc s_abs_pos.x(), s_abs_pos.y(), my_abs_pos.x(), my_abs_pos.y() ); Character &player_character = get_player_character(); - bool player_ally = player_character.pos() == spos && is_player_ally(); + bool player_ally = player_character.pos_bub() == spos && is_player_ally(); Character *const sound_source = get_creature_tracker().creature_at( spos ); bool npc_ally = sound_source && sound_source->is_npc() && is_ally( *sound_source ); @@ -1494,7 +1494,7 @@ void npc::handle_sound( const sounds::sound_t spriority, const std::string &desc } else if( spriority > sounds::sound_t::activity ) { warn_about( "combat_noise", rng( 1, 10 ) * 1_minutes ); } - bool should_check = rl_dist( pos(), spos ) < investigate_dist; + bool should_check = rl_dist( pos_bub(), spos ) < investigate_dist; if( should_check ) { const zone_manager &mgr = zone_manager::get_manager(); // NOLINTNEXTLINE(bugprone-branch-clone) @@ -1510,12 +1510,11 @@ void npc::handle_sound( const sounds::sound_t spriority, const std::string &desc s_abs_pos.x(), s_abs_pos.y() ); dangerous_sound temp_sound; // TODO: fix point types - temp_sound.abs_pos = s_abs_pos.raw(); + temp_sound.abs_pos = s_abs_pos; temp_sound.volume = heard_volume; temp_sound.type = spriority; if( !ai_cache.sound_alerts.empty() ) { - // TODO: fix point types - if( ai_cache.sound_alerts.back().abs_pos != s_abs_pos.raw() ) { + if( ai_cache.sound_alerts.back().abs_pos != s_abs_pos ) { ai_cache.sound_alerts.push_back( temp_sound ); } } else { @@ -3867,7 +3866,7 @@ talk_effect_fun_t::func f_consume_item_sum( const JsonObject &jo, std::string_vi double amount_desired = 0.0f; int count_present = 0; Character *you = d.actor( is_npc )->get_character(); - inventory inventory_and_around = you->crafting_inventory( you->pos(), PICKUP_RANGE ); + inventory inventory_and_around = you->crafting_inventory( you->pos_bub(), PICKUP_RANGE ); std::vector items_to_remove_vector; for( const auto &pair : item_and_amount ) { diff --git a/src/npctalk_funcs.cpp b/src/npctalk_funcs.cpp index 2d5d7c5cf9a6d..e46c9b1137ec3 100644 --- a/src/npctalk_funcs.cpp +++ b/src/npctalk_funcs.cpp @@ -1127,7 +1127,7 @@ void talk_function::start_training_seminar( npc &p ) d.spell = p.chatbin.dialogue_spell; d.prof = p.chatbin.proficiency; std::vector followers = g->get_npcs_if( [&p]( const npc & n ) { - return n.is_player_ally() && n.is_following() && n.can_hear( p.pos(), p.get_shout_volume() ); + return n.is_player_ally() && n.is_following() && n.can_hear( p.pos_bub(), p.get_shout_volume() ); } ); std::vector students; for( npc *n : followers ) { diff --git a/src/ranged.cpp b/src/ranged.cpp index 0ea2cc686346d..adb3144b5183d 100644 --- a/src/ranged.cpp +++ b/src/ranged.cpp @@ -3220,7 +3220,7 @@ bool target_ui::try_reacquire_target( bool critter, tripoint_bub_ms &new_dst ) } // Try to re-acquire target tile or tile where the target creature used to be - tripoint_bub_ms local_lt = get_map().bub_from_abs( tripoint_abs_ms( *you->last_target_pos ) ); + tripoint_bub_ms local_lt = get_map().bub_from_abs( *you->last_target_pos ); if( dist_fn( local_lt ) <= range ) { new_dst = local_lt; // Abort aiming if a creature moved in @@ -3269,10 +3269,10 @@ int target_ui::dist_fn( const tripoint_bub_ms &p ) void target_ui::set_last_target() { if( !you->last_target_pos.has_value() || - you->last_target_pos.value() != get_map().getglobal( dst ).raw() ) { + you->last_target_pos.value() != get_map().getglobal( dst ) ) { you->aim_cache_dirty = true; } - you->last_target_pos = get_map().getglobal( dst ).raw(); + you->last_target_pos = get_map().getglobal( dst ); if( dst_critter ) { you->last_target = g->shared_from( *dst_critter ); } else { @@ -3437,7 +3437,7 @@ void target_ui::recalc_aim_turning_penalty() if( lt_ptr ) { curr_recoil_pos = lt_ptr->pos_bub(); } else if( you->last_target_pos ) { - curr_recoil_pos = get_map().bub_from_abs( tripoint_abs_ms( *you->last_target_pos ) ); + curr_recoil_pos = get_map().bub_from_abs( *you->last_target_pos ); } else { curr_recoil_pos = src; } diff --git a/src/savegame_json.cpp b/src/savegame_json.cpp index 152455aabd4ba..16530138ab7f5 100644 --- a/src/savegame_json.cpp +++ b/src/savegame_json.cpp @@ -1234,7 +1234,7 @@ void Character::load( const JsonObject &data ) data.read( "last_target_pos", last_target_pos ); data.read( "ammo_location", ammo_location ); // Fixes savefile with invalid last_target_pos. - if( last_target_pos && *last_target_pos == tripoint::min ) { + if( last_target_pos && *last_target_pos == tripoint_abs_ms::min ) { last_target_pos = std::nullopt; } if( tmptartyp == +1 ) { diff --git a/src/sounds.cpp b/src/sounds.cpp index 5456a81349690..d5392e0401ccb 100644 --- a/src/sounds.cpp +++ b/src/sounds.cpp @@ -662,7 +662,7 @@ void sounds::process_sound_markers( Character *you ) if( you->is_npc() ) { if( !sound.ambient ) { npc *guy = dynamic_cast( you ); - guy->handle_sound( sound.category, description, heard_volume, pos.raw() ); + guy->handle_sound( sound.category, description, heard_volume, pos ); } continue; } diff --git a/src/trap.cpp b/src/trap.cpp index 7d9017fea8b23..27c37c5366787 100644 --- a/src/trap.cpp +++ b/src/trap.cpp @@ -323,7 +323,7 @@ bool trap::can_see( const tripoint &pos, const Character &p ) const if( is_always_invisible() ) { return false; } - return visibility < 0 || p.knows_trap( pos ); + return visibility < 0 || p.knows_trap( tripoint_bub_ms( pos ) ); } bool trap::can_see( const tripoint_bub_ms &pos, const Character &p ) const diff --git a/src/veh_interact.cpp b/src/veh_interact.cpp index 76919e2eb783a..116494892b98b 100644 --- a/src/veh_interact.cpp +++ b/src/veh_interact.cpp @@ -620,7 +620,7 @@ void veh_interact::cache_tool_availability() void veh_interact::cache_tool_availability_update_lifting( const tripoint_bub_ms &world_cursor_pos ) { - max_lift = get_player_character().best_nearby_lifting_assist( world_cursor_pos.raw() ); + max_lift = get_player_character().best_nearby_lifting_assist( world_cursor_pos ); } /** diff --git a/src/veh_utils.cpp b/src/veh_utils.cpp index 1fc5a3366feb8..1b858460414ed 100644 --- a/src/veh_utils.cpp +++ b/src/veh_utils.cpp @@ -99,7 +99,7 @@ bool repair_part( vehicle &veh, vehicle_part &pt, Character &who ) ? vp.install_requirements() : vp.repair_requirements() * pt.get_base().repairable_levels(); - const inventory &inv = who.crafting_inventory( who.pos(), PICKUP_RANGE, !who.is_npc() ); + const inventory &inv = who.crafting_inventory( who.pos_bub(), PICKUP_RANGE, !who.is_npc() ); inventory map_inv; // allow NPCs to use welding rigs they can't see ( on the other side of a vehicle ) // as they have the handicap of not being able to use the veh interaction menu diff --git a/src/vehicle_move.cpp b/src/vehicle_move.cpp index ca57530d02113..a4d087dd9a554 100644 --- a/src/vehicle_move.cpp +++ b/src/vehicle_move.cpp @@ -1291,7 +1291,7 @@ void vehicle::handle_trap( const tripoint_bub_ms &p, vehicle_part &vp_wheel ) const trap &tr = here.tr_at( p ); if( seen || known ) { // known status has been reset by map::trap_set() - player_character.add_known_trap( p.raw(), tr ); + player_character.add_known_trap( p, tr ); } if( seen && !known ) { // hard to miss! diff --git a/src/visitable.cpp b/src/visitable.cpp index 08f5cfb94a1e9..760bdcc9fef96 100644 --- a/src/visitable.cpp +++ b/src/visitable.cpp @@ -288,7 +288,7 @@ int Character::max_quality( const quality_id &qual, int radius ) const if( radius > 0 ) { res = std::max( res, - crafting_inventory( tripoint::zero, radius, true ) + crafting_inventory( tripoint_bub_ms::zero, radius, true ) .max_quality( qual ) ); } diff --git a/src/wish.cpp b/src/wish.cpp index 56e76ddf2a048..c211692bdb5cb 100644 --- a/src/wish.cpp +++ b/src/wish.cpp @@ -382,7 +382,7 @@ void debug_menu::wishbionics( Character *you ) you->perform_install( bio, upbio_uid, difficulty, success, level, "NOT_MED", bio->canceled_mutations, - you->pos() ); + you->pos_bub() ); } break; } diff --git a/tests/act_build_test.cpp b/tests/act_build_test.cpp index 09ddb994dad98..6ed7b6a7131ae 100644 --- a/tests/act_build_test.cpp +++ b/tests/act_build_test.cpp @@ -36,7 +36,7 @@ void run_activities( Character &u, int max_moves ) while( ( !u.activity.is_null() || u.is_auto_moving() ) && turns < max_moves ) { u.set_moves( u.get_speed() ); if( u.is_auto_moving() ) { - u.setpos( get_map().bub_from_abs( tripoint_abs_ms( *u.destination_point ) ) ); + u.setpos( get_map().bub_from_abs( *u.destination_point ) ); get_map().build_map_cache( u.posz() ); u.start_destination_activity(); } diff --git a/tests/coverage_test.cpp b/tests/coverage_test.cpp index d85f5b6fb9f90..3c76aac13f63a 100644 --- a/tests/coverage_test.cpp +++ b/tests/coverage_test.cpp @@ -22,13 +22,13 @@ static const flag_id json_flag_FILTHY( "FILTHY" ); static const mtype_id mon_manhack( "mon_manhack" ); +static const sub_bodypart_str_id sub_body_part_eyes_right( "eyes_right" ); + static const int num_iters = 10000; static constexpr tripoint_bub_ms dude_pos( HALF_MAPSIZE_X + 4, HALF_MAPSIZE_Y, 0 ); static constexpr tripoint_bub_ms mon_pos( HALF_MAPSIZE_X + 3, HALF_MAPSIZE_Y, 0 ); static constexpr tripoint_bub_ms badguy_pos( HALF_MAPSIZE_X + 1, HALF_MAPSIZE_Y, 0 ); -static const sub_bodypart_str_id sub_body_part_eyes_right( "eyes_right" ); - static void check_near( const std::string &subject, float actual, const float expected, const float tolerance ) { @@ -50,7 +50,7 @@ static void check_not_near( const std::string &subject, float actual, const floa static float get_avg_melee_dmg( const std::string &clothing_id, bool infect_risk = false ) { monster zed( mon_manhack, mon_pos ); - standard_npc dude( "TestCharacter", dude_pos.raw(), {}, 0, 8, 8, 8, 8 ); + standard_npc dude( "TestCharacter", dude_pos, {}, 0, 8, 8, 8, 8 ); item cloth( clothing_id ); if( infect_risk ) { cloth.set_flag( json_flag_FILTHY ); @@ -86,7 +86,7 @@ static float get_avg_melee_dmg( const std::string &clothing_id, bool infect_risk static float get_avg_melee_dmg( item cloth, bool infect_risk = false ) { monster zed( mon_manhack, mon_pos ); - standard_npc dude( "TestCharacter", dude_pos.raw(), {}, 0, 8, 8, 8, 8 ); + standard_npc dude( "TestCharacter", dude_pos, {}, 0, 8, 8, 8, 8 ); if( infect_risk ) { cloth.set_flag( json_flag_FILTHY ); } @@ -122,9 +122,9 @@ static float get_avg_bullet_dmg( const std::string &clothing_id ) { clear_map(); std::unique_ptr badguy = std::make_unique( "TestBaddie", - badguy_pos.raw(), std::vector(), 0, 8, 8, 8, 8 ); + badguy_pos, std::vector(), 0, 8, 8, 8, 8 ); std::unique_ptr dude = std::make_unique( "TestCharacter", - dude_pos.raw(), std::vector(), 0, 8, 8, 8, 8 ); + dude_pos, std::vector(), 0, 8, 8, 8, 8 ); item cloth( clothing_id ); projectile proj; proj.speed = 1000; @@ -284,7 +284,7 @@ TEST_CASE( "Off_Limb_Ghost_ablative_vest", "[coverage]" ) item full = item( "test_ghost_vest" ); full.force_insert_item( item( "test_plate_skirt_super" ), pocket_type::CONTAINER ); - standard_npc dude( "TestCharacter", dude_pos.raw(), {}, 0, 8, 8, 8, 8 ); + standard_npc dude( "TestCharacter", dude_pos, {}, 0, 8, 8, 8, 8 ); dude.wear_item( full, false ); damage_instance du_full = damage_instance( damage_bullet, 100.0f ); dude.absorb_hit( weakpoint_attack(), bodypart_id( "leg_l" ), du_full ); diff --git a/tests/invlet_test.cpp b/tests/invlet_test.cpp index 0bc90cfc53261..57a2493c1a858 100644 --- a/tests/invlet_test.cpp +++ b/tests/invlet_test.cpp @@ -242,7 +242,7 @@ static void drop_at_feet( Character &you, const std::string &id ) REQUIRE( found ); item_location loc( you, found ); you.set_moves( 100 ); - you.drop( loc, you.pos() ); + you.drop( loc, you.pos_bub() ); you.activity.do_turn( you ); REQUIRE( get_map().i_at( you.pos_bub() ).size() == size_before + 1 ); diff --git a/tests/iteminfo_test.cpp b/tests/iteminfo_test.cpp index 2c8ace6e9cb8d..5421aef027d28 100644 --- a/tests/iteminfo_test.cpp +++ b/tests/iteminfo_test.cpp @@ -46,14 +46,14 @@ static const recipe_id recipe_pur_tablets( "pur_tablets" ); static const skill_id skill_survival( "survival" ); +static const sub_bodypart_str_id sub_body_part_eyes_right( "eyes_right" ); + static const trait_id trait_ANTIFRUIT( "ANTIFRUIT" ); static const trait_id trait_CANNIBAL( "CANNIBAL" ); static const trait_id trait_WOOLALLERGY( "WOOLALLERGY" ); static const vitamin_id vitamin_human_flesh_vitamin( "human_flesh_vitamin" ); -static const sub_bodypart_str_id sub_body_part_eyes_right( "eyes_right" ); - // ITEM INFO // ========= // diff --git a/tests/martial_art_test.cpp b/tests/martial_art_test.cpp index 0cdfb056e96dd..89e26836cb55f 100644 --- a/tests/martial_art_test.cpp +++ b/tests/martial_art_test.cpp @@ -59,7 +59,7 @@ TEST_CASE( "Martial_art_required_weapon_categories", "[martial_arts]" ) const mabuff_id &buff2 = test_style_ma1->onmiss_buffs[1]; REQUIRE( buff1->reqs.weapon_categories_allowed[0] == *test_style_ma1->weapon_category.begin() ); - standard_npc dude( "TestCharacter", dude_pos.raw(), {}, 0, 8, 8, 8, 8 ); + standard_npc dude( "TestCharacter", dude_pos, {}, 0, 8, 8, 8, 8 ); item weap2( itype_test_weapon2 ); clear_character( dude, true ); CHECK( !buff1->is_valid_character( dude ) ); @@ -76,7 +76,7 @@ TEST_CASE( "Martial_art_required_weapon_categories", "[martial_arts]" ) const matec_id &tec = *test_style_ma1->techniques.find( test_technique ); REQUIRE( tec->reqs.weapon_categories_allowed[0] == *test_style_ma1->weapon_category.begin() ); - standard_npc dude( "TestCharacter", dude_pos.raw(), {}, 0, 8, 8, 8, 8 ); + standard_npc dude( "TestCharacter", dude_pos, {}, 0, 8, 8, 8, 8 ); item weap2( itype_test_weapon2 ); clear_character( dude, true ); CHECK( !tec->is_valid_character( dude ) ); @@ -90,7 +90,7 @@ TEST_CASE( "Martial_art_required_weapon_categories", "[martial_arts]" ) TEST_CASE( "Attack_vector_test", "[martial_arts][limb]" ) { clear_map(); - standard_npc dude( "TestCharacter", dude_pos.raw(), {}, 0, 8, 8, 8, 8 ); + standard_npc dude( "TestCharacter", dude_pos, {}, 0, 8, 8, 8, 8 ); clear_character( dude ); dude.martial_arts_data->add_martialart( test_style_ma1 ); dude.martial_arts_data->set_style( test_style_ma1, false ); @@ -152,7 +152,7 @@ TEST_CASE( "Attack_vector_test", "[martial_arts][limb]" ) TEST_CASE( "Martial_art_technique_conditionals", "[martial_arts]" ) { clear_map(); - standard_npc dude( "TestCharacter", dude_pos.raw(), {}, 0, 8, 8, 8, 8 ); + standard_npc dude( "TestCharacter", dude_pos, {}, 0, 8, 8, 8, 8 ); const tripoint_bub_ms target_1_pos = dude_pos + tripoint::east; const tripoint_bub_ms target_2_pos = dude_pos + tripoint::north; const tripoint_bub_ms target_3_pos = dude_pos + tripoint::west; diff --git a/tests/materials_test.cpp b/tests/materials_test.cpp index 8fe285eb7a053..3cb1c2eeeb05a 100644 --- a/tests/materials_test.cpp +++ b/tests/materials_test.cpp @@ -24,7 +24,7 @@ static const material_id material_steel( "steel" ); static const material_id material_wood( "wood" ); static constexpr int num_iters = 1000; -static constexpr tripoint dude_pos( HALF_MAPSIZE_X, HALF_MAPSIZE_Y, 0 ); +static constexpr tripoint_bub_ms dude_pos( HALF_MAPSIZE_X, HALF_MAPSIZE_Y, 0 ); static constexpr tripoint_bub_ms target_pos( HALF_MAPSIZE_X - 10, HALF_MAPSIZE_Y, 0 ); static void check_near( const std::string &subject, float prob, const float expected, diff --git a/tests/melee_test.cpp b/tests/melee_test.cpp index 5d0168b27a3c3..5395214b7d077 100644 --- a/tests/melee_test.cpp +++ b/tests/melee_test.cpp @@ -86,7 +86,7 @@ static void check_near( float prob, const float expected, const float tolerance static const int num_iters = 10000; -static constexpr tripoint dude_pos( HALF_MAPSIZE_X, HALF_MAPSIZE_Y, 0 ); +static constexpr tripoint_bub_ms dude_pos( HALF_MAPSIZE_X, HALF_MAPSIZE_Y, 0 ); TEST_CASE( "Character_attacking_a_zombie", "[.melee]" ) { diff --git a/tests/morale_test.cpp b/tests/morale_test.cpp index 8e7bd4225e46e..951539e888507 100644 --- a/tests/morale_test.cpp +++ b/tests/morale_test.cpp @@ -202,7 +202,7 @@ TEST_CASE( "player_morale_murdered_innocent", "[player_morale]" ) clear_avatar(); Character &player = get_player_character(); player_morale &m = *player.morale; - tripoint next_to = player.adjacent_tile(); + tripoint_bub_ms next_to = player.adjacent_tile(); standard_npc innocent( "Lapin", next_to, {}, 0, 8, 8, 8, 7 ); // Innocent as could be. faction_id lapin( "lapin" ); @@ -226,7 +226,7 @@ TEST_CASE( "player_morale_kills_hostile_bandit", "[player_morale]" ) clear_avatar(); Character &player = get_player_character(); player_morale &m = *player.morale; - tripoint next_to = player.adjacent_tile(); + tripoint_bub_ms next_to = player.adjacent_tile(); standard_npc badguy( "Raider", next_to, {}, 0, 8, 8, 8, 7 ); // Always-hostile faction_id hells_raiders( "hells_raiders" ); diff --git a/tests/ranged_balance_test.cpp b/tests/ranged_balance_test.cpp index cea4c8d7bbd8c..4f6ff022cb729 100644 --- a/tests/ranged_balance_test.cpp +++ b/tests/ranged_balance_test.cpp @@ -220,7 +220,7 @@ static void assert_encumbrance( npc &shooter, int encumbrance ) } } -static constexpr tripoint shooter_pos( 60, 60, 0 ); +static constexpr tripoint_bub_ms shooter_pos( 60, 60, 0 ); // Test the aiming speed and accuracy of the weapon in the first shot @@ -449,7 +449,7 @@ static void shoot_monster( const std::string &gun_type, const std::vector shooter = std::make_unique( "Shooter", - shooter_pos.raw(), + shooter_pos, std::vector(), 5, 10, 10, 10, 10 ); int other_check_success = 0; do { diff --git a/tests/throwing_test.cpp b/tests/throwing_test.cpp index 016a3d8abe70a..b700093b541e1 100644 --- a/tests/throwing_test.cpp +++ b/tests/throwing_test.cpp @@ -25,7 +25,7 @@ static const skill_id skill_throw( "throw" ); TEST_CASE( "throwing_distance_test", "[throwing], [balance]" ) { - const standard_npc thrower( "Thrower", tripoint( 60, 60, 0 ), {}, 4, 10, 10, 10, 10 ); + const standard_npc thrower( "Thrower", { 60, 60, 0 }, {}, 4, 10, 10, 10, 10 ); item grenade( "grenade" ); CHECK( thrower.throw_range( grenade ) >= 30 ); CHECK( thrower.throw_range( grenade ) <= 35 );