diff --git a/src/veh_appliance.cpp b/src/veh_appliance.cpp index fd1f2a72aab25..0618bc967bbc4 100644 --- a/src/veh_appliance.cpp +++ b/src/veh_appliance.cpp @@ -499,9 +499,9 @@ void veh_app_interact::remove() for( const tripoint_bub_ms &p : veh->get_points( true ) ) { act.coord_set.insert( here.get_abs( p ) ); } - const tripoint a_point_abs( here.get_abs( a_point_bub ).raw() ); - act.values.push_back( a_point_abs.x ); - act.values.push_back( a_point_abs.y ); + const tripoint_abs_ms a_point_abs( here.get_abs( a_point_bub ) ); + act.values.push_back( a_point_abs.x() ); + act.values.push_back( a_point_abs.y() ); act.values.push_back( a_point.x() ); act.values.push_back( a_point.y() ); act.values.push_back( -a_point.x() ); diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 84414efbf198b..b931327f1778b 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -671,7 +671,7 @@ void vehicle::autopilot_patrol() tripoint_abs_ms min; tripoint_abs_ms max; for( const tripoint_abs_ms &box : zone_src_set ) { - if( min == tripoint_abs_ms() ) { + if( min == tripoint_abs_ms::zero ) { min = box; max = box; continue; @@ -694,7 +694,6 @@ void vehicle::autopilot_patrol() rl_dist( min_tri, pos_abs() ) ) { chosen_tri = max_tri; } - // TODO: fix point types autodrive_local_target = chosen_tri; drive_to_local_target( autodrive_local_target, false ); } @@ -821,7 +820,7 @@ bool vehicle::precollision_check( units::angle &angle, map &here, bool follow_pr bool stop = false; creature_tracker &creatures = get_creature_tracker(); for( const point_abs_ms &pt_elem : points_to_check ) { - point_bub_ms elem = here.get_bub( point_abs_ms( pt_elem ) ); + point_bub_ms elem = here.get_bub( pt_elem ); if( stop ) { break; } @@ -1200,11 +1199,6 @@ bool vehicle::is_structural_part_removed() const return false; } -ret_val vehicle::can_mount( const point &dp, const vpart_info &vpi ) const -{ - return vehicle::can_mount( point_rel_ms( dp ), vpi ); -} - ret_val vehicle::can_mount( const point_rel_ms &dp, const vpart_info &vpi ) const { const std::vector parts_in_square = parts_at_relative( dp, @@ -1474,11 +1468,6 @@ bool vehicle::is_appliance() const return has_tag( flag_APPLIANCE ); } -int vehicle::install_part( const point &dp, const vpart_id &type ) -{ - return install_part( point_rel_ms( dp ), type, item( type.obj().base_item ) ); -} - int vehicle::install_part( const point_rel_ms &dp, const vpart_id &type ) { return install_part( dp, type, item( type.obj().base_item ) ); @@ -1495,72 +1484,6 @@ int vehicle::install_part( const point_rel_ms &dp, const vpart_id &type, item && return install_part( dp, vehicle_part( type, std::move( base ), installed_with ) ); } -int vehicle::install_part( const point &dp, vehicle_part &&vp ) -{ - if( vp.base.is_null() ) { - debugmsg( "Part to be installed is missing base item, did the constructor fail to set_base?" ); - return -1; - } - const vpart_info &vpi = vp.info(); - const ret_val valid_mount = can_mount( dp, vpi ); - if( !valid_mount.success() ) { - debugmsg( "installing %s would make invalid vehicle: %s", vpi.id.str(), valid_mount.str() ); - return -1; - } - // Should be checked before installing the part - bool enable = false; - if( vp.is_engine() ) { - enable = true; - // if smart controller is enabled there is charge in battery, no need to test it - if( has_enabled_smart_controller && !engine_on && vpi.fuel_type == fuel_type_battery && - !has_available_electric_engine() ) { - engine_on = true; - sfx::do_vehicle_engine_sfx(); - } - } else { - // TODO: read toggle groups from JSON - static const std::vector enable_like = { { - "CONE_LIGHT", - "CIRCLE_LIGHT", - "AISLE_LIGHT", - "AUTOPILOT", - "DOME_LIGHT", - "ATOMIC_LIGHT", - "STEREO", - "CHIMES", - "FRIDGE", - "FREEZER", - "RECHARGE", - "PLOW", - "REAPER", - "PLANTER", - "SCOOP", - "SPACE_HEATER", - "COOLER", - "WATER_PURIFIER", - "ROCKWHEEL", - "ROADHEAD" - } - }; - - for( const std::string &flag : enable_like ) { - if( vpi.has_flag( flag ) ) { - enable = has_part( flag, true ); - break; - } - } - } - // refresh will add them back if needed - remove_fake_parts( true ); - vehicle_part &vp_installed = parts.emplace_back( std::move( vp ) ); - vp_installed.enabled = enable; - vp_installed.mount = point_rel_ms( dp ); - const int vp_installed_index = parts.size() - 1; - refresh(); - coeff_air_changed = true; - return vp_installed_index; -} - int vehicle::install_part( const point_rel_ms &dp, vehicle_part &&vp ) { const vpart_info &vpi = vp.info(); @@ -1883,7 +1806,7 @@ bool vehicle::merge_rackable_vehicle( vehicle *carry_veh, const std::vector } const std::pair::iterator, std::unordered_multimap::iterator> - zones_on_point = carry_veh->loot_zones.equal_range( point_rel_ms( carry_map.old_mount ) ); + zones_on_point = carry_veh->loot_zones.equal_range( carry_map.old_mount ); for( std::unordered_multimap::const_iterator it = zones_on_point.first; it != zones_on_point.second; ++it ) { new_zones.emplace( carry_map.carry_mount, it->second ); @@ -2015,11 +1938,6 @@ bool vehicle::merge_appliance_into_grid( vehicle &veh_target ) return false; } -void vehicle::separate_from_grid( const point mount ) -{ - vehicle::separate_from_grid( point_rel_ms( mount ) ); -} - void vehicle::separate_from_grid( const point_rel_ms mount ) { // Disconnect items and power cords @@ -2679,12 +2597,6 @@ item_group::ItemList vehicle_part::pieces_for_broken_part() const return item_group::items_from( group, calendar::turn ); } -std::vector vehicle::parts_at_relative( const point &dp, const bool use_cache, - bool include_fake ) const -{ - return vehicle::parts_at_relative( point_rel_ms( dp ), use_cache, include_fake ); -} - std::vector vehicle::parts_at_relative( const point_rel_ms &dp, const bool use_cache, bool include_fake ) const { @@ -2912,12 +2824,6 @@ int vehicle::part_with_feature( const point_rel_ms &pt, vpart_bitflags f, bool u return -1; } -int vehicle::part_with_feature( const point &pt, const std::string &flag, bool unbroken, - bool include_fake ) const -{ - return vehicle::part_with_feature( point_rel_ms( pt ), flag, unbroken, include_fake ); -} - int vehicle::part_with_feature( const point_rel_ms &pt, const std::string &flag, bool unbroken, bool include_fake ) const { @@ -2994,11 +2900,6 @@ tiny_bitset vehicle::has_parts( const std::vector &flags, bool enab return ret; } -bool vehicle::has_part( const tripoint &pos, const std::string &flag, bool enabled ) const -{ - return vehicle::has_part( tripoint_bub_ms( pos ), flag, enabled ); -} - bool vehicle::has_part( const tripoint_bub_ms &pos, const std::string &flag, bool enabled ) const { const tripoint_rel_ms relative_pos = pos - pos_bub(); @@ -3371,11 +3272,6 @@ std::vector> vehicle::find_lines_of_parts( return ret_parts; } -int vehicle::part_at( const point &dp ) const -{ - return vehicle::part_at( point_rel_ms( dp ) ); -} - int vehicle::part_at( const point_rel_ms &dp ) const { for( const vpart_reference &vp : get_all_parts() ) { @@ -3463,11 +3359,6 @@ int vehicle::roof_at_part( const int part ) const return -1; } -point vehicle::coord_translate( const point &p ) const -{ - return vehicle::coord_translate( point_rel_ms( p ) ).raw(); -} - point_rel_ms vehicle::coord_translate( const point_rel_ms &p ) const { tripoint_rel_ms q; @@ -3494,11 +3385,6 @@ void vehicle::coord_translate( tileray tdir, const point_rel_ms &pivot, const po q.y() = tdir.dy() + tdir.ortho_dy( p.y() - pivot.y() ); } -tripoint vehicle::mount_to_tripoint( const point &mount ) const -{ - return mount_to_tripoint( point_rel_ms( mount ), point_rel_ms::zero ).raw(); -} - tripoint_bub_ms vehicle::mount_to_tripoint( const point_rel_ms &mount ) const { return mount_to_tripoint( mount, point_rel_ms::zero ); @@ -5662,7 +5548,7 @@ void vehicle::get_connected_vehicles( std::unordered_set &dest ) if( !vp.info().has_flag( VPFLAG_POWER_TRANSFER ) ) { continue; } - vehicle *v_next = find_vehicle( tripoint_abs_ms( vp.target.second ) ); + vehicle *v_next = find_vehicle( vp.target.second ); if( v_next == nullptr ) { continue; } @@ -6085,7 +5971,7 @@ void vehicle::make_active( item_location &loc ) } // System insures that there is only one part in this vector. vehicle_part *cargo_part = cargo_parts.front(); - active_items.add( target, point_rel_ms( cargo_part->mount ) ); + active_items.add( target, cargo_part->mount ); } int vehicle::add_charges( vehicle_part &vp, const item &itm ) @@ -6144,7 +6030,7 @@ std::optional vehicle::add_item( vehicle_part &vp, cons } const vehicle_stack::iterator new_pos = vp.items.insert( itm_copy ); - active_items.add( *new_pos, point_rel_ms( vp.mount ) ); + active_items.add( *new_pos, vp.mount ); invalidate_mass(); return std::optional( new_pos ); @@ -6690,7 +6576,7 @@ void vehicle::refresh( const bool remove_fakes ) if( remove_fakes && !has_tag( "wreckage" ) && !is_appliance() ) { // add all the obstacles first for( const std::pair > &rp : relative_parts ) { - add_fake_part( point_rel_ms( rp.first ), "OBSTACLE" ); + add_fake_part( rp.first, "OBSTACLE" ); } // then add protrusions that hanging on top of fake obstacles. @@ -6701,11 +6587,11 @@ void vehicle::refresh( const bool remove_fakes ) // add fake camera parts so vision isn't blocked by fake parts for( const std::pair > &rp : relative_parts ) { - add_fake_part( point_rel_ms( rp.first ), "CAMERA" ); + add_fake_part( rp.first, "CAMERA" ); } // add fake curtains so vision is correctly blocked for( const std::pair > &rp : relative_parts ) { - add_fake_part( point_rel_ms( rp.first ), "CURTAIN" ); + add_fake_part( rp.first, "CURTAIN" ); } } else { // Always repopulate fake parts in relative_parts cache since we cleared it. @@ -6986,11 +6872,6 @@ void vehicle::do_towing_move() } } -bool vehicle::is_external_part( const tripoint &part_pt ) const -{ - return vehicle::is_external_part( tripoint_bub_ms( part_pt ) ); -} - bool vehicle::is_external_part( const tripoint_bub_ms &part_pt ) const { map &here = get_map(); @@ -7095,7 +6976,7 @@ void vehicle::invalidate_towing( bool first_vehicle, Character *remover ) is_towed() ? tow_data.get_towed_by() : nullptr; const int other_tow_cable_idx = other_veh ? other_veh->get_tow_part() : -1; const point_rel_ms other_tow_cable_mount = other_veh && other_tow_cable_idx > -1 ? - other_veh->part( other_tow_cable_idx ).mount : point_rel_ms(); + other_veh->part( other_tow_cable_idx ).mount : point_rel_ms::zero; if( other_veh ) { other_veh->invalidate_towing(); } @@ -7208,7 +7089,7 @@ bool vehicle::no_towing_slack() const std::optional vehicle::get_remote_part( const vehicle_part &vp_local ) const { - vehicle *veh = find_vehicle( tripoint_abs_ms( vp_local.target.second ) ); + vehicle *veh = find_vehicle( vp_local.target.second ); // If the target vehicle is still there, ask it to remove its part if( veh != nullptr ) { const tripoint_abs_ms local_abs = get_map().get_abs( bub_part_pos( vp_local ) ); @@ -7513,7 +7394,7 @@ void vehicle::damage_all( int dmg1, int dmg2, const damage_type_id &type, void vehicle::shift_parts( map &here, const point_rel_ms &delta ) { // Don't invalidate the active item cache's location! - active_items.subtract_locations( point_rel_ms( delta ) ); + active_items.subtract_locations( delta ); for( vehicle_part &elem : parts ) { elem.mount -= delta; } @@ -8017,7 +7898,6 @@ const std::set &vehicle::get_points( const bool force_refresh, void vehicle::part_project_points( const tripoint_rel_ms &dp ) { - std::set projected_points; for( int p = 0; p < part_count(); p++ ) { vehicle_part &vp = parts.at( p ); if( vp.removed || !vp.is_real_or_active_fake() ) { @@ -8367,7 +8247,7 @@ bounding_box vehicle::get_bounding_box( bool use_precalc, bool no_fake ) if( use_precalc ) { const int i_use = 0; // TODO: Check if this is correct. part_at takes a vehicle relative position, not a bub one... - int part_idx = part_at( p.xy().raw() ); + int part_idx = part_at( rebase_rel( p.xy() ) ); if( part_idx < 0 ) { continue; } @@ -8533,7 +8413,7 @@ item vehicle::part_to_item( const vehicle_part &vp ) const const std::optional remote = get_remote_part( vp ); if( remote && tmp.link_to( remote->vehicle(), remote->part().mount, link_state::automatic ).success() ) { - tmp.link().t_abs_pos = tripoint_abs_ms( vp.target.second ); + tmp.link().t_abs_pos = vp.target.second; } else { // The linked vehicle can't be found, so this part shouldn't exist. tmp.set_flag( flag_NO_DROP ); diff --git a/src/vehicle.h b/src/vehicle.h index 1ab526371ec8a..bfc3ab62f08f5 100644 --- a/src/vehicle.h +++ b/src/vehicle.h @@ -970,8 +970,6 @@ class vehicle bool is_towing() const; bool has_tow_attached() const; int get_tow_part() const; - // TODO: Get rid of untyped overload. - bool is_external_part( const tripoint &part_pt ) const; bool is_external_part( const tripoint_bub_ms &part_pt ) const; bool is_towed() const; void set_tow_directions(); @@ -1038,8 +1036,6 @@ class vehicle * @param vpi The part type to check * @return true if the part can be mounted at specified position. */ - // TODO: Get rid of untyped overload. - ret_val can_mount( const point &dp, const vpart_info &vpi ) const; ret_val can_mount( const point_rel_ms &dp, const vpart_info &vpi ) const; // @returns true if part \p vp_to_remove can be uninstalled @@ -1047,8 +1043,6 @@ class vehicle // install a part of type \p type at mount \p dp // @return installed part index or -1 if can_mount(...) failed - // TODO: Get rid of untyped overload. - int install_part( const point &dp, const vpart_id &type ); int install_part( const point_rel_ms &dp, const vpart_id &type ); // install a part of type \p type at mount \p dp with \p base (std::move -ing it) @@ -1060,8 +1054,6 @@ class vehicle // install the given part \p vp (std::move -ing it) // @return installed part index or -1 if can_mount(...) failed - // TODO: Get rid of untyped overload. - int install_part( const point &dp, vehicle_part &&vp ); int install_part( const point_rel_ms &dp, vehicle_part &&vp ); struct rackable_vehicle { @@ -1089,8 +1081,6 @@ class vehicle // merges vehicles together by copying parts, does not account for any vehicle complexities bool merge_vehicle_parts( vehicle *veh ); bool merge_appliance_into_grid( vehicle &veh_target ); - // TODO: Get rid of untyped overload. - void separate_from_grid( point mount ); void separate_from_grid( point_rel_ms mount ); bool is_powergrid() const; @@ -1197,9 +1187,6 @@ class vehicle /**@}*/ // returns the list of indices of parts at certain position (not accounting frame direction) - // TODO: Get rid of untyped overload. - std::vector parts_at_relative( const point &dp, bool use_cache, - bool include_fake = false ) const; std::vector parts_at_relative( const point_rel_ms &dp, bool use_cache, bool include_fake = false ) const; @@ -1212,9 +1199,6 @@ class vehicle * @param include_fake if true fake parts are included * @returns part index or -1 */ - // TODO: Get rid of untyped overload - int part_with_feature( const point &pt, const std::string &f, bool unbroken, - bool include_fake = false ) const; int part_with_feature( const point_rel_ms &pt, const std::string &f, bool unbroken, bool include_fake = false ) const; /** @@ -1283,8 +1267,6 @@ class vehicle * @param flag The specified flag * @param enabled if set part must also be enabled to be considered */ - // TODO: Get rid of untyped overload. - bool has_part( const tripoint &pos, const std::string &flag, bool enabled = false ) const; bool has_part( const tripoint_bub_ms &pos, const std::string &flag, bool enabled = false ) const; /** @@ -1371,8 +1353,6 @@ class vehicle std::vector> find_lines_of_parts( int part, const std::string &flag ) const; // Translate mount coordinates "p" using current pivot direction and anchor and return tile coordinates - // TODO: Get rid of untyped overload. - point coord_translate( const point &p ) const; point_rel_ms coord_translate( const point_rel_ms &p ) const; // Translate mount coordinates "p" into tile coordinates "q" using given pivot direction and anchor @@ -1383,14 +1363,10 @@ class vehicle void coord_translate( tileray tdir, const point_rel_ms &pivot, const point_rel_ms &p, tripoint_rel_ms &q ) const; - // TODO: Get rid of untyped overload. - tripoint mount_to_tripoint( const point &mount ) const; tripoint_bub_ms mount_to_tripoint( const point_rel_ms &mount ) const; tripoint_bub_ms mount_to_tripoint( const point_rel_ms &mount, const point_rel_ms &offset ) const; // Seek a vehicle part which obstructs tile with given coordinates relative to vehicle position - // TODO: Get rid of untyped overload. - int part_at( const point &dp ) const; int part_at( const point_rel_ms &dp ) const; int part_displayed_at( const point_rel_ms &dp, bool include_fake = false, bool below_roof = true, bool roof = true ) const; diff --git a/src/vehicle_autodrive.cpp b/src/vehicle_autodrive.cpp index 660832172d405..e2b83f43391e0 100644 --- a/src/vehicle_autodrive.cpp +++ b/src/vehicle_autodrive.cpp @@ -178,10 +178,10 @@ enum class quad_rotation : int { struct vehicle_profile { tileray tdir; // Points occupied by the convex hull of the vehicle. Coordinates relative to pivot. - std::vector occupied_zone; + std::vector occupied_zone; // Points to check for collision when moving one step in this direction. // Coordinates relative to pivot. - std::vector collision_points; + std::vector collision_points; }; /** @@ -684,8 +684,9 @@ vehicle_profile vehicle::autodrive_controller::compute_profile( orientation faci // compute the subset of vehicle points that would move to previously unoccupied spots // (a.k.a. "moving first") when the vehicle moves one step; these are the only points // we need to check for collision when the vehicle is moving in this direction - const std::unordered_set occupied_set( ret.occupied_zone.begin(), ret.occupied_zone.end() ); - for( const point &pt : ret.occupied_zone ) { + const std::unordered_set occupied_set( ret.occupied_zone.begin(), + ret.occupied_zone.end() ); + for( const point_rel_ms &pt : ret.occupied_zone ) { if( occupied_set.find( pt + increment ) == occupied_set.end() ) { ret.collision_points.emplace_back( pt ); } @@ -868,9 +869,9 @@ void vehicle::autodrive_controller::compute_valid_positions() for( int my = 0; my < NAV_MAP_SIZE_Y; my++ ) { const point nav_pt( mx, my ); bool valid = true; - for( const point &veh_pt : profile.occupied_zone ) { + for( const point_rel_ms &veh_pt : profile.occupied_zone ) { const point view_pt = data.nav_to_view.transform( nav_pt ) + veh_rot.transform( - veh_pt ) - veh_rot.transform( point::zero ); + veh_pt.raw() ) - veh_rot.transform( point::zero ); if( !data.view_bounds.contains( view_pt ) || data.is_obstacle[view_pt.x][view_pt.y] ) { valid = false; break; @@ -1158,7 +1159,7 @@ collision_check_result vehicle::autodrive_controller::check_collision_zone( orie const point forward_offset( face_dir.dx(), face_dir.dy() ); bool changed_zlevel = false; bool blind = true; - for( const point &p : data.profile( to_orientation( face_dir.dir() ) ).collision_points ) { + for( const point_rel_ms &p : data.profile( to_orientation( face_dir.dir() ) ).collision_points ) { const tripoint_bub_ms next = data.adjust_z( veh_pos + forward_offset + p ); if( driver.sees( next ) ) { blind = false; @@ -1183,13 +1184,13 @@ collision_check_result vehicle::autodrive_controller::check_collision_zone( orie const int speed = std::min( driven_veh.velocity + driven_veh.current_acceleration(), driven_veh.cruise_velocity ); const int speed_tps = speed / VMIPH_PER_TPS; - std::unordered_set collision_zone; + std::unordered_set collision_zone; tdir.advance(); - point offset( tdir.dx(), tdir.dy() ); - for( const point &p : profile.occupied_zone ) { + point_rel_ms offset( tdir.dx(), tdir.dy() ); + for( const point_rel_ms &p : profile.occupied_zone ) { collision_zone.insert( p + offset ); } - for( const point &p : collision_zone ) { + for( const point_rel_ms &p : collision_zone ) { if( !check_drivable( data.adjust_z( veh_pos + p ) ) ) { return collision_check_result::close_obstacle; } @@ -1199,12 +1200,12 @@ collision_check_result vehicle::autodrive_controller::check_collision_zone( orie collision_zone.clear(); for( int i = 1; i < speed_tps; i++ ) { tdir.advance(); - offset += point( tdir.dx(), tdir.dy() ); - for( const point &p : profile.collision_points ) { + offset += point_rel_ms( tdir.dx(), tdir.dy() ); + for( const point_rel_ms &p : profile.collision_points ) { collision_zone.insert( p + offset ); } } - for( const point &p : collision_zone ) { + for( const point_rel_ms &p : collision_zone ) { const tripoint_bub_ms next = data.adjust_z( veh_pos + p ); if( !data.is_flying && !driver.sees( next ) ) { return collision_check_result::slow_down; @@ -1292,15 +1293,15 @@ std::vector> vehicle::get_debug_overl for( const std::string &debug_str : debug_what ) { if( debug_str == "profiles" ) { const vehicle_profile &profile = data.profile( dir ); - for( const point &p : profile.occupied_zone ) { - if( p.x == 0 && p.y == 0 ) { - ret.emplace_back( point_rel_ms( p ), catacurses::cyan, to_string( dir ) ); + for( const point_rel_ms &p : profile.occupied_zone ) { + if( p.x() == 0 && p.y() == 0 ) { + ret.emplace_back( p, catacurses::cyan, to_string( dir ) ); } else { - ret.emplace_back( point_rel_ms( p ), catacurses::green, "x" ); + ret.emplace_back( p, catacurses::green, "x" ); } } - for( const point &p : profile.collision_points ) { - ret.emplace_back( point_rel_ms( p ), catacurses::red, "o" ); + for( const point_rel_ms &p : profile.collision_points ) { + ret.emplace_back( p, catacurses::red, "o" ); } } else if( debug_str == "is_obstacle" ) { for( int dx = 0; dx < NAV_VIEW_SIZE_X; dx++ ) { diff --git a/src/vehicle_move.cpp b/src/vehicle_move.cpp index 781481207dbb1..88f49666d8516 100644 --- a/src/vehicle_move.cpp +++ b/src/vehicle_move.cpp @@ -1649,13 +1649,13 @@ void vehicle::precalculate_vehicle_turning( units::angle new_turn_dir, bool chec tileray mdir; // calculate direction after turn mdir.init( new_turn_dir ); - tripoint dp; + tripoint_rel_ms dp; bool is_diagonal_movement = std::lround( to_degrees( new_turn_dir ) ) % 90 == 45; if( std::abs( velocity ) >= 20 ) { mdir.advance( velocity < 0 ? -1 : 1 ); - dp.x = mdir.dx(); - dp.y = mdir.dy(); + dp.x() = mdir.dx(); + dp.y() = mdir.dy(); } // number of wheels that will land on rail @@ -2081,7 +2081,7 @@ void vehicle::check_falling_or_floating() if( !here.has_flag_ter_or_furn( ter_furn_flag::TFLAG_NO_FLOOR, position ) ) { return true; } - tripoint_bub_ms below( position.xy(), position.z() - 1 ); + tripoint_bub_ms below( position + tripoint::below ); return here.supports_above( below ); }; // Check under the wheels, if they're supported nothing else matters. diff --git a/src/vehicle_use.cpp b/src/vehicle_use.cpp index 936b7851e68ed..d35f293f4b4af 100644 --- a/src/vehicle_use.cpp +++ b/src/vehicle_use.cpp @@ -907,9 +907,8 @@ void vehicle::reload_seeds( const tripoint_bub_ms &pos ) } used_seed.front().set_age( 0_turns ); //place seeds into the planter - // TODO: fix point types put_into_vehicle_or_drop( player_character, item_drop_reason::deliberate, used_seed, - tripoint_bub_ms( pos ) ); + pos ); } } } @@ -1324,7 +1323,7 @@ void vehicle::open_or_close( const int part_index, const bool opening ) map &here = get_map(); here.set_transparency_cache_dirty( sm_pos.z() ); const tripoint_bub_ms part_location = mount_to_tripoint( parts[part_index].mount ); - here.set_seen_cache_dirty( tripoint_bub_ms( part_location ) ); + here.set_seen_cache_dirty( part_location ); const int dist = rl_dist( get_player_character().pos_bub(), part_location ); if( dist < 20 ) { sfx::play_variant_sound( opening ? "vehicle_open" : "vehicle_close", @@ -2166,7 +2165,7 @@ void vehicle::build_interact_menu( veh_menu &menu, const tripoint_bub_ms &p, boo .enable( ammo_amount >= tool_item.typeId()->charges_to_use() ) .hotkey( hk ) .skip_locked_check( tool_ammo.is_null() || tool_ammo->ammo->type != ammo_battery ) - .on_submit( [this, vppos, tool_type] { use_vehicle_tool( *this, tripoint_bub_ms( vppos ), tool_type ); } ); + .on_submit( [this, vppos, tool_type] { use_vehicle_tool( *this, vppos, tool_type ); } ); } const std::optional vp_autoclave = vp.avail_part_with_feature( "AUTOCLAVE" ); @@ -2219,7 +2218,7 @@ void vehicle::build_interact_menu( veh_menu &menu, const tripoint_bub_ms &p, boo .skip_locked_check() .on_submit( [vppos] { add_msg( _( "You carefully peek through the curtains." ) ); - g->peek( tripoint_bub_ms( vppos ) ); + g->peek( vppos ); } ); } @@ -2419,19 +2418,19 @@ void vehicle::build_interact_menu( veh_menu &menu, const tripoint_bub_ms &p, boo menu.add( string_format( _( "Lock %s" ), vp_lockable_door->part().name() ) ) .hotkey( "LOCK_DOOR" ) .on_submit( [p] { - doors::lock_door( get_map(), get_player_character(), tripoint_bub_ms( p ) ); + doors::lock_door( get_map(), get_player_character(), p ); } ); } else if( player_inside && vp_lockable_door->part().locked ) { menu.add( string_format( _( "Unlock %s" ), vp_lockable_door->part().name() ) ) .hotkey( "UNLOCK_DOOR" ) .on_submit( [p] { - doors::unlock_door( get_map(), get_player_character(), tripoint_bub_ms( p ) ); + doors::unlock_door( get_map(), get_player_character(), p ); } ); } else if( vp_lockable_door->part().locked ) { menu.add( string_format( _( "Check the lock on %s" ), vp_lockable_door->part().name() ) ) .hotkey( "LOCKPICK" ) .on_submit( [p] { - iexamine::locked_object( get_player_character(), tripoint_bub_ms( p ) ); + iexamine::locked_object( get_player_character(), p ); } ); } } diff --git a/tests/vehicle_test.cpp b/tests/vehicle_test.cpp index 255f15a025d93..bdc2623de9912 100644 --- a/tests/vehicle_test.cpp +++ b/tests/vehicle_test.cpp @@ -757,7 +757,7 @@ static int test_autopilot_moving( const vproto_id &veh_id, const vpart_id &extra vehicle &veh = *veh_ptr; if( !extra_part.is_null() ) { vehicle_part vp( extra_part, item( extra_part->base_item ) ); - const int part_index = veh.install_part( point::zero, std::move( vp ) ); + const int part_index = veh.install_part( point_rel_ms::zero, std::move( vp ) ); REQUIRE( part_index >= 0 ); }