diff --git a/src/action.cpp b/src/action.cpp index 3ccfd7e4d8550..41ef5773810a1 100644 --- a/src/action.cpp +++ b/src/action.cpp @@ -1284,11 +1284,11 @@ std::optional choose_adjacent_highlight( const tripoint &pos, const st const std::string &failure_message, const std::function &allowed, bool allow_vertical, bool allow_autoselect ) { - std::vector valid; + std::vector valid; map &here = get_map(); if( allowed ) { - for( const tripoint &pos : here.points_in_radius( pos, 1 ) ) { - if( allowed( pos ) ) { + for( const tripoint_bub_ms &pos : here.points_in_radius( tripoint_bub_ms( pos ), 1 ) ) { + if( allowed( pos.raw() ) ) { valid.emplace_back( pos ); } } @@ -1299,22 +1299,23 @@ std::optional choose_adjacent_highlight( const tripoint &pos, const st add_msg( failure_message ); return std::nullopt; } else if( valid.size() == 1 && auto_select ) { - return valid.back(); + return valid.back().raw(); } shared_ptr_fast hilite_cb; if( !valid.empty() ) { hilite_cb = make_shared_fast( [&]() { - for( const tripoint &pos : valid ) { + for( const tripoint_bub_ms &pos : valid ) { here.drawsq( g->w_terrain, pos, drawsq_params().highlight( true ) ); } } ); g->add_draw_callback( hilite_cb ); } - const std::optional chosen = choose_adjacent( pos, message, allow_vertical ); + const std::optional chosen = choose_adjacent( tripoint_bub_ms( pos ), message, + allow_vertical ); if( std::find( valid.begin(), valid.end(), chosen ) != valid.end() ) { - return chosen; + return std::optional( chosen.value().raw() ); } return std::nullopt; diff --git a/src/activity_actor.cpp b/src/activity_actor.cpp index d144ba4913497..562a6c124cdf1 100644 --- a/src/activity_actor.cpp +++ b/src/activity_actor.cpp @@ -8069,7 +8069,7 @@ void pulp_activity_actor::do_turn( player_activity &act, Character &you ) const field_type_id type_blood = ( mess_radius > 1 && x_in_y( pulp_power, 10000 ) ) ? corpse.get_mtype()->gibType() : corpse.get_mtype()->bloodType(); - here.add_splatter_trail( type_blood, pos.raw(), dest.raw() ); + here.add_splatter_trail( type_blood, pos, dest ); } // mixture of isaac clarke stomps and swinging your weapon diff --git a/src/activity_item_handling.cpp b/src/activity_item_handling.cpp index 71be657b071e8..db643c529001a 100644 --- a/src/activity_item_handling.cpp +++ b/src/activity_item_handling.cpp @@ -2710,7 +2710,7 @@ static requirement_check_result generic_multi_activity_check_requirement( const std::unordered_set &src_set, const bool check_only = false ) { map &here = get_map(); - const tripoint_abs_ms abspos = here.getglobal( you.pos() ); + const tripoint_abs_ms abspos = here.getglobal( you.pos_bub() ); zone_manager &mgr = zone_manager::get_manager(); bool &can_do_it = act_info.can_do; @@ -3185,7 +3185,7 @@ struct failure_reasons { bool generic_multi_activity_handler( player_activity &act, Character &you, bool check_only ) { map &here = get_map(); - const tripoint_abs_ms abspos = here.getglobal( you.pos() ); + const tripoint_abs_ms abspos = here.getglobal( you.pos_bub() ); // NOLINTNEXTLINE(performance-unnecessary-copy-initialization) activity_id activity_to_restore = act.id(); // Nuke the current activity, leaving the backlog alone diff --git a/src/avatar.cpp b/src/avatar.cpp index 971d1f3f93839..317ce4c1911ce 100644 --- a/src/avatar.cpp +++ b/src/avatar.cpp @@ -250,12 +250,12 @@ bool avatar::should_show_map_memory() const bool avatar::save_map_memory() { - return player_map_memory->save( get_map().getglobal( pos() ) ); + return player_map_memory->save( get_map().getglobal( pos_bub() ) ); } void avatar::load_map_memory() { - player_map_memory->load( get_map().getglobal( pos() ) ); + player_map_memory->load( get_map().getglobal( pos_bub() ) ); } void avatar::prepare_map_memory_region( const tripoint_abs_ms &p1, const tripoint_abs_ms &p2 ) diff --git a/src/ballistics.cpp b/src/ballistics.cpp index e2e69f468054e..b0c9a529e2b53 100644 --- a/src/ballistics.cpp +++ b/src/ballistics.cpp @@ -473,7 +473,7 @@ dealt_projectile_attack projectile_attack( const projectile &proj_arg, const size_t bt_len = blood_trail_len( attack.dealt_dam.total_damage() ); if( bt_len > 0 ) { const tripoint_bub_ms &dest = move_along_line( tp, trajectory, bt_len ); - here.add_splatter_trail( blood_type, tp.raw(), dest.raw() ); + here.add_splatter_trail( blood_type, tp, dest ); } } sfx::do_projectile_hit( *attack.hit_critter ); diff --git a/src/cata_tiles.cpp b/src/cata_tiles.cpp index 9e9e8c403544d..cfb17a3374783 100644 --- a/src/cata_tiles.cpp +++ b/src/cata_tiles.cpp @@ -1377,8 +1377,8 @@ void cata_tiles::draw( const point &dest, const tripoint ¢er, int width, int here.prev_o = o; you.prepare_map_memory_region( - here.getglobal( tripoint( min_mm_reg, center.z ) ), - here.getglobal( tripoint( max_mm_reg, center.z ) ) + here.getglobal( tripoint_bub_ms( min_mm_reg.x, min_mm_reg.y, center.z ) ), + here.getglobal( tripoint_bub_ms( max_mm_reg.x, max_mm_reg.y, center.z ) ) ); //set up a default tile for the edges outside the render area @@ -1819,8 +1819,8 @@ void cata_tiles::draw( const point &dest, const tripoint ¢er, int width, int if( is_isometric() && top_any_tile_range.contains( colrow ) ) { continue; } - const tripoint p( mem_x, mem_y, center.z ); - lit_level lighting = ch.visibility_cache[p.x][p.y]; + const tripoint_bub_ms p( mem_x, mem_y, center.z ); + lit_level lighting = ch.visibility_cache[p.x()][p.y()]; // `apply_vision_effects` does not memorize anything so we only need // to call `would_apply_vision_effects` here. if( would_apply_vision_effects( here.get_visibility( lighting, cache ) ) ) { @@ -1830,19 +1830,19 @@ void cata_tiles::draw( const point &dest, const tripoint ¢er, int width, int std::array invisible; invisible[0] = false; for( int i = 0; i < 4; i++ ) { - const tripoint np = p + neighborhood[i]; - invisible[1 + i] = apply_visible( np, ch, here ); + const tripoint_bub_ms np = p + neighborhood[i]; + invisible[1 + i] = apply_visible( np.raw(), ch, here ); } //calling draw to memorize (and only memorize) everything. //bypass cache check in case we learn something new about the terrain's connections - draw_terrain( p, lighting, height_3d, invisible, true ); + draw_terrain( p.raw(), lighting, height_3d, invisible, true ); if( here.memory_cache_dec_is_dirty( p ) ) { you.memorize_clear_decoration( here.getglobal( p ), "" ); - draw_furniture( p, lighting, height_3d, invisible, true ); - draw_trap( p, lighting, height_3d, invisible, true ); - draw_part_con( p, lighting, height_3d, invisible, true ); - draw_vpart_no_roof( p, lighting, height_3d, invisible, true ); - draw_vpart_roof( p, lighting, height_3d, invisible, true ); + draw_furniture( p.raw(), lighting, height_3d, invisible, true ); + draw_trap( p.raw(), lighting, height_3d, invisible, true ); + draw_part_con( p.raw(), lighting, height_3d, invisible, true ); + draw_vpart_no_roof( p.raw(), lighting, height_3d, invisible, true ); + draw_vpart_roof( p.raw(), lighting, height_3d, invisible, true ); here.memory_cache_dec_set_dirty( p, false ); } } diff --git a/src/character.cpp b/src/character.cpp index fa5315a56487a..600855d552ae4 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -8543,7 +8543,7 @@ void Character::rooted() // TODO: The rates for iron, calcium, and thirst should probably be pulled from the nutritional data rather than being hardcoded here, so that future balance changes don't break this. { if( ( has_trait( trait_ROOTS2 ) || has_trait( trait_ROOTS3 ) || has_trait( trait_CHLOROMORPH ) ) && - get_map().has_flag( ter_furn_flag::TFLAG_PLOWABLE, pos() ) && is_barefoot() ) { + get_map().has_flag( ter_furn_flag::TFLAG_PLOWABLE, pos_bub() ) && is_barefoot() ) { int time_to_full = 43200; // 12 hours if( has_trait( trait_ROOTS3 ) || has_trait( trait_CHLOROMORPH ) ) { time_to_full += -14400; // -4 hours @@ -11037,7 +11037,7 @@ void Character::process_effects() } // Being stuck in tight spaces sucks. TODO: could be expanded to apply to non-vehicle conditions. - if( will_be_cramped_in_vehicle_tile( get_map().getglobal( pos() ) ) ) { + if( will_be_cramped_in_vehicle_tile( get_map().getglobal( pos_bub() ) ) ) { if( is_npc() && !has_effect( effect_narcosis ) ) { npc &as_npc = dynamic_cast( *this ); as_npc.complain_about( "cramped_vehicle", 30_minutes, "", false ); diff --git a/src/clzones.cpp b/src/clzones.cpp index ebc543ab82fb8..6344f3e94b871 100644 --- a/src/clzones.cpp +++ b/src/clzones.cpp @@ -308,7 +308,7 @@ plot_options::query_seed_result plot_options::query_seed() zone_manager &mgr = zone_manager::get_manager(); map &here = get_map(); const std::unordered_set zone_src_set = - mgr.get_near( zone_type_LOOT_SEEDS, here.getglobal( player_character.pos() ), 60 ); + mgr.get_near( zone_type_LOOT_SEEDS, here.getglobal( player_character.pos_bub() ), 60 ); for( const tripoint_abs_ms &elem : zone_src_set ) { tripoint_bub_ms elem_loc = here.bub_from_abs( elem ); for( item &it : here.i_at( elem_loc ) ) { diff --git a/src/editmap.cpp b/src/editmap.cpp index 5dbd222505514..276ae28dc9665 100644 --- a/src/editmap.cpp +++ b/src/editmap.cpp @@ -697,7 +697,7 @@ void editmap::draw_main_ui_overlay() hilights["mapgentgt"].draw( *this, true ); drawsq_params params = drawsq_params().center( tripoint_bub_ms( SEEX - 1, SEEY - 1, target.z() ) ); for( const tripoint_omt_ms &p : tmpmap.points_on_zlevel() ) { - tmpmap.drawsq( g->w_terrain, p.raw(), params ); + tmpmap.drawsq( g->w_terrain, rebase_bub( p ), params ); } tmpmap.rebuild_vehicle_level_caches(); #ifdef TILES diff --git a/src/game.cpp b/src/game.cpp index cd0825c629de9..e7fc3990b6bea 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -6970,13 +6970,13 @@ void game::zones_manager() } tripoint_abs_ms first_abs = m.getglobal( - tripoint( + tripoint_bub_ms( std::min( first.position->x, second.position->x ), std::min( first.position->y, second.position->y ), std::min( first.position->z, second.position->z ) ) ); tripoint_abs_ms second_abs = m.getglobal( - tripoint( + tripoint_bub_ms( std::max( first.position->x, second.position->x ), std::max( first.position->y, second.position->y ), std::max( first.position->z, second.position->z ) ) ); @@ -10641,7 +10641,8 @@ bool game::walk_move( const tripoint &dest_loc, const bool via_ramp, const bool modifier = -m.furn( dest_loc ).obj().movecost; } - const int mcost = m.combined_movecost( u.pos(), dest_loc, grabbed_vehicle, modifier, + const int mcost = m.combined_movecost( u.pos_bub(), tripoint_bub_ms( dest_loc ), grabbed_vehicle, + modifier, via_ramp ); if( !furniture_move && grabbed_move( dest_loc - u.pos(), via_ramp ) ) { diff --git a/src/game_inventory.cpp b/src/game_inventory.cpp index 0308f9b97a0b2..bd0cdb02e9087 100644 --- a/src/game_inventory.cpp +++ b/src/game_inventory.cpp @@ -785,7 +785,7 @@ class comestible_inventory_preset : public inventory_selector_preset if( ( loc->made_of_from_type( phase_id::LIQUID ) && loc.where() != item_location::type::container ) && - !get_map().has_flag_furn( ter_furn_flag::TFLAG_LIQUIDCONT, loc.position() ) ) { + !get_map().has_flag_furn( ter_furn_flag::TFLAG_LIQUIDCONT, loc.pos_bub() ) ) { return _( "Can't drink spilt liquids." ); } if( diff --git a/src/item.cpp b/src/item.cpp index 9fff86f3a7b5e..96938382fdb17 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -13607,7 +13607,7 @@ ret_val item::link_to( vehicle &veh, const point &mount, link_state link_t link().source = bio_link ? link_state::bio_cable : link_state::no_link; link().target = link_type; link().t_veh = veh.get_safe_reference(); - link().t_abs_pos = get_map().getglobal( link().t_veh->global_pos3() ); + link().t_abs_pos = get_map().getglobal( link().t_veh->pos_bub() ); link().t_mount = mount; link().s_bub_pos = tripoint_min; // Forces the item to check the length during process_link. @@ -13911,7 +13911,7 @@ bool item::process_link( map &here, Character *carrier, const tripoint &pos ) link().last_processed = calendar::turn; // Set the new absolute position to the vehicle's origin. - tripoint t_veh_bub_pos = t_veh->global_pos3(); + tripoint_bub_ms t_veh_bub_pos = t_veh->pos_bub(); tripoint_abs_ms new_t_abs_pos = here.getglobal( t_veh_bub_pos ); if( link().t_abs_pos != new_t_abs_pos ) { link().t_abs_pos = new_t_abs_pos; @@ -13920,7 +13920,7 @@ bool item::process_link( map &here, Character *carrier, const tripoint &pos ) // If either of the link's connected sides moved, check the cable's length. if( length_check_needed ) { - link().length = rl_dist( pos, t_veh_bub_pos + t_veh->part( link_vp_index ).precalc[0] ); + link().length = rl_dist( pos, t_veh_bub_pos.raw() + t_veh->part( link_vp_index ).precalc[0] ); if( check_length() ) { return reset_link( true, carrier, link_vp_index ); } diff --git a/src/item_location.cpp b/src/item_location.cpp index a520947cac72b..b4ed5a80fd490 100644 --- a/src/item_location.cpp +++ b/src/item_location.cpp @@ -266,7 +266,7 @@ class item_location::impl::item_on_map : public item_location::impl item *obj = target(); int mv = ch.item_handling_cost( *obj, true, MAP_HANDLING_PENALTY, qty ); - mv += 100 * rl_dist( ch.pos(), cur.pos().raw() ); + mv += 100 * rl_dist( ch.pos_bub(), cur.pos() ); // TODO: handle unpacking costs diff --git a/src/iuse.cpp b/src/iuse.cpp index 9d8739776605d..96f294a02e53b 100644 --- a/src/iuse.cpp +++ b/src/iuse.cpp @@ -2497,7 +2497,7 @@ std::optional iuse::purify_water( Character *p, item *purifier, item_locati p->add_msg_if_player( m_info, _( "Purifying %i water using %i %s" ), charges_of_water, to_consume, purifier->tname( to_consume ) );; // Pull from surrounding map first because it will update to_consume - get_map().use_amount( p->pos(), PICKUP_RANGE, itype_pur_tablets, to_consume ); + get_map().use_amount( p->pos_bub(), PICKUP_RANGE, itype_pur_tablets, to_consume ); // Then pull from inventory if( to_consume > 0 ) { p->use_amount( itype_pur_tablets, to_consume ); @@ -2532,7 +2532,7 @@ std::optional iuse::water_tablets( Character *p, item *it, const tripoint & return ( !e->empty() && e->has_item_with( []( const item & it ) { return it.typeId() == itype_water; } ) ) || ( e->typeId() == itype_water && - get_map().has_flag_furn( ter_furn_flag::TFLAG_LIQUIDCONT, e.position() ) ); + get_map().has_flag_furn( ter_furn_flag::TFLAG_LIQUIDCONT, e.pos_bub() ) ); }, _( "Purify what?" ), 1, _( "You don't have water to purify." ) ); if( !obj ) { @@ -2560,7 +2560,7 @@ std::optional iuse::directional_antenna( Character *p, item *, const tripoi auto radios = p->cache_get_items_with( itype_radio_on ); // If we don't wield the radio, also check on the ground if( radios.empty() ) { - map_stack items = get_map().i_at( p->pos() ); + map_stack items = get_map().i_at( p->pos_bub() ); for( item &an_item : items ) { if( an_item.typeId() == itype_radio_on ) { radios.push_back( &an_item ); @@ -4960,7 +4960,7 @@ static bool heat_item( Character &p ) return itm->has_temperature() && !itm->has_own_flag( flag_HOT ) && ( !itm->made_of_from_type( phase_id::LIQUID ) || itm.where() == item_location::type::container || - get_map().has_flag_furn( ter_furn_flag::TFLAG_LIQUIDCONT, itm.position() ) ); + get_map().has_flag_furn( ter_furn_flag::TFLAG_LIQUIDCONT, itm.pos_bub() ) ); }, _( "Heat up what?" ), 1, _( "You don't have any appropriate food to heat up." ) ); item *heat = loc.get_item(); @@ -8345,7 +8345,7 @@ static bool heat_items( Character *p, item *it, bool liquid_items, bool solid_it return itm->has_temperature() && !itm->has_own_flag( flag_HOT ) && ( !itm->made_of_from_type( phase_id::LIQUID ) || itm.where() == item_location::type::container || - get_map().has_flag_furn( ter_furn_flag::TFLAG_LIQUIDCONT, itm.position() ) ); + get_map().has_flag_furn( ter_furn_flag::TFLAG_LIQUIDCONT, itm.pos_bub() ) ); }, _( "Heat up what?" ), 1, _( "You don't have any appropriate food to heat up." ) ); if( !loc ) { return false; diff --git a/src/lightmap.cpp b/src/lightmap.cpp index cf86c8cfe4b18..fd8d60ec63791 100644 --- a/src/lightmap.cpp +++ b/src/lightmap.cpp @@ -1130,18 +1130,18 @@ void map::seen_cache_process_ledges( array_of_grids_of &seen_caches, for( int sy = 0; sy < SEEY; ++sy ) { // Iterate down z-levels starting from 1 level below origin for( int sz = origin.z() - 1; sz >= min_z; --sz ) { - const tripoint p( sx + smx * SEEX, sy + smy * SEEY, sz ); + const tripoint_bub_ms p( sx + smx * SEEX, sy + smy * SEEY, sz ); const int cache_z = sz + OVERMAP_DEPTH; // Until invisible tile reached - if( ( *seen_caches[cache_z] )[p.x][p.y] == 0.0f ) { + if( ( *seen_caches[cache_z] )[p.x()][p.y()] == 0.0f ) { break; } // Or floor reached - if( ( *floor_caches[cache_z] ) [p.x][p.y] ) { + if( ( *floor_caches[cache_z] ) [p.x()][p.y()] ) { // In which case check if it should be obscured by a ledge - if( override_p ? ledge_coverage( origin.raw(), p ) > 100 : ledge_coverage( player_character, + if( override_p ? ledge_coverage( origin, p ) > 100 : ledge_coverage( player_character, p ) > 100 ) { - ( *seen_caches[cache_z] )[p.x][p.y] = 0.0f; + ( *seen_caches[cache_z] )[p.x()][p.y()] = 0.0f; } break; } diff --git a/src/map.cpp b/src/map.cpp index d53f8702771c0..21435679c6ac4 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -2608,14 +2608,6 @@ bool map::passable_ter_furn( const tripoint_bub_ms &p ) const return move_cost_ter_furn( p ) != 0; } -int map::combined_movecost( const tripoint &from, const tripoint &to, - const vehicle *ignored_vehicle, - const int modifier, const bool flying, const bool via_ramp ) const -{ - return map::combined_movecost( tripoint_bub_ms( from ), tripoint_bub_ms( to ), ignored_vehicle, - modifier, flying, via_ramp ); -} - int map::combined_movecost( const tripoint_bub_ms &from, const tripoint_bub_ms &to, const vehicle *ignored_vehicle, const int modifier, const bool flying, const bool via_ramp ) const @@ -2742,11 +2734,6 @@ bool map::valid_move( const tripoint_bub_ms &from, const tripoint_bub_ms &to, // End of move cost -double map::ranged_target_size( const tripoint &p ) const -{ - return map::ranged_target_size( tripoint_bub_ms( p ) ); -} - double map::ranged_target_size( const tripoint_bub_ms &p ) const { if( impassable( p ) ) { @@ -2838,11 +2825,6 @@ bool map::has_floor_or_water( const tripoint_bub_ms &p ) const return !has_flag( ter_furn_flag::TFLAG_NO_FLOOR, p ); } -bool map::supports_above( const tripoint &p ) const -{ - return map::supports_above( tripoint_bub_ms( p ) ); -} - bool map::supports_above( const tripoint_bub_ms &p ) const { const const_maptile tile = maptile_at( p ); @@ -3636,11 +3618,6 @@ bool map::is_last_ter_wall( const bool no_furn, const point_bub_ms &p, return result; } -bool map::tinder_at( const tripoint &p ) -{ - return map::tinder_at( tripoint_bub_ms( p ) ); -} - bool map::tinder_at( const tripoint_bub_ms &p ) { for( const item &i : i_at( p ) ) { @@ -4054,11 +4031,6 @@ void map::collapse_at( const tripoint_bub_ms &p, const bool silent, const bool w // that's not handled for now } -void map::smash_items( const tripoint &p, const int power, const std::string &cause_message ) -{ - map::smash_items( tripoint_bub_ms( p ), power, cause_message ); -} - void map::smash_items( const tripoint_bub_ms &p, const int power, const std::string &cause_message ) { if( !has_items( p ) || has_flag_ter_or_furn( ter_furn_flag::TFLAG_PLANT, p ) ) { @@ -4710,11 +4682,6 @@ void map::crush( const tripoint_bub_ms &p ) vp->vehicle().damage( *this, vp->part_index(), rng( 100, 1000 ), damage_bash, false ); } } -void map::shoot( const tripoint &p, projectile &proj, const bool hit_items ) -{ - map::shoot( tripoint_bub_ms( p ), proj, hit_items ); -} - void map::shoot( const tripoint_bub_ms &p, projectile &proj, const bool hit_items ) { // TODO: make bashing better a destroying, worse at penetrating @@ -5104,11 +5071,6 @@ std::string map::get_signage( const tripoint_bub_ms &p ) const return current_submap->get_signage( l ); } -void map::set_signage( const tripoint &p, const std::string &message ) -{ - map::set_signage( tripoint_bub_ms( p ), message ); -} - void map::set_signage( const tripoint_bub_ms &p, const std::string &message ) { if( !inbounds( p ) ) { @@ -5162,11 +5124,6 @@ int map::get_radiation( const tripoint_bub_ms &p ) const return current_submap->get_radiation( l ); } -void map::set_radiation( const tripoint &p, const int value ) -{ - map::set_radiation( tripoint_bub_ms( p ), value ); -} - void map::set_radiation( const tripoint_bub_ms &p, const int value ) { if( !inbounds( p ) ) { @@ -5247,7 +5204,7 @@ map_stack map::i_at( const tripoint_bub_ms &p ) { if( !inbounds( p ) ) { nulitems.clear(); - return map_stack{ &nulitems, p.raw(), this}; + return map_stack{ &nulitems, p, this}; } point_sm_ms l; @@ -5255,16 +5212,10 @@ map_stack map::i_at( const tripoint_bub_ms &p ) if( current_submap == nullptr ) { debugmsg( "Tried to get items at (%d,%d) but the submap is not loaded", l.x(), l.y() ); nulitems.clear(); - return map_stack{ &nulitems, p.raw(), this}; + return map_stack{ &nulitems, p, this}; } - return map_stack{ ¤t_submap->get_items( l ), p.raw(), this}; -} - -map_stack::iterator map::i_rem( const tripoint &p, const map_stack::const_iterator &it ) -{ - - return map::i_rem( tripoint_bub_ms( p ), it ); + return map_stack{ ¤t_submap->get_items( l ), p, this}; } map_stack::iterator map::i_rem( const tripoint_bub_ms &p, const map_stack::const_iterator &it ) @@ -5274,7 +5225,7 @@ map_stack::iterator map::i_rem( const tripoint_bub_ms &p, const map_stack::const if( current_submap == nullptr ) { debugmsg( "Tried to remove items at (%d,%d) but the submap is not loaded", l.x(), l.y() ); nulitems.clear(); - return map_stack{ &nulitems, p.raw(), this} .begin(); + return map_stack{ &nulitems, p, this} .begin(); } current_submap->update_lum_rem( l, *it ); @@ -6132,11 +6083,6 @@ bool map::could_see_items( const tripoint_bub_ms &p, const tripoint_bub_ms &from return true; } -bool map::has_items( const tripoint &p ) const -{ - return has_items( tripoint_bub_ms( p ) ); -} - bool map::has_items( const tripoint_bub_ms &p ) const { if( !inbounds( p ) ) { @@ -6279,12 +6225,6 @@ std::list map::use_amount( const std::vector &reachable_p return ret; } -std::list map::use_amount( const tripoint &origin, const int range, const itype_id &type, - int &quantity, const std::function &filter, bool select_ind ) -{ - return map::use_amount( tripoint_bub_ms( origin ), range, type, quantity, filter, select_ind ); -} - std::list map::use_amount( const tripoint_bub_ms &origin, const int range, const itype_id &type, int &quantity, const std::function &filter, bool select_ind ) @@ -6295,7 +6235,7 @@ std::list map::use_amount( const tripoint_bub_ms &origin, const int range, } static void use_charges_from_furn( const furn_t &f, const itype_id &type, int &quantity, - map *m, const tripoint &p, std::list &ret, + map *m, const tripoint_bub_ms &p, std::list &ret, const std::function &filter, bool in_tools ) { if( m->has_flag( ter_furn_flag::TFLAG_LIQUIDCONT, p ) ) { @@ -6346,7 +6286,7 @@ static void use_charges_from_furn( const furn_t &f, const itype_id &type, int &q if( !filter( furn_item ) ) { return; } - if( furn_item.use_charges( type, quantity, ret, p, return_true, nullptr, in_tools ) ) { + if( furn_item.use_charges( type, quantity, ret, p.raw(), return_true, nullptr, in_tools ) ) { stack.erase( iter ); } else { iter->charges = furn_item.ammo_remaining(); @@ -6409,7 +6349,7 @@ std::list map::use_charges( const std::vector &reachable_ } if( has_furn( p ) ) { - use_charges_from_furn( furn( p ).obj(), type, quantity, this, p.raw(), ret, filter, in_tools ); + use_charges_from_furn( furn( p ).obj(), type, quantity, this, p, ret, filter, in_tools ); if( quantity <= 0 ) { return ret; } @@ -6518,11 +6458,6 @@ std::list > map::get_rc_items( const tripoint return rc_pairs; } -bool map::can_see_trap_at( const tripoint &p, const Character &c ) const -{ - return tr_at( tripoint_bub_ms( p ) ).can_see( tripoint_bub_ms( p ), c ); -} - bool map::can_see_trap_at( const tripoint_bub_ms &p, const Character &c ) const { return tr_at( p ).can_see( p, c ); @@ -6845,11 +6780,6 @@ cata::copy_const *map::get_field_helper( return current_submap->get_field( l ).find_field( type ); } -field_entry *map::get_field( const tripoint &p, const field_type_id &type ) -{ - return get_field( tripoint_bub_ms( p ), type ); -} - field_entry *map::get_field( const tripoint_bub_ms &p, const field_type_id &type ) { return get_field_helper( *this, p, type ); @@ -6949,11 +6879,6 @@ bool map::add_field( const tripoint_bub_ms &p, const field_type_id &type_id, int return true; } -void map::remove_field( const tripoint &p, const field_type_id &field_to_remove ) -{ - return remove_field( tripoint_bub_ms( p ), field_to_remove ); -} - void map::remove_field( const tripoint_bub_ms &p, const field_type_id &field_to_remove ) { set_field_intensity( p, field_to_remove, 0 ); @@ -7013,11 +6938,6 @@ void map::on_field_modified( const tripoint_bub_ms &p, const field_type &fd_type } } -void map::add_splatter( const field_type_id &type, const tripoint &where, int intensity ) -{ - map::add_splatter( type, tripoint_bub_ms( where ), intensity ); -} - void map::add_splatter( const field_type_id &type, const tripoint_bub_ms &where, int intensity ) { if( intensity <= 0 ) { @@ -7037,12 +6957,6 @@ void map::add_splatter( const field_type_id &type, const tripoint_bub_ms &where, mod_field_intensity( where, type, intensity ); } -void map::add_splatter_trail( const field_type_id &type, const tripoint &from, - const tripoint &to ) -{ - map::add_splatter_trail( type, tripoint_bub_ms( from ), tripoint_bub_ms( to ) ); -} - void map::add_splatter_trail( const field_type_id &type, const tripoint_bub_ms &from, const tripoint_bub_ms &to ) { @@ -7147,11 +7061,11 @@ void map::update_visibility_cache( const int zlev ) { Character &player_character = get_player_character(); if( !visibility_variables_cache.visibility_cache_dirty && - player_character.pos() == visibility_variables_cache.last_pos ) { + player_character.pos_bub().raw() == visibility_variables_cache.last_pos ) { return; } - if( player_character.pos().z - zlev < fov_3d_z_range && zlev > -OVERMAP_DEPTH ) { + if( player_character.pos_bub().z() - zlev < fov_3d_z_range && zlev > -OVERMAP_DEPTH ) { update_visibility_cache( zlev - 1 ); } visibility_variables_cache.variables_set = true; // Not used yet @@ -7253,7 +7167,7 @@ visibility_type map::get_visibility( const lit_level ll, return visibility_type::HIDDEN; } -static std::optional get_memory_at( const tripoint &p ) +static std::optional get_memory_at( const tripoint_bub_ms &p ) { const memorized_tile &mt = get_avatar().get_memorized_tile( get_map().getglobal( p ) ); if( mt.symbol != 0 ) { @@ -7296,7 +7210,7 @@ void map::draw( const catacurses::window &w, const tripoint_bub_ms ¢er ) getglobal( { min_mm_reg, center.z() } ), getglobal( { max_mm_reg, center.z() } ) ); - const auto draw_background = [&]( const tripoint & p ) { + const auto draw_background = [&]( const tripoint_bub_ms & p ) { int sym = ' '; nc_color col = c_black; if( const std::optional memorized_symbol = get_memory_at( p ) ) { @@ -7334,7 +7248,7 @@ void map::draw( const catacurses::window &w, const tripoint_bub_ms ¢er ) wmove( w, point( wx, wy ) ); const tripoint_bub_ms p = offs + tripoint_rel_ms( wx, wy, 0 ); if( !inbounds( p ) ) { - draw_background( p.raw() ); + draw_background( p ); continue; } @@ -7346,7 +7260,7 @@ void map::draw( const catacurses::window &w, const tripoint_bub_ms ¢er ) } if( vis == visibility_type::HIDDEN || vis == visibility_type::DARK ) { - draw_background( p.raw() ); + draw_background( p ); continue; } @@ -7719,14 +7633,14 @@ void map::draw_from_above( const catacurses::window &w, const tripoint_bub_ms &p bool map::sees( const tripoint &F, const tripoint &T, const int range, bool with_fields ) const { int dummy = 0; - return sees( F, T, range, dummy, with_fields ); + return sees( tripoint_bub_ms( F ), tripoint_bub_ms( T ), range, dummy, with_fields ); } bool map::sees( const tripoint_bub_ms &F, const tripoint_bub_ms &T, const int range, bool with_fields ) const { int dummy = 0; - return sees( F.raw(), T.raw(), range, dummy, with_fields ); + return sees( F, T, range, dummy, with_fields ); } // TODO: Change this to a hash function on the map implementation. This will also allow us to @@ -7747,12 +7661,6 @@ point map::sees_cache_key( const tripoint_bub_ms &from, const tripoint_bub_ms &t /** * This one is internal-only, we don't want to expose the slope tweaking ickiness outside the map class. **/ -bool map::sees( const tripoint &F, const tripoint &T, const int range, - int &bresenham_slope, bool with_fields ) const -{ - return map::sees( tripoint_bub_ms( F ), tripoint_bub_ms( T ), range, bresenham_slope, with_fields ); -} - bool map::sees( const tripoint_bub_ms &F, const tripoint_bub_ms &T, const int range, int &bresenham_slope, bool with_fields, bool allow_cached ) const { @@ -7853,11 +7761,6 @@ int map::obstacle_coverage( const tripoint_bub_ms &loc1, const tripoint_bub_ms & return ter( obstaclepos )->coverage; } -int map::ledge_coverage( const Creature &viewer, const tripoint &target_p ) const -{ - return map::ledge_coverage( viewer, tripoint_bub_ms( target_p ) ); -} - int map::ledge_coverage( const Creature &viewer, const tripoint_bub_ms &target_p ) const { tripoint_bub_ms viewer_p = viewer.pos_bub(); @@ -7902,12 +7805,6 @@ int map::ledge_coverage( const Creature &viewer, const tripoint_bub_ms &target_p return ledge_coverage( viewer_p, target_p, eye_level ); } -int map::ledge_coverage( const tripoint &viewer_p, const tripoint &target_p, - const float &eye_level ) const -{ - return map::ledge_coverage( tripoint_bub_ms( viewer_p ), tripoint_bub_ms( target_p ), eye_level ); -} - int map::ledge_coverage( const tripoint_bub_ms &viewer_p, const tripoint_bub_ms &target_p, const float &eye_level ) const { @@ -7988,21 +7885,6 @@ int map::coverage( const tripoint_bub_ms &p ) const // This method tries a bunch of initial offsets for the line to try and find a clear one. // Basically it does, "Find a line from any point in the source that ends up in the target square". -std::vector map::find_clear_path( const tripoint &source, - const tripoint &destination ) const -{ - const std::vector temp = map::find_clear_path( tripoint_bub_ms( source ), - tripoint_bub_ms( destination ) ); - std::vector result; - result.reserve( temp.size() ); - - for( tripoint_bub_ms pt : temp ) { - result.push_back( pt.raw() ); - } - - return result; -} - std::vector map::find_clear_path( const tripoint_bub_ms &source, const tripoint_bub_ms &destination ) const { @@ -8236,27 +8118,13 @@ bool map::clear_path( const tripoint_bub_ms &f, const tripoint_bub_ms &t, const bool map::accessible_items( const tripoint &t ) const { - return !has_flag( ter_furn_flag::TFLAG_SEALED, t ) || - has_flag( ter_furn_flag::TFLAG_LIQUIDCONT, t ); + return accessible_items( tripoint_bub_ms( t ) ); } bool map::accessible_items( const tripoint_bub_ms &t ) const { - return accessible_items( t.raw() ); -} - -std::vector map::get_dir_circle( const tripoint &f, const tripoint &t ) const -{ - const std::vector temp = map::get_dir_circle( tripoint_bub_ms( f ), - tripoint_bub_ms( t ) ); - std::vector result; - result.reserve( temp.size() ); - - for( const tripoint_bub_ms pt : temp ) { - result.push_back( pt.raw() ); - } - - return result; + return !has_flag( ter_furn_flag::TFLAG_SEALED, t ) || + has_flag( ter_furn_flag::TFLAG_LIQUIDCONT, t ); } std::vector map::get_dir_circle( const tripoint_bub_ms &f, @@ -8396,10 +8264,10 @@ void map::shift_traps( const point_rel_sm &shift ) } template -void shift_bitset_cache( std::bitset &cache, const point &s ) +void shift_bitset_cache( std::bitset &cache, const point_rel_sm &s ) { // sx shifts by MULTIPLIER rows, sy shifts by MULTIPLIER columns. - int shift_amount = s.x * MULTIPLIER + s.y * SIZE * MULTIPLIER; + int shift_amount = s.x() * MULTIPLIER + s.y() * SIZE * MULTIPLIER; if( shift_amount > 0 ) { cache >>= static_cast( shift_amount ); } else if( shift_amount < 0 ) { @@ -8407,10 +8275,10 @@ void shift_bitset_cache( std::bitset &cache, const point &s ) } // Shifting in the y direction shifted in 0 values, no no additional clearing is necessary, but // a shift in the x direction makes values "wrap" to the next row, and they need to be zeroed. - if( s.x == 0 ) { + if( s.x() == 0 ) { return; } - const size_t x_offset = s.x > 0 ? SIZE - MULTIPLIER : 0; + const size_t x_offset = s.x() > 0 ? SIZE - MULTIPLIER : 0; for( size_t y = 0; y < SIZE; ++y ) { size_t y_offset = y * SIZE; for( size_t x = 0; x < MULTIPLIER; ++x ) { @@ -8421,9 +8289,9 @@ void shift_bitset_cache( std::bitset &cache, const point &s ) template void shift_bitset_cache( std::bitset &cache, - const point &s ); + const point_rel_sm &s ); template void -shift_bitset_cache( std::bitset &cache, const point &s ); +shift_bitset_cache( std::bitset &cache, const point_rel_sm &s ); void map::shift( const point_rel_sm &sp ) { @@ -8486,9 +8354,9 @@ void map::shift( const point_rel_sm &sp ) clear_vehicle_list( gridz ); level_cache *cache = get_cache_lazy( gridz ); if( cache ) { - shift_bitset_cache( cache->map_memory_cache_dec, sp.raw() ); - shift_bitset_cache( cache->map_memory_cache_ter, sp.raw() ); - shift_bitset_cache( cache->field_cache, sp.raw() ); + shift_bitset_cache( cache->map_memory_cache_dec, sp ); + shift_bitset_cache( cache->map_memory_cache_ter, sp ); + shift_bitset_cache( cache->field_cache, sp ); } } @@ -10613,16 +10481,6 @@ void map::scent_blockers( std::array, MAPSIZE_Y> &bl } } -tripoint_range map::points_in_rectangle( const tripoint &from, const tripoint &to ) const -{ - const tripoint min( std::max( 0, std::min( from.x, to.x ) ), std::max( 0, std::min( from.y, - to.y ) ), std::max( -OVERMAP_DEPTH, std::min( from.z, to.z ) ) ); - const tripoint max( std::min( SEEX * my_MAPSIZE - 1, std::max( from.x, to.x ) ), - std::min( SEEX * my_MAPSIZE - 1, std::max( from.y, to.y ) ), std::min( OVERMAP_HEIGHT, - std::max( from.z, to.z ) ) ); - return tripoint_range( min, max ); -} - tripoint_range map::points_in_rectangle( const tripoint_bub_ms &from, const tripoint_bub_ms &to ) const { diff --git a/src/map.h b/src/map.h index a1b3dc5be3f63..6d19b412f2f03 100644 --- a/src/map.h +++ b/src/map.h @@ -109,10 +109,10 @@ using relic_procgen_id = string_id; class map_stack : public item_stack { private: - tripoint location; + tripoint_bub_ms location; map *myorigin; public: - map_stack( cata::colony *newstack, tripoint newloc, map *neworigin ) : + map_stack( cata::colony *newstack, tripoint_bub_ms newloc, map *neworigin ) : item_stack( newstack ), location( newloc ), myorigin( neworigin ) {} void insert( const item &newitem ) override; iterator erase( const_iterator it ) override; @@ -644,11 +644,6 @@ class map * * @return The cost in turns to move out of tripoint `from` and into `to` */ - // TODO: Get rid of untyped overload. - int combined_movecost( const tripoint &from, const tripoint &to, - const vehicle *ignored_vehicle = nullptr, - int modifier = 0, bool flying = false, bool via_ramp = false ) const; - int combined_movecost( const tripoint_bub_ms &from, const tripoint_bub_ms &to, const vehicle *ignored_vehicle = nullptr, int modifier = 0, bool flying = false, bool via_ramp = false ) const; @@ -669,8 +664,6 @@ class map * Size is in percentage of tile: if 1.0, all attacks going through tile * should hit map objects on it, if 0.0 there is nothing to be hit (air/water). */ - // TODO: Get rid of untyped overload. - double ranged_target_size( const tripoint &p ) const; double ranged_target_size( const tripoint_bub_ms &p ) const; // Sees: @@ -692,9 +685,6 @@ class map * the two points, and may subsequently be used to form a path between them. * Set to zero if the function returns false. **/ - // TODO: Get rid of untyped overload. - bool sees( const tripoint &F, const tripoint &T, int range, int &bresenham_slope, - bool with_fields = true ) const; bool sees( const tripoint_bub_ms &F, const tripoint_bub_ms &T, int range, int &bresenham_slope, bool with_fields = true, bool allow_cached = true ) const; point sees_cache_key( const tripoint_bub_ms &from, const tripoint_bub_ms &to ) const; @@ -705,12 +695,7 @@ class map * If there's no obstacle adjacent to the target - no coverage. */ int obstacle_coverage( const tripoint_bub_ms &loc1, const tripoint_bub_ms &loc2 ) const; - // TODO: Get rid of untyped override. - int ledge_coverage( const Creature &viewer, const tripoint &target_p ) const; int ledge_coverage( const Creature &viewer, const tripoint_bub_ms &target_p ) const; - // TODO: Get rid of untyped override. - int ledge_coverage( const tripoint &viewer_p, const tripoint &target_p, - const float &eye_level = 1.0f ) const; int ledge_coverage( const tripoint_bub_ms &viewer_p, const tripoint_bub_ms &target_p, const float &eye_level = 1.0f ) const; /** @@ -756,8 +741,6 @@ class map * until it finds a clear line or decides there isn't one. * returns the line found, which may be the straight line, but blocked. */ - // TODO: get rid of untyped overload. - std::vector find_clear_path( const tripoint &source, const tripoint &destination ) const; std::vector find_clear_path( const tripoint_bub_ms &source, const tripoint_bub_ms &destination ) const; @@ -773,8 +756,6 @@ class map * Points closer to the target come first. * This method leads to straighter lines and prevents weird looking movements away from the target. */ - // TODO: Get rid of untyped overload. - std::vector get_dir_circle( const tripoint &f, const tripoint &t ) const; std::vector get_dir_circle( const tripoint_bub_ms &f, const tripoint_bub_ms &t ) const; @@ -1110,8 +1091,6 @@ class map /** * Checks for existence of items. Faster than i_at(p).empty */ - // TODO: fix point types (remove the first overload) - bool has_items( const tripoint &p ) const; bool has_items( const tripoint_bub_ms &p ) const; // Check if a tile with LIQUIDCONT flag only contains liquids @@ -1170,7 +1149,7 @@ class map bool has_flag( ter_furn_flag flag, const tripoint_bub_ms &p ) const; // TODO: Get rid of untyped overload. bool has_flag( ter_furn_flag flag, const point &p ) const { - return has_flag( flag, tripoint( p, abs_sub.z() ) ); + return has_flag( flag, tripoint_bub_ms( p.x, p.y, abs_sub.z() ) ); } bool has_flag( ter_furn_flag flag, const point_bub_ms &p ) const { return has_flag( flag, tripoint_bub_ms( p, abs_sub.z() ) ); @@ -1182,7 +1161,7 @@ class map bool has_flag_ter( ter_furn_flag flag, const tripoint_bub_ms &p ) const; // TODO: get rid of untyped overload. bool has_flag_ter( ter_furn_flag flag, const point &p ) const { - return has_flag_ter( flag, tripoint( p, abs_sub.z() ) ); + return has_flag_ter( flag, tripoint_bub_ms( p.x, p.y, abs_sub.z() ) ); } bool has_flag_ter( ter_furn_flag flag, const point_bub_ms &p ) const { return has_flag_ter( flag, tripoint_bub_ms( p, abs_sub.z() ) ); @@ -1279,8 +1258,6 @@ class map * Checks if there are any tinder flagged items on the tile. * @param p tile to check */ - // TODO: Get rid of untyped overload. - bool tinder_at( const tripoint &p ); bool tinder_at( const tripoint_bub_ms &p ); /** @@ -1347,8 +1324,6 @@ class map /** Keeps bashing a square until there is no more furniture */ void destroy_furn( const tripoint_bub_ms &, bool silent = false ); void crush( const tripoint_bub_ms &p ); - // TODO: Get rid of untyped overload. - void shoot( const tripoint &p, projectile &proj, bool hit_items ); void shoot( const tripoint_bub_ms &p, projectile &proj, bool hit_items ); /** Checks if a square should collapse, returns the X for the one_in(X) collapse chance */ int collapse_check( const tripoint_bub_ms &p ) const; @@ -1356,8 +1331,6 @@ class map void collapse_at( const tripoint_bub_ms &p, bool silent, bool was_supporting = false, bool destroy_pos = true ); /** Tries to smash the items at the given tripoint. Used by the explosion code */ - // TODO: Get rid of untyped overload. - void smash_items( const tripoint &p, int power, const std::string &cause_message ); void smash_items( const tripoint_bub_ms &p, int power, const std::string &cause_message ); /** * Returns a pair where first is whether anything was smashed and second is if it was destroyed. @@ -1411,8 +1384,6 @@ class map // TODO: Get rid of untyped overload. std::string get_signage( const tripoint &p ) const; std::string get_signage( const tripoint_bub_ms &p ) const; - // TODO: Get rid of untyped overload. - void set_signage( const tripoint &p, const std::string &message ); void set_signage( const tripoint_bub_ms &p, const std::string &message ); void delete_signage( const tripoint_bub_ms &p ); @@ -1420,8 +1391,6 @@ class map // TODO: Get rid of untyped overload. int get_radiation( const tripoint &p ) const; int get_radiation( const tripoint_bub_ms &p ) const; - // TODO: Get rid of untyped overload. - void set_radiation( const tripoint &p, int value ); void set_radiation( const tripoint_bub_ms &p, int value ); void set_radiation( const point_bub_ms &p, const int value ) { set_radiation( tripoint_bub_ms( p, abs_sub.z() ), value ); @@ -1466,8 +1435,6 @@ class map } // i_rem() methods that return values act like container::erase(), // returning an iterator to the next item after removal. - // TODO: Get rid of untyped overload. - map_stack::iterator i_rem( const tripoint &p, const map_stack::const_iterator &it ); map_stack::iterator i_rem( const tripoint_bub_ms &p, const map_stack::const_iterator &it ); // TODO: fix point types (remove the first overload) void i_rem( const tripoint &p, item *it ); @@ -1600,9 +1567,6 @@ class map /*@{*/ std::list use_amount_square( const tripoint_bub_ms &p, const itype_id &type, int &quantity, const std::function &filter = return_true ); - // TODO: Get rid of untyped overload. - std::list use_amount( const tripoint &origin, int range, const itype_id &type, int &quantity, - const std::function &filter = return_true, bool select_ind = false ); std::list use_amount( const tripoint_bub_ms &origin, int range, const itype_id &type, int &quantity, const std::function &filter = return_true, bool select_ind = false ); @@ -1728,8 +1692,6 @@ class map const trap &tr_at( const tripoint_abs_ms &p ) const; const trap &tr_at( const tripoint_bub_ms &p ) const; /// See @ref trap::can_see, which is called for the trap here. - // TODO: Get rid of untyped overload. - bool can_see_trap_at( const tripoint &p, const Character &c ) const; bool can_see_trap_at( const tripoint_bub_ms &p, const Character &c ) const; // TODO: fix point types (remove the first overload) @@ -1848,8 +1810,6 @@ class map * Get field of specific type at point. * @return NULL if there is no such field entry at that place. */ - // TODO: fix point types (remove the first overload) - field_entry *get_field( const tripoint &p, const field_type_id &type ); field_entry *get_field( const tripoint_bub_ms &p, const field_type_id &type ); const field_entry *get_field( const tripoint_bub_ms &p, const field_type_id &type ) const; bool dangerous_field_at( const tripoint_bub_ms &p ); @@ -1870,8 +1830,6 @@ class map /** * Remove field entry at xy, ignored if the field entry is not present. */ - // TODO: fix point types (remove the first overload) - void remove_field( const tripoint &p, const field_type_id &field_to_remove ); void remove_field( const tripoint_bub_ms &p, const field_type_id &field_to_remove ); /** * Deletes the field without regard for any possible need for cleanup. Circumvents @@ -1904,11 +1862,7 @@ class map public: // Splatters of various kind - // TODO: Get rid of untyped overload. - void add_splatter( const field_type_id &type, const tripoint &where, int intensity = 1 ); void add_splatter( const field_type_id &type, const tripoint_bub_ms &where, int intensity = 1 ); - // TODO: Get rid of untyped overload. - void add_splatter_trail( const field_type_id &type, const tripoint &from, const tripoint &to ); void add_splatter_trail( const field_type_id &type, const tripoint_bub_ms &from, const tripoint_bub_ms &to ); void add_splash( const field_type_id &type, const tripoint_bub_ms ¢er, int radius, @@ -1988,8 +1942,6 @@ class map bool has_floor_or_water( const tripoint &p ) const; bool has_floor_or_water( const tripoint_bub_ms &p ) const; /** Does this tile support vehicles and furniture above it */ - // TODO: Get rid of untyped overload - bool supports_above( const tripoint &p ) const; bool supports_above( const tripoint_bub_ms &p ) const; // TODO: Get rid of untyped overload bool has_floor_or_support( const tripoint &p ) const; @@ -2566,9 +2518,6 @@ class map return submaps_with_active_items; } // Clips the area to map bounds - // TODO: fix point types (remove the first overload) - tripoint_range points_in_rectangle( - const tripoint &from, const tripoint &to ) const; tripoint_range points_in_rectangle( const tripoint_bub_ms &from, const tripoint_bub_ms &to ) const; // TODO: fix point types (remove the first overload) @@ -2627,7 +2576,7 @@ class map map &get_map(); template -void shift_bitset_cache( std::bitset &cache, const point &s ); +void shift_bitset_cache( std::bitset &cache, const point_rel_sm &s ); bool ter_furn_has_flag( const ter_t &ter, const furn_t &furn, ter_furn_flag flag ); // Returns the terrain to apply if the terrain is uniform, and t_null otherwise. @@ -2838,7 +2787,7 @@ class tinymap : private map } // TODO: Get rid of untyped overload. void i_clear( const tripoint &p ) { - return map::i_clear( p ); + return map::i_clear( tripoint_bub_ms( p ) ); } void i_clear( const tripoint_omt_ms &p ) { return map::i_clear( rebase_bub( p ) ); @@ -2899,7 +2848,7 @@ class tinymap : private map }; // TODO: Get rid of untyped overload. bool is_outside( const tripoint &p ) const { - return map::is_outside( p ); + return map::is_outside( tripoint_bub_ms( p ) ); } bool is_outside( const tripoint_omt_ms &p ) const { return map::is_outside( rebase_bub( p ) ); diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 30951229624c6..f447fedd3fdc0 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -3603,7 +3603,7 @@ class jmapgen_variable : public jmapgen_piece } void apply( const mapgendata &dat, const jmapgen_int &x, const jmapgen_int &y, const jmapgen_int &z, const std::string &/*context*/ ) const override { - queued_points[name] = dat.m.getglobal( tripoint( x.val, y.val, + queued_points[name] = dat.m.getglobal( tripoint_bub_ms( int( x.val ), int( y.val ), dat.zlevel() + z.get() ) ); } }; @@ -5813,7 +5813,7 @@ void map::draw_lab( mapgendata &dat ) // Rotated maps cannot handle borders and have to be caught in code. // We determine if a border isn't handled by checking the east-facing // border space where the door normally is -- it should be a wall or door. - tripoint east_border( 23, 11, abs_sub.z() ); + tripoint_bub_ms east_border( 23, 11, abs_sub.z() ); if( !has_flag_ter( ter_furn_flag::TFLAG_WALL, east_border ) && !has_flag_ter( ter_furn_flag::TFLAG_DOOR, east_border ) ) { // TODO: create a ter_reset function that does ter_set, @@ -5825,32 +5825,32 @@ void map::draw_lab( mapgendata &dat ) ter_str_id bw_type = tower_lab && bw == 2 ? ter_t_reinforced_glass : ter_t_concrete_wall; for( int i = 0; i < SEEX * 2; i++ ) { - ter_set( point( 23, i ), rw_type ); - furn_set( point( 23, i ), furn_str_id::NULL_ID() ); - i_clear( tripoint( 23, i, dat.zlevel() ) ); + ter_set( point_bub_ms( 23, i ), rw_type ); + furn_set( point_bub_ms( 23, i ), furn_str_id::NULL_ID() ); + i_clear( tripoint_bub_ms( 23, i, dat.zlevel() ) ); - ter_set( point( i, 23 ), bw_type ); - furn_set( point( i, 23 ), furn_str_id::NULL_ID() ); - i_clear( tripoint( i, 23, dat.zlevel() ) ); + ter_set( point_bub_ms( i, 23 ), bw_type ); + furn_set( point_bub_ms( i, 23 ), furn_str_id::NULL_ID() ); + i_clear( tripoint_bub_ms( i, 23, dat.zlevel() ) ); if( lw == 2 ) { - ter_set( point( 0, i ), lw_type ); - furn_set( point( 0, i ), furn_str_id::NULL_ID() ); - i_clear( tripoint( 0, i, dat.zlevel() ) ); + ter_set( point_bub_ms( 0, i ), lw_type ); + furn_set( point_bub_ms( 0, i ), furn_str_id::NULL_ID() ); + i_clear( tripoint_bub_ms( 0, i, dat.zlevel() ) ); } if( tw == 2 ) { - ter_set( point( i, 0 ), tw_type ); - furn_set( point( i, 0 ), furn_str_id::NULL_ID() ); - i_clear( tripoint( i, 0, dat.zlevel() ) ); + ter_set( point_bub_ms( i, 0 ), tw_type ); + furn_set( point_bub_ms( i, 0 ), furn_str_id::NULL_ID() ); + i_clear( tripoint_bub_ms( i, 0, dat.zlevel() ) ); } } if( rw != 2 ) { - ter_set( point( 23, 11 ), ter_t_door_metal_c ); - ter_set( point( 23, 12 ), ter_t_door_metal_c ); + ter_set( point_bub_ms( 23, 11 ), ter_t_door_metal_c ); + ter_set( point_bub_ms( 23, 12 ), ter_t_door_metal_c ); } if( bw != 2 ) { - ter_set( point( 11, 23 ), ter_t_door_metal_c ); - ter_set( point( 12, 23 ), ter_t_door_metal_c ); + ter_set( point_bub_ms( 11, 23 ), ter_t_door_metal_c ); + ter_set( point_bub_ms( 12, 23 ), ter_t_door_metal_c ); } } @@ -6329,7 +6329,7 @@ void map::draw_lab( mapgendata &dat ) // Rotated maps cannot handle borders and have to be caught in code. // We determine if a border isn't handled by checking the east-facing // border space where the door normally is -- it should be a wall or door. - tripoint east_border( 23, 11, abs_sub.z() ); + tripoint_bub_ms east_border( 23, 11, abs_sub.z() ); if( !has_flag_ter( ter_furn_flag::TFLAG_WALL, east_border ) && !has_flag_ter( ter_furn_flag::TFLAG_DOOR, east_border ) ) { // TODO: create a ter_reset function that does ter_set, furn_set, and i_clear? @@ -6338,32 +6338,32 @@ void map::draw_lab( mapgendata &dat ) ter_str_id rw_type = tower_lab && rw == 2 ? ter_t_reinforced_glass : ter_t_concrete_wall; ter_str_id bw_type = tower_lab && bw == 2 ? ter_t_reinforced_glass : ter_t_concrete_wall; for( int i = 0; i < SEEX * 2; i++ ) { - ter_set( point( 23, i ), rw_type ); - furn_set( point( 23, i ), furn_str_id::NULL_ID() ); - i_clear( tripoint( 23, i, dat.zlevel() ) ); + ter_set( point_bub_ms( 23, i ), rw_type ); + furn_set( point_bub_ms( 23, i ), furn_str_id::NULL_ID() ); + i_clear( tripoint_bub_ms( 23, i, dat.zlevel() ) ); - ter_set( point( i, 23 ), bw_type ); - furn_set( point( i, 23 ), furn_str_id::NULL_ID() ); - i_clear( tripoint( i, 23, dat.zlevel() ) ); + ter_set( point_bub_ms( i, 23 ), bw_type ); + furn_set( point_bub_ms( i, 23 ), furn_str_id::NULL_ID() ); + i_clear( tripoint_bub_ms( i, 23, dat.zlevel() ) ); if( lw == 2 ) { - ter_set( point( 0, i ), lw_type ); - furn_set( point( 0, i ), furn_str_id::NULL_ID() ); - i_clear( tripoint( 0, i, dat.zlevel() ) ); + ter_set( point_bub_ms( 0, i ), lw_type ); + furn_set( point_bub_ms( 0, i ), furn_str_id::NULL_ID() ); + i_clear( tripoint_bub_ms( 0, i, dat.zlevel() ) ); } if( tw == 2 ) { - ter_set( point( i, 0 ), tw_type ); - furn_set( point( i, 0 ), furn_str_id::NULL_ID() ); - i_clear( tripoint( i, 0, dat.zlevel() ) ); + ter_set( point_bub_ms( i, 0 ), tw_type ); + furn_set( point_bub_ms( i, 0 ), furn_str_id::NULL_ID() ); + i_clear( tripoint_bub_ms( i, 0, dat.zlevel() ) ); } } if( rw != 2 ) { - ter_set( point( 23, 11 ), ter_t_door_metal_c ); - ter_set( point( 23, 12 ), ter_t_door_metal_c ); + ter_set( point_bub_ms( 23, 11 ), ter_t_door_metal_c ); + ter_set( point_bub_ms( 23, 12 ), ter_t_door_metal_c ); } if( bw != 2 ) { - ter_set( point( 11, 23 ), ter_t_door_metal_c ); - ter_set( point( 12, 23 ), ter_t_door_metal_c ); + ter_set( point_bub_ms( 11, 23 ), ter_t_door_metal_c ); + ter_set( point_bub_ms( 12, 23 ), ter_t_door_metal_c ); } } } else { // then no json maps for lab_finale_1level were found @@ -6768,7 +6768,7 @@ void map::place_vending( const tripoint_bub_ms &p, const item_group_id &type, bo // unless it's hidden somewhere far away from everyone's eyes (e.g. deep in the lab) if( lootable && !one_in( std::max( to_days( calendar::turn - calendar::start_of_cataclysm ), 0 ) + 4 ) ) { - bash( p.raw(), 9999 ); + bash( p, 9999 ); for( const tripoint_bub_ms &loc : points_in_radius( p, 1 ) ) { if( one_in( 4 ) ) { spawn_item( loc, "glass_shard", rng( 1, 25 ) ); diff --git a/src/monattack.cpp b/src/monattack.cpp index eb12dfa64b267..bb2cf033a050e 100644 --- a/src/monattack.cpp +++ b/src/monattack.cpp @@ -394,7 +394,7 @@ bool mattack::absorb_items( monster *z ) std::vector absorb_material = z->get_absorb_material(); std::vector no_absorb_material = z->get_no_absorb_material(); - for( item &elem : here.i_at( z->pos() ) ) { + for( item &elem : here.i_at( z->pos_bub() ) ) { bool any_materials_match = false; // there is no whitelist or blacklist so allow anything. @@ -836,9 +836,9 @@ bool mattack::shockstorm( monster *z ) bool seen = player_character.sees( *z ); map &here = get_map(); - bool can_attack = z->sees( *target ) && rl_dist( z->pos(), target->pos() ) <= 12; - std::vector path = here.find_clear_path( z->pos(), target->pos() ); - for( const tripoint &point : path ) { + bool can_attack = z->sees( *target ) && rl_dist( z->pos_bub(), target->pos_bub() ) <= 12; + std::vector path = here.find_clear_path( z->pos_bub(), target->pos_bub() ); + for( const tripoint_bub_ms &point : path ) { if( here.impassable( point ) && !( here.has_flag( ter_furn_flag::TFLAG_THIN_OBSTACLE, point ) || here.has_flag( ter_furn_flag::TFLAG_PERMEABLE, point ) ) ) { @@ -2416,15 +2416,15 @@ bool mattack::nurse_check_up( monster *z ) { bool found_target = false; Character *target = nullptr; - tripoint tmp_pos( z->pos() + point( 12, 12 ) ); + tripoint_bub_ms tmp_pos( z->pos_bub() + point( 12, 12 ) ); map &here = get_map(); for( Creature *critter : here.get_creatures_in_radius( z->pos_bub(), 6 ) ) { Character *tmp_player = dynamic_cast( critter ); if( tmp_player != nullptr && z->sees( *tmp_player ) && - here.clear_path( z->pos(), tmp_player->pos(), 10, 0, + here.clear_path( z->pos_bub(), tmp_player->pos_bub(), 10, 0, 100 ) ) { // no need to scan players we can't reach - if( rl_dist( z->pos(), tmp_player->pos() ) < rl_dist( z->pos(), tmp_pos ) ) { - tmp_pos = tmp_player->pos(); + if( rl_dist( z->pos_bub(), tmp_player->pos_bub() ) < rl_dist( z->pos_bub(), tmp_pos ) ) { + tmp_pos = tmp_player->pos_bub(); target = tmp_player; found_target = true; } @@ -2469,14 +2469,14 @@ bool mattack::nurse_assist( monster *z ) bool found_target = false; Character *target = nullptr; map &here = get_map(); - tripoint tmp_pos( z->pos() + point( 12, 12 ) ); + tripoint_bub_ms tmp_pos( z->pos_bub() + point( 12, 12 ) ); for( Creature *critter : here.get_creatures_in_radius( z->pos_bub(), 6 ) ) { Character *tmp_player = dynamic_cast( critter ); // No need to scan players we can't reach if( tmp_player != nullptr && z->sees( *tmp_player ) && - here.clear_path( z->pos(), tmp_player->pos(), 10, 0, 100 ) ) { - if( rl_dist( z->pos(), tmp_player->pos() ) < rl_dist( z->pos(), tmp_pos ) ) { - tmp_pos = tmp_player->pos(); + here.clear_path( z->pos_bub(), tmp_player->pos_bub(), 10, 0, 100 ) ) { + if( rl_dist( z->pos_bub(), tmp_player->pos_bub() ) < rl_dist( z->pos_bub(), tmp_pos ) ) { + tmp_pos = tmp_player->pos_bub(); target = tmp_player; found_target = true; } @@ -2524,15 +2524,15 @@ bool mattack::nurse_operate( monster *z ) bool found_target = false; Character *target = nullptr; map &here = get_map(); - tripoint tmp_pos( z->pos() + point( 12, 12 ) ); + tripoint_bub_ms tmp_pos( z->pos_bub() + point( 12, 12 ) ); for( Creature *critter : here.get_creatures_in_radius( z->pos_bub(), 6 ) ) { Character *tmp_player = dynamic_cast< Character *>( critter ); // No need to scan players we can't reach if( tmp_player != nullptr && z->sees( *tmp_player ) && - here.clear_path( z->pos(), tmp_player->pos(), 10, 0, 100 ) ) { + here.clear_path( z->pos_bub(), tmp_player->pos_bub(), 10, 0, 100 ) ) { if( tmp_player->has_any_bionic() ) { - if( rl_dist( z->pos(), tmp_player->pos() ) < rl_dist( z->pos(), tmp_pos ) ) { - tmp_pos = tmp_player->pos(); + if( rl_dist( z->pos_bub(), tmp_player->pos_bub() ) < rl_dist( z->pos_bub(), tmp_pos ) ) { + tmp_pos = tmp_player->pos_bub(); target = tmp_player; found_target = true; } diff --git a/src/monmove.cpp b/src/monmove.cpp index fa08507956702..25c9740f146b9 100644 --- a/src/monmove.cpp +++ b/src/monmove.cpp @@ -1130,7 +1130,7 @@ void monster::move() // This prevents non-climb/fly enemies running up walls if( candidate.z > posz() && !( via_ramp || flies() ) ) { if( !can_climb() || !here.has_floor_or_support( candidate ) ) { - if( ( !here.has_flag( ter_furn_flag::TFLAG_SWIMMABLE, pos() ) || + if( ( !here.has_flag( ter_furn_flag::TFLAG_SWIMMABLE, pos_bub() ) || !here.has_flag( ter_furn_flag::TFLAG_SWIMMABLE, candidate ) ) ) { // Can't "jump" up a whole z-level can_z_move = false; diff --git a/src/monster.cpp b/src/monster.cpp index 4acb70ed476fb..6adabdfce9522 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -3485,7 +3485,7 @@ void monster::process_effects() } } - if( !will_be_cramped_in_vehicle_tile( get_map().getglobal( pos() ) ) ) { + if( !will_be_cramped_in_vehicle_tile( get_map().getglobal( pos_bub() ) ) ) { remove_effect( effect_cramped_space ); } diff --git a/src/monster_oracle.cpp b/src/monster_oracle.cpp index 140a9dae655f8..ffdabe49e09b9 100644 --- a/src/monster_oracle.cpp +++ b/src/monster_oracle.cpp @@ -38,7 +38,7 @@ status_t monster_oracle_t::items_available( const std::string_view ) const // case 2: no whitelist specified (it is approved for everything) but a blacklist specified if( absorb_material.empty() && !no_absorb_material.empty() ) { bool found = false; - for( item &it : get_map().i_at( subject->pos() ) ) { + for( item &it : get_map().i_at( subject->pos_bub() ) ) { for( const material_type *mat_type : it.made_of_types() ) { if( !( std::find( no_absorb_material.begin(), no_absorb_material.end(), mat_type->id ) != no_absorb_material.end() ) ) { @@ -55,7 +55,7 @@ status_t monster_oracle_t::items_available( const std::string_view ) const } // Case 3: there is a whitelist but no blacklist, so only allow the whitelisted ones if( !absorb_material.empty() && no_absorb_material.empty() ) { - for( item &it : get_map().i_at( subject->pos() ) ) { + for( item &it : get_map().i_at( subject->pos_bub() ) ) { for( const material_type *mat_type : it.made_of_types() ) { if( std::find( absorb_material.begin(), absorb_material.end(), mat_type->id ) != absorb_material.end() ) { diff --git a/src/npc.cpp b/src/npc.cpp index 8edff225d2611..8b10cc589aabf 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -1627,7 +1627,7 @@ float npc::vehicle_danger( int radius ) const const wrapped_vehicle &wrapped_veh = vehicles[i]; if( wrapped_veh.v->is_moving() ) { const auto &points_to_check = wrapped_veh.v->immediate_path(); - point p( get_map().getglobal( pos() ).x(), get_map().getglobal( pos() ).y() ); + point p( get_map().getglobal( pos_bub() ).xy().raw() ); if( points_to_check.find( p ) != points_to_check.end() ) { danger = i; } diff --git a/src/npcmove.cpp b/src/npcmove.cpp index df8f43982f2fe..74723e433e850 100644 --- a/src/npcmove.cpp +++ b/src/npcmove.cpp @@ -3276,7 +3276,7 @@ void npc::worker_downtime() map &here = get_map(); creature_tracker &creatures = get_creature_tracker(); // are we already in a chair - if( here.has_flag_furn( ter_furn_flag::TFLAG_CAN_SIT, pos() ) ) { + if( here.has_flag_furn( ter_furn_flag::TFLAG_CAN_SIT, pos_bub() ) ) { // just chill here move_pause(); return; diff --git a/src/overmap_ui.cpp b/src/overmap_ui.cpp index ece1caa7d25cf..8b952fcbf1ce1 100644 --- a/src/overmap_ui.cpp +++ b/src/overmap_ui.cpp @@ -1768,7 +1768,7 @@ static std::vector get_overmap_path_to( const tripoint_abs_omt params = overmap_path_params::for_player(); const oter_id dest_ter = overmap_buffer.ter_existing( dest ); // already in water or going to a water tile - if( here.has_flag( ter_furn_flag::TFLAG_SWIMMABLE, player_character.pos() ) || + if( here.has_flag( ter_furn_flag::TFLAG_SWIMMABLE, player_character.pos_bub() ) || is_water_body( dest_ter ) ) { params.set_cost( oter_travel_cost_type::water, 100 ); } diff --git a/src/talker_item.cpp b/src/talker_item.cpp index 96d48d1751230..810dcbca57764 100644 --- a/src/talker_item.cpp +++ b/src/talker_item.cpp @@ -52,7 +52,7 @@ tripoint talker_item_const::pos() const tripoint_abs_ms talker_item_const::global_pos() const { - return get_map().getglobal( me_it_const->position() ); + return get_map().getglobal( me_it_const->pos_bub() ); } tripoint_abs_omt talker_item_const::global_omt_location() const diff --git a/src/vehicle_move.cpp b/src/vehicle_move.cpp index d3acf88624c84..17fceb77f2f0b 100644 --- a/src/vehicle_move.cpp +++ b/src/vehicle_move.cpp @@ -1340,7 +1340,7 @@ bool vehicle::check_is_heli_landed() // @TODO - when there are chasms that extend below z-level 0 - perhaps the heli // will be able to descend into them but for now, assume z-level-0 == the ground. if( global_pos3().z == 0 || - !get_map().has_flag_ter_or_furn( ter_furn_flag::TFLAG_NO_FLOOR, global_pos3() ) ) { + !get_map().has_flag_ter_or_furn( ter_furn_flag::TFLAG_NO_FLOOR, pos_bub() ) ) { is_flying = false; return true; } diff --git a/src/vehicle_use.cpp b/src/vehicle_use.cpp index 562743f287b4e..c339f44a90ddd 100644 --- a/src/vehicle_use.cpp +++ b/src/vehicle_use.cpp @@ -960,15 +960,15 @@ void vehicle::crash_terrain_around() } map &here = get_map(); for( const vpart_reference &vp : get_enabled_parts( "CRASH_TERRAIN_AROUND" ) ) { - tripoint crush_target( 0, 0, -OVERMAP_LAYERS ); - const tripoint start_pos = vp.pos(); + tripoint_bub_ms crush_target( 0, 0, -OVERMAP_LAYERS ); + const tripoint_bub_ms start_pos = vp.pos_bub(); const vpslot_terrain_transform &ttd = *vp.info().transform_terrain_info; for( size_t i = 0; i < eight_horizontal_neighbors.size() && - crush_target.z == -OVERMAP_LAYERS; i++ ) { - tripoint cur_pos = start_pos + eight_horizontal_neighbors[i]; + crush_target.z() == -OVERMAP_LAYERS; i++ ) { + tripoint_bub_ms cur_pos = start_pos + eight_horizontal_neighbors[i]; bool busy_pos = false; for( const vpart_reference &vp_tmp : get_all_parts() ) { - busy_pos |= vp_tmp.pos() == cur_pos; + busy_pos |= vp_tmp.pos_bub() == cur_pos; } for( const std::string &flag : ttd.pre_flags ) { if( here.has_flag( flag, cur_pos ) && !busy_pos ) { @@ -978,7 +978,7 @@ void vehicle::crash_terrain_around() } } //target chosen - if( crush_target.z != -OVERMAP_LAYERS ) { + if( crush_target.z() != -OVERMAP_LAYERS ) { velocity = 0; cruise_velocity = 0; here.destroy( crush_target ); diff --git a/tests/active_item_cache_test.cpp b/tests/active_item_cache_test.cpp index cafcf7d5ab2b9..e7e4a3ead9c6a 100644 --- a/tests/active_item_cache_test.cpp +++ b/tests/active_item_cache_test.cpp @@ -21,7 +21,7 @@ TEST_CASE( "place_active_item_at_various_coordinates", "[item]" ) int z = 0; for( int x = 0; x < MAPSIZE_X; ++x ) { for( int y = 0; y < MAPSIZE_Y; ++y ) { - REQUIRE( here.i_at( tripoint{ x, y, z } ).empty() ); + REQUIRE( here.i_at( tripoint_bub_ms{ x, y, z } ).empty() ); CAPTURE( x, y, z ); tripoint_abs_sm abs_loc = here.get_abs_sub() + tripoint( x / SEEX, y / SEEY, z ); CAPTURE( abs_loc ); @@ -34,7 +34,7 @@ TEST_CASE( "place_active_item_at_various_coordinates", "[item]" ) REQUIRE_FALSE( here.get_submaps_with_active_items().empty() ); REQUIRE( here.get_submaps_with_active_items().find( abs_loc ) != here.get_submaps_with_active_items().end() ); - REQUIRE_FALSE( here.i_at( tripoint{ x, y, z } ).empty() ); + REQUIRE_FALSE( here.i_at( tripoint_bub_ms{ x, y, z } ).empty() ); here.i_clear( tripoint_bub_ms{ x, y, z } ); here.process_items(); } diff --git a/tests/clzones_test.cpp b/tests/clzones_test.cpp index 2cc37be376a00..e5846d08a2f90 100644 --- a/tests/clzones_test.cpp +++ b/tests/clzones_test.cpp @@ -5,6 +5,7 @@ #include "avatar.h" #include "cata_catch.h" #include "clzones.h" +#include "coordinate_constants.h" #include "item.h" #include "item_category.h" #include "map_helpers.h" @@ -73,12 +74,12 @@ TEST_CASE( "zone_unloading_ammo_belts", "[zones][items][ammo_belt][activities][u clear_avatar(); clear_map(); - tripoint_abs_ms const start = here.getglobal( tripoint_east ); + tripoint_abs_ms const start = here.getglobal( tripoint_bub_ms_zero + tripoint_east ); bool const move_act = GENERATE( true, false ); dummy.set_location( start ); if( in_vehicle ) { - REQUIRE( here.add_vehicle( vehicle_prototype_shopping_cart, tripoint_bub_ms( tripoint_east ), + REQUIRE( here.add_vehicle( vehicle_prototype_shopping_cart, tripoint_bub_ms_zero + tripoint_east, 0_degrees, 0, 0 ) ); vp = here.veh_at( start ).cargo(); REQUIRE( vp ); diff --git a/tests/crafting_test.cpp b/tests/crafting_test.cpp index 735e11c8f0f56..db4ac8bfc1520 100644 --- a/tests/crafting_test.cpp +++ b/tests/crafting_test.cpp @@ -1417,7 +1417,7 @@ static void clear_and_setup( Character &c, map &m, item &tool ) c.get_learned_recipes(); // cache auto-learned recipes c.set_skill_level( skill_fabrication, 10 ); c.wield( tool ); - m.i_clear( c.pos() ); + m.i_clear( c.pos_bub() ); } TEST_CASE( "prompt_for_liquid_containers_-_crafting_1_makeshift_funnel", "[crafting]" ) @@ -1433,14 +1433,14 @@ TEST_CASE( "prompt_for_liquid_containers_-_crafting_1_makeshift_funnel", "[craft REQUIRE( plastic_bottle.empty_container() ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.i_add_or_drop( plastic_bottle, 3 ); THEN( "no prompt" ) { craft_command cmd( &*recipe_makeshift_funnel, 1, false, &c, c.pos() ); cmd.execute( true ); item_filter filter = recipe_makeshift_funnel->get_component_filter(); CHECK( cmd.continue_prompt_liquids( filter, true ) == true ); - const map_stack &items = m.i_at( c.pos() ); + const map_stack &items = m.i_at( c.pos_bub() ); CHECK( items.size() == 3 ); auto iter = items.begin(); CHECK( iter->typeId() == plastic_bottle.typeId() ); @@ -1457,7 +1457,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_crafting_1_makeshift_funnel", "[craft REQUIRE( plastic_bottle.empty_container() ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.worn.wear_item( c, backpack, false, false ); c.i_add( plastic_bottle ); c.i_add( plastic_bottle ); @@ -1467,7 +1467,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_crafting_1_makeshift_funnel", "[craft cmd.execute( true ); item_filter filter = recipe_makeshift_funnel->get_component_filter(); CHECK( cmd.continue_prompt_liquids( filter, true ) == true ); - CHECK( m.i_at( c.pos() ).empty() ); + CHECK( m.i_at( c.pos_bub() ).empty() ); CHECK( c.crafting_inventory().count_item( plastic_bottle.typeId() ) == 3 ); } } @@ -1480,16 +1480,16 @@ TEST_CASE( "prompt_for_liquid_containers_-_crafting_1_makeshift_funnel", "[craft REQUIRE( !plastic_bottle.empty_container() ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.i_add_or_drop( plastic_bottle, 3 ); - REQUIRE( !m.i_at( c.pos() ).begin()->empty_container() ); + REQUIRE( !m.i_at( c.pos_bub() ).begin()->empty_container() ); THEN( "player is prompted" ) { REQUIRE( c.crafting_inventory().count_item( plastic_bottle.typeId() ) == 3 ); craft_command cmd( &*recipe_makeshift_funnel, 1, false, &c, c.pos() ); cmd.execute( true ); item_filter filter = recipe_makeshift_funnel->get_component_filter(); CHECK( cmd.continue_prompt_liquids( filter, true ) == false ); - const map_stack &items = m.i_at( c.pos() ); + const map_stack &items = m.i_at( c.pos_bub() ); CHECK( items.size() == 3 ); auto iter = items.begin(); CHECK( iter->typeId() == plastic_bottle.typeId() ); @@ -1508,7 +1508,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_crafting_1_makeshift_funnel", "[craft REQUIRE( !plastic_bottle.empty_container() ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.worn.wear_item( c, backpack, false, false ); c.i_add( plastic_bottle ); c.i_add( plastic_bottle ); @@ -1519,7 +1519,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_crafting_1_makeshift_funnel", "[craft cmd.execute( true ); item_filter filter = recipe_makeshift_funnel->get_component_filter(); CHECK( cmd.continue_prompt_liquids( filter, true ) == false ); - CHECK( m.i_at( c.pos() ).empty() ); + CHECK( m.i_at( c.pos_bub() ).empty() ); CHECK( c.crafting_inventory().count_item( plastic_bottle.typeId() ) == 3 ); } } @@ -1534,17 +1534,17 @@ TEST_CASE( "prompt_for_liquid_containers_-_crafting_1_makeshift_funnel", "[craft REQUIRE( !full_plastic_bottle.empty_container() ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.i_add_or_drop( empty_plastic_bottle, 3 ); c.i_add_or_drop( full_plastic_bottle, 3 ); - REQUIRE( m.i_at( c.pos() ).size() == 6 ); + REQUIRE( m.i_at( c.pos_bub() ).size() == 6 ); THEN( "no prompt" ) { REQUIRE( c.crafting_inventory().count_item( empty_plastic_bottle.typeId() ) == 6 ); craft_command cmd( &*recipe_makeshift_funnel, 1, false, &c, c.pos() ); cmd.execute( true ); item_filter filter = recipe_makeshift_funnel->get_component_filter(); CHECK( cmd.continue_prompt_liquids( filter, true ) == true ); - CHECK( m.i_at( c.pos() ).size() == 6 ); + CHECK( m.i_at( c.pos_bub() ).size() == 6 ); } } @@ -1558,7 +1558,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_crafting_1_makeshift_funnel", "[craft REQUIRE( !full_plastic_bottle.empty_container() ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.worn.wear_item( c, backpack, false, false ); c.i_add( empty_plastic_bottle ); c.i_add( empty_plastic_bottle ); @@ -1566,7 +1566,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_crafting_1_makeshift_funnel", "[craft c.i_add( full_plastic_bottle ); c.i_add( full_plastic_bottle ); c.i_add( full_plastic_bottle ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); REQUIRE( c.worn.front().all_items_top().size() == 6 ); THEN( "no prompt" ) { REQUIRE( c.crafting_inventory().count_item( empty_plastic_bottle.typeId() ) == 6 ); @@ -1574,7 +1574,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_crafting_1_makeshift_funnel", "[craft cmd.execute( true ); item_filter filter = recipe_makeshift_funnel->get_component_filter(); CHECK( cmd.continue_prompt_liquids( filter, true ) == true ); - CHECK( m.i_at( c.pos() ).empty() ); + CHECK( m.i_at( c.pos_bub() ).empty() ); CHECK( c.worn.front().all_items_top().size() == 6 ); } } @@ -1589,17 +1589,17 @@ TEST_CASE( "prompt_for_liquid_containers_-_crafting_1_makeshift_funnel", "[craft REQUIRE( !full_plastic_bottle.empty_container() ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.i_add_or_drop( empty_plastic_bottle, 2 ); c.i_add_or_drop( full_plastic_bottle, 3 ); - REQUIRE( m.i_at( c.pos() ).size() == 5 ); + REQUIRE( m.i_at( c.pos_bub() ).size() == 5 ); THEN( "player is prompted" ) { REQUIRE( c.crafting_inventory().count_item( empty_plastic_bottle.typeId() ) == 5 ); craft_command cmd( &*recipe_makeshift_funnel, 1, false, &c, c.pos() ); cmd.execute( true ); item_filter filter = recipe_makeshift_funnel->get_component_filter(); CHECK( cmd.continue_prompt_liquids( filter, true ) == false ); - CHECK( m.i_at( c.pos() ).size() == 5 ); + CHECK( m.i_at( c.pos_bub() ).size() == 5 ); } } @@ -1613,14 +1613,14 @@ TEST_CASE( "prompt_for_liquid_containers_-_crafting_1_makeshift_funnel", "[craft REQUIRE( !full_plastic_bottle.empty_container() ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.worn.wear_item( c, backpack, false, false ); c.i_add( empty_plastic_bottle ); c.i_add( empty_plastic_bottle ); c.i_add( full_plastic_bottle ); c.i_add( full_plastic_bottle ); c.i_add( full_plastic_bottle ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); REQUIRE( c.worn.front().all_items_top().size() == 5 ); THEN( "player is prompted" ) { REQUIRE( c.crafting_inventory().count_item( empty_plastic_bottle.typeId() ) == 5 ); @@ -1628,7 +1628,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_crafting_1_makeshift_funnel", "[craft cmd.execute( true ); item_filter filter = recipe_makeshift_funnel->get_component_filter(); CHECK( cmd.continue_prompt_liquids( filter, true ) == false ); - CHECK( m.i_at( c.pos() ).empty() ); + CHECK( m.i_at( c.pos_bub() ).empty() ); CHECK( c.worn.front().all_items_top().size() == 5 ); } } @@ -1648,14 +1648,14 @@ TEST_CASE( "prompt_for_liquid_containers_-_batch_crafting_3_makeshift_funnels", REQUIRE( plastic_bottle.empty_container() ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.i_add_or_drop( plastic_bottle, 10 ); THEN( "no prompt" ) { craft_command cmd( &*recipe_makeshift_funnel, 3, false, &c, c.pos() ); cmd.execute( true ); item_filter filter = recipe_makeshift_funnel->get_component_filter(); CHECK( cmd.continue_prompt_liquids( filter, true ) == true ); - CHECK( m.i_at( c.pos() ).size() == 10 ); + CHECK( m.i_at( c.pos_bub() ).size() == 10 ); } } @@ -1665,7 +1665,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_batch_crafting_3_makeshift_funnels", REQUIRE( plastic_bottle.empty_container() ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.worn.wear_item( c, backpack, false, false ); c.i_add( plastic_bottle ); c.i_add( plastic_bottle ); @@ -1682,7 +1682,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_batch_crafting_3_makeshift_funnels", cmd.execute( true ); item_filter filter = recipe_makeshift_funnel->get_component_filter(); CHECK( cmd.continue_prompt_liquids( filter, true ) == true ); - CHECK( m.i_at( c.pos() ).empty() ); + CHECK( m.i_at( c.pos_bub() ).empty() ); CHECK( c.crafting_inventory().count_item( plastic_bottle.typeId() ) == 10 ); } } @@ -1695,16 +1695,16 @@ TEST_CASE( "prompt_for_liquid_containers_-_batch_crafting_3_makeshift_funnels", REQUIRE( !plastic_bottle.empty_container() ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.i_add_or_drop( plastic_bottle, 10 ); - REQUIRE( !m.i_at( c.pos() ).begin()->empty_container() ); + REQUIRE( !m.i_at( c.pos_bub() ).begin()->empty_container() ); THEN( "player is prompted" ) { REQUIRE( c.crafting_inventory().count_item( plastic_bottle.typeId() ) == 10 ); craft_command cmd( &*recipe_makeshift_funnel, 3, false, &c, c.pos() ); cmd.execute( true ); item_filter filter = recipe_makeshift_funnel->get_component_filter(); CHECK( cmd.continue_prompt_liquids( filter, true ) == false ); - CHECK( m.i_at( c.pos() ).size() == 10 ); + CHECK( m.i_at( c.pos_bub() ).size() == 10 ); } } @@ -1716,7 +1716,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_batch_crafting_3_makeshift_funnels", REQUIRE( !plastic_bottle.empty_container() ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.worn.wear_item( c, backpack, false, false ); c.i_add( plastic_bottle ); c.i_add( plastic_bottle ); @@ -1734,7 +1734,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_batch_crafting_3_makeshift_funnels", cmd.execute( true ); item_filter filter = recipe_makeshift_funnel->get_component_filter(); CHECK( cmd.continue_prompt_liquids( filter, true ) == false ); - CHECK( m.i_at( c.pos() ).empty() ); + CHECK( m.i_at( c.pos_bub() ).empty() ); CHECK( c.crafting_inventory().count_item( plastic_bottle.typeId() ) == 10 ); } } @@ -1749,17 +1749,17 @@ TEST_CASE( "prompt_for_liquid_containers_-_batch_crafting_3_makeshift_funnels", REQUIRE( !full_plastic_bottle.empty_container() ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.i_add_or_drop( empty_plastic_bottle, 10 ); c.i_add_or_drop( full_plastic_bottle, 3 ); - REQUIRE( m.i_at( c.pos() ).size() == 13 ); + REQUIRE( m.i_at( c.pos_bub() ).size() == 13 ); THEN( "no prompt" ) { REQUIRE( c.crafting_inventory().count_item( empty_plastic_bottle.typeId() ) == 13 ); craft_command cmd( &*recipe_makeshift_funnel, 3, false, &c, c.pos() ); cmd.execute( true ); item_filter filter = recipe_makeshift_funnel->get_component_filter(); CHECK( cmd.continue_prompt_liquids( filter, true ) == true ); - CHECK( m.i_at( c.pos() ).size() == 13 ); + CHECK( m.i_at( c.pos_bub() ).size() == 13 ); } } @@ -1773,7 +1773,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_batch_crafting_3_makeshift_funnels", REQUIRE( !full_plastic_bottle.empty_container() ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.worn.wear_item( c, backpack, false, false ); c.i_add( empty_plastic_bottle ); c.i_add( empty_plastic_bottle ); @@ -1788,7 +1788,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_batch_crafting_3_makeshift_funnels", c.i_add( full_plastic_bottle ); c.i_add( full_plastic_bottle ); c.i_add( full_plastic_bottle ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); REQUIRE( c.worn.front().all_items_top().size() == 13 ); THEN( "no prompt" ) { REQUIRE( c.crafting_inventory().count_item( empty_plastic_bottle.typeId() ) == 13 ); @@ -1796,7 +1796,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_batch_crafting_3_makeshift_funnels", cmd.execute( true ); item_filter filter = recipe_makeshift_funnel->get_component_filter(); CHECK( cmd.continue_prompt_liquids( filter, true ) == true ); - CHECK( m.i_at( c.pos() ).empty() ); + CHECK( m.i_at( c.pos_bub() ).empty() ); CHECK( c.worn.front().all_items_top().size() == 13 ); } } @@ -1811,17 +1811,17 @@ TEST_CASE( "prompt_for_liquid_containers_-_batch_crafting_3_makeshift_funnels", REQUIRE( !full_plastic_bottle.empty_container() ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.i_add_or_drop( empty_plastic_bottle, 7 ); c.i_add_or_drop( full_plastic_bottle, 3 ); - REQUIRE( m.i_at( c.pos() ).size() == 10 ); + REQUIRE( m.i_at( c.pos_bub() ).size() == 10 ); THEN( "player is prompted" ) { REQUIRE( c.crafting_inventory().count_item( empty_plastic_bottle.typeId() ) == 10 ); craft_command cmd( &*recipe_makeshift_funnel, 3, false, &c, c.pos() ); cmd.execute( true ); item_filter filter = recipe_makeshift_funnel->get_component_filter(); CHECK( cmd.continue_prompt_liquids( filter, true ) == false ); - CHECK( m.i_at( c.pos() ).size() == 10 ); + CHECK( m.i_at( c.pos_bub() ).size() == 10 ); } } @@ -1835,7 +1835,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_batch_crafting_3_makeshift_funnels", REQUIRE( !full_plastic_bottle.empty_container() ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.worn.wear_item( c, backpack, false, false ); c.i_add( empty_plastic_bottle ); c.i_add( empty_plastic_bottle ); @@ -1847,7 +1847,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_batch_crafting_3_makeshift_funnels", c.i_add( full_plastic_bottle ); c.i_add( full_plastic_bottle ); c.i_add( full_plastic_bottle ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); REQUIRE( c.worn.front().all_items_top().size() == 10 ); THEN( "player is prompted" ) { REQUIRE( c.crafting_inventory().count_item( empty_plastic_bottle.typeId() ) == 10 ); @@ -1855,7 +1855,7 @@ TEST_CASE( "prompt_for_liquid_containers_-_batch_crafting_3_makeshift_funnels", cmd.execute( true ); item_filter filter = recipe_makeshift_funnel->get_component_filter(); CHECK( cmd.continue_prompt_liquids( filter, true ) == false ); - CHECK( m.i_at( c.pos() ).empty() ); + CHECK( m.i_at( c.pos_bub() ).empty() ); CHECK( c.worn.front().all_items_top().size() == 10 ); } } @@ -1893,9 +1893,9 @@ TEST_CASE( "Warn_when_using_favorited_component", "[crafting]" ) item plastic_bottle( "bottle_plastic" ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.i_add_or_drop( plastic_bottle, 3 ); - map_stack items = m.i_at( c.pos() ); + map_stack items = m.i_at( c.pos_bub() ); REQUIRE( !items.empty() ); REQUIRE( !items.begin()->is_favorite ); THEN( "no warning" ) { @@ -1908,9 +1908,9 @@ TEST_CASE( "Warn_when_using_favorited_component", "[crafting]" ) plastic_bottle.is_favorite = true; Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.i_add_or_drop( plastic_bottle, 3 ); - map_stack items = m.i_at( c.pos() ); + map_stack items = m.i_at( c.pos_bub() ); REQUIRE( !items.empty() ); REQUIRE( items.begin()->is_favorite ); THEN( "warning" ) { @@ -1922,9 +1922,9 @@ TEST_CASE( "Warn_when_using_favorited_component", "[crafting]" ) item plastic_bottle( "bottle_plastic" ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.i_add_or_drop( plastic_bottle, 3 ); - map_stack items = m.i_at( c.pos() ); + map_stack items = m.i_at( c.pos_bub() ); REQUIRE( !items.empty() ); items.begin()->is_favorite = true; REQUIRE( items.begin()->is_favorite ); @@ -1937,9 +1937,9 @@ TEST_CASE( "Warn_when_using_favorited_component", "[crafting]" ) item plastic_bottle( "bottle_plastic" ); Character &c = get_player_character(); clear_and_setup( c, m, pocketknife ); - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.i_add_or_drop( plastic_bottle, 4 ); - map_stack items = m.i_at( c.pos() ); + map_stack items = m.i_at( c.pos_bub() ); REQUIRE( !items.empty() ); items.begin()->is_favorite = true; REQUIRE( items.begin()->is_favorite ); @@ -2072,7 +2072,7 @@ TEST_CASE( "tools_with_charges_as_components", "[crafting]" ) c.set_skill_level( skill_survival, 10 ); GIVEN( "sewing kit with thread on the ground" ) { - REQUIRE( m.i_at( c.pos() ).empty() ); + REQUIRE( m.i_at( c.pos_bub() ).empty() ); c.i_add_or_drop( sew_kit ); c.i_add_or_drop( thread ); c.i_add_or_drop( sheet_cotton, cotton_sheets_in_recipe ); @@ -2089,7 +2089,7 @@ TEST_CASE( "tools_with_charges_as_components", "[crafting]" ) int cotton_sheets = 0; int threads = 0; int threads_in_tool = 0; - for( const item &i : m.i_at( c.pos() ) ) { + for( const item &i : m.i_at( c.pos_bub() ) ) { if( i.typeId() == itype_sheet_cotton ) { cotton_sheets += i.count_by_charges() ? i.charges : 1; } else if( i.typeId() == itype_thread ) { diff --git a/tests/faction_camp_test.cpp b/tests/faction_camp_test.cpp index f599282193d2f..c3c8b6416aabe 100644 --- a/tests/faction_camp_test.cpp +++ b/tests/faction_camp_test.cpp @@ -25,7 +25,7 @@ TEST_CASE( "camp_calorie_counting", "[camp]" ) clear_avatar(); clear_map(); map &m = get_map(); - const tripoint_abs_ms zone_loc = m.getglobal( tripoint{ 5, 5, 0 } ); + const tripoint_abs_ms zone_loc = m.getglobal( tripoint_bub_ms{ 5, 5, 0 } ); mapgen_place_zone( zone_loc.raw(), zone_loc.raw(), zone_type_CAMP_FOOD, your_fac, {}, "food" ); mapgen_place_zone( zone_loc.raw(), zone_loc.raw(), zone_type_CAMP_STORAGE, your_fac, {}, @@ -41,7 +41,7 @@ TEST_CASE( "camp_calorie_counting", "[camp]" ) food_supply *= 0; item test_100_kcal( "test_100_kcal" ); tripoint_bub_ms zone_local = m.bub_from_abs( zone_loc ); - m.i_clear( zone_local.raw() ); + m.i_clear( zone_local ); m.add_item_or_charges( zone_local, test_100_kcal ); REQUIRE( m.has_items( zone_local ) ); test_camp->distribute_food(); @@ -58,7 +58,7 @@ TEST_CASE( "camp_calorie_counting", "[camp]" ) // Setting the actual components. This will return 185 unless it's actually made up of two 100kcal components! test_200_kcal.components = made_of; tripoint_bub_ms zone_local = m.bub_from_abs( zone_loc ); - m.i_clear( zone_local.raw() ); + m.i_clear( zone_local ); m.add_item_or_charges( zone_local, test_200_kcal ); test_camp->distribute_food(); CHECK( food_supply.kcal() == 200 ); @@ -68,7 +68,7 @@ TEST_CASE( "camp_calorie_counting", "[camp]" ) food_supply *= 0; item test_500_kcal( "test_500_kcal" ); tripoint_bub_ms zone_local = m.bub_from_abs( zone_loc ); - m.i_clear( zone_local.raw() ); + m.i_clear( zone_local ); m.add_item_or_charges( zone_local, test_500_kcal ); test_camp->distribute_food(); REQUIRE( food_supply.kcal() == 500 ); diff --git a/tests/harvest_test.cpp b/tests/harvest_test.cpp index d7c0233cae9f9..9737475ab1e03 100644 --- a/tests/harvest_test.cpp +++ b/tests/harvest_test.cpp @@ -37,7 +37,7 @@ static void butcher_mon( const mtype_id &monid, const activity_id &actid, int *c u.set_skill_level( skill_survival, 10 ); u.wield( scalpel ); monster cow( monid, mon_pos ); - const tripoint cow_loc = cow.pos(); + const tripoint_bub_ms cow_loc = cow.pos_bub(); cow.die( nullptr ); u.move_to( cow.get_location() ); player_activity act( actid, 0, true ); diff --git a/tests/invlet_test.cpp b/tests/invlet_test.cpp index 6b2126b914374..0bc90cfc53261 100644 --- a/tests/invlet_test.cpp +++ b/tests/invlet_test.cpp @@ -236,7 +236,7 @@ static invlet_state check_invlet( Character &you, item &it, const char invlet ) static void drop_at_feet( Character &you, const std::string &id ) { - size_t size_before = get_map().i_at( you.pos() ).size(); + size_t size_before = get_map().i_at( you.pos_bub() ).size(); item *found = retrieve_item( you, id ); REQUIRE( found ); @@ -245,12 +245,12 @@ static void drop_at_feet( Character &you, const std::string &id ) you.drop( loc, you.pos() ); you.activity.do_turn( you ); - REQUIRE( get_map().i_at( you.pos() ).size() == size_before + 1 ); + REQUIRE( get_map().i_at( you.pos_bub() ).size() == size_before + 1 ); } static void pick_up_from_feet( Character &you, const std::string &id ) { - map_stack items = get_map().i_at( you.pos() ); + map_stack items = get_map().i_at( you.pos_bub() ); size_t size_before = items.size(); item *found = retrieve_item( map_cursor( you.get_location() ), id ); @@ -460,7 +460,7 @@ static void invlet_test( avatar &dummy, const inventory_location from, const inv dummy.inv->clear(); dummy.clear_worn(); dummy.remove_weapon(); - get_map().i_clear( dummy.pos() ); + get_map().i_clear( dummy.pos_bub() ); dummy.worn.wear_item( dummy, item( "backpack" ), false, false ); // some two items that can be wielded, worn, and picked up @@ -542,7 +542,7 @@ static void stack_invlet_test( avatar &dummy, inventory_location from, inventory dummy.inv->clear(); dummy.clear_worn(); dummy.remove_weapon(); - get_map().i_clear( dummy.pos() ); + get_map().i_clear( dummy.pos_bub() ); dummy.worn.wear_item( dummy, item( "backpack" ), false, false ); // some stackable item that can be wielded and worn @@ -595,7 +595,7 @@ static void swap_invlet_test( avatar &dummy, inventory_location loc ) dummy.inv->clear(); dummy.clear_worn(); dummy.remove_weapon(); - get_map().i_clear( dummy.pos() ); + get_map().i_clear( dummy.pos_bub() ); // two items of the same type that do not stack item tshirt1( "tshirt" ); @@ -680,7 +680,7 @@ static void merge_invlet_test( avatar &dummy, inventory_location from ) dummy.inv->clear(); dummy.clear_worn(); dummy.remove_weapon(); - get_map().i_clear( dummy.pos() ); + get_map().i_clear( dummy.pos_bub() ); dummy.worn.wear_item( dummy, item( "backpack" ), false, false ); // some stackable item diff --git a/tests/item_contents_test.cpp b/tests/item_contents_test.cpp index e23874815ca9a..30e5bed80e329 100644 --- a/tests/item_contents_test.cpp +++ b/tests/item_contents_test.cpp @@ -91,7 +91,7 @@ TEST_CASE( "item_contents" ) TEST_CASE( "overflow_on_combine", "[item]" ) { clear_map(); - tripoint origin{ 60, 60, 0 }; + tripoint_bub_ms origin{ 60, 60, 0 }; item purse( itype_purse ); item log( itype_log ); item_contents overfull_contents( purse.type->pockets ); @@ -101,26 +101,26 @@ TEST_CASE( "overflow_on_combine", "[item]" ) } ); map &here = get_map(); here.i_clear( origin ); - purse.overflow( origin ); + purse.overflow( origin.raw() ); CHECK( here.i_at( origin ).size() == 1 ); } TEST_CASE( "overflow_test", "[item]" ) { clear_map(); - tripoint origin{ 60, 60, 0 }; + tripoint_bub_ms origin{ 60, 60, 0 }; item purse( itype_purse ); item log( itype_log ); purse.force_insert_item( log, pocket_type::MIGRATION ); map &here = get_map(); - purse.overflow( origin ); + purse.overflow( origin.raw() ); CHECK( here.i_at( origin ).size() == 1 ); } TEST_CASE( "overflow_test_into_parent_item", "[item]" ) { clear_map(); - tripoint origin{ 60, 60, 0 }; + tripoint_bub_ms origin{ 60, 60, 0 }; item jar( itype_jar_glass_sealed ); item pickle( itype_pickle ); pickle.force_insert_item( pickle, pocket_type::MIGRATION ); @@ -131,7 +131,7 @@ TEST_CASE( "overflow_test_into_parent_item", "[item]" ) } REQUIRE( contents_pre == 1 ); - item_location jar_loc( map_cursor( tripoint_bub_ms( origin ) ), &jar ); + item_location jar_loc( map_cursor( origin ), &jar ); jar_loc.overflow(); map &here = get_map(); CHECK( here.i_at( origin ).empty() ); diff --git a/tests/item_pocket_test.cpp b/tests/item_pocket_test.cpp index f0e282b47b361..3485d66ebe8fd 100644 --- a/tests/item_pocket_test.cpp +++ b/tests/item_pocket_test.cpp @@ -2804,8 +2804,8 @@ TEST_CASE( "auto_whitelist", "[item][pocket][item_spawn]" ) SECTION( "container emptied by processing" ) { itype_id const id = spawned_w_modifier->get_contents().first_item().typeId(); - get_map().i_clear( spawned_w_custom_container.position() ); - get_map().i_clear( spawned_in_def_container.position() ); + get_map().i_clear( spawned_w_custom_container.pos_bub() ); + get_map().i_clear( spawned_in_def_container.pos_bub() ); restore_on_out_of_scope> restore_temp( get_weather().forced_temperature ); get_weather().forced_temperature = units::from_celsius( 21 ); diff --git a/tests/iuse_actor_test.cpp b/tests/iuse_actor_test.cpp index c65f9398a5c05..b1945f2286fe6 100644 --- a/tests/iuse_actor_test.cpp +++ b/tests/iuse_actor_test.cpp @@ -131,7 +131,7 @@ static void cut_up_yields( const std::string &target ) // Nominal dex to avoid yield penalty. guy.dex_cur = 12; //guy.set_skill_level( skill_id( "fabrication" ), 10 ); - here.i_at( guy.pos() ).clear(); + here.i_at( guy.pos_bub() ).clear(); CAPTURE( target ); salvage_actor test_actor; diff --git a/tests/magic_spell_effect_test.cpp b/tests/magic_spell_effect_test.cpp index d9daeaa3b2f70..bdef638395299 100644 --- a/tests/magic_spell_effect_test.cpp +++ b/tests/magic_spell_effect_test.cpp @@ -119,7 +119,7 @@ TEST_CASE( "remove_field_fd_fatigue", "[magic]" ) m.build_map_cache( 0 ); dummy.recalc_sight_limits(); - CHECK( m.getglobal( dummy.pos() ) == player_initial_pos ); + CHECK( m.getglobal( dummy.pos_bub() ) == player_initial_pos ); CHECK( count_fields_near( p1, fd_fatigue ) == std::set { p1, p2, p3, p4 } ); spell_effect::remove_field( sp, dummy, m.bub_from_abs( player_initial_pos ) ); @@ -128,7 +128,7 @@ TEST_CASE( "remove_field_fd_fatigue", "[magic]" ) calendar::turn += 1_turns; m.process_fields(); - CHECK( m.getglobal( dummy.pos() ) == player_initial_pos ); + CHECK( m.getglobal( dummy.pos_bub() ) == player_initial_pos ); CHECK( count_fields_near( p1, fd_fatigue ) == std::set { p2, p3, p4 } ); spell_effect::remove_field( sp, dummy, m.bub_from_abs( player_initial_pos ) ); @@ -137,7 +137,7 @@ TEST_CASE( "remove_field_fd_fatigue", "[magic]" ) calendar::turn += 1_turns; m.process_fields(); - CHECK( m.getglobal( dummy.pos() ) == player_initial_pos ); + CHECK( m.getglobal( dummy.pos_bub() ) == player_initial_pos ); CHECK( count_fields_near( p1, fd_fatigue ) == std::set { p3, p4 } ); spell_effect::remove_field( sp, dummy, m.bub_from_abs( player_initial_pos ) ); diff --git a/tests/map_memory_test.cpp b/tests/map_memory_test.cpp index 2fa768ff752f5..53e7d1104144b 100644 --- a/tests/map_memory_test.cpp +++ b/tests/map_memory_test.cpp @@ -8,6 +8,7 @@ #include "json.h" #include "lru_cache.h" #include "map.h" +#include "coordinate_constants.h" // Cannot be placed above map.h, because it won't compile. #include "map_memory.h" #include "point.h" @@ -204,56 +205,56 @@ TEST_CASE( "shift_map_memory_bitset_cache" ) GIVEN( "all bits are set" ) { test_cache.set(); WHEN( "positive x shift" ) { - shift_bitset_cache( test_cache, point_east ); + shift_bitset_cache( test_cache, point_rel_sm_east ); THEN( "last 12 columns are 0, rest are 1" ) { check_quadrants( test_cache, point( last_twelve, 0 ), true, false, true, false ); } } WHEN( "negative x shift" ) { - shift_bitset_cache( test_cache, point_west ); + shift_bitset_cache( test_cache, point_rel_sm_west ); THEN( "first 12 columns are 0, rest are 1" ) { check_quadrants( test_cache, point( first_twelve, 0 ), false, true, false, true ); } } WHEN( "positive y shift" ) { - shift_bitset_cache( test_cache, point_south ); + shift_bitset_cache( test_cache, point_rel_sm_south ); THEN( "last 12 rows are 0, rest are 1" ) { check_quadrants( test_cache, point( 0, last_twelve ), true, true, false, false ); } } WHEN( "negative y shift" ) { - shift_bitset_cache( test_cache, point_north ); + shift_bitset_cache( test_cache, point_rel_sm_north ); THEN( "first 12 rows are 0, rest are 1" ) { check_quadrants( test_cache, point( 0, first_twelve ), false, false, true, true ); } } WHEN( "positive x, positive y shift" ) { - shift_bitset_cache( test_cache, point_south_east ); + shift_bitset_cache( test_cache, point_rel_sm_south_east ); THEN( "last 12 columns and rows are 0, rest are 1" ) { check_quadrants( test_cache, point( last_twelve, last_twelve ), true, false, false, false ); } } WHEN( "positive x, negative y shift" ) { - shift_bitset_cache( test_cache, point_north_east ); + shift_bitset_cache( test_cache, point_rel_sm_north_east ); THEN( "last 12 columns and first 12 rows are 0, rest are 1" ) { check_quadrants( test_cache, point( last_twelve, first_twelve ), false, false, true, false ); } } WHEN( "negative x, positive y shift" ) { - shift_bitset_cache( test_cache, point_south_west ); + shift_bitset_cache( test_cache, point_rel_sm_south_west ); THEN( "first 12 columns and last 12 rows are 0, rest are 1" ) { check_quadrants( test_cache, point( first_twelve, last_twelve ), false, true, false, false ); } } WHEN( "negative x, negative y shift" ) { - shift_bitset_cache( test_cache, point_north_west ); + shift_bitset_cache( test_cache, point_rel_sm_north_west ); THEN( "first 12 columns and rows are 0, rest are 1" ) { check_quadrants( test_cache, point( first_twelve, first_twelve ), false, false, false, true ); diff --git a/tests/monster_test.cpp b/tests/monster_test.cpp index aef9c0eb2afe3..b33e3c74ae37c 100644 --- a/tests/monster_test.cpp +++ b/tests/monster_test.cpp @@ -35,7 +35,7 @@ using move_statistics = statistics; static const mtype_id mon_dog_zombie_brute( "mon_dog_zombie_brute" ); static int moves_to_destination( const std::string &monster_type, - const tripoint_bub_ms &start, const tripoint &end ) + const tripoint_bub_ms &start, const tripoint_bub_ms &end ) { clear_creatures(); REQUIRE( g->num_creatures() == 1 ); // the player @@ -131,8 +131,8 @@ static int can_catch_player( const std::string &monster_type, const tripoint &di REQUIRE( g->num_creatures() == 2 ); } const int move_cost = get_map().combined_movecost( - test_player.pos(), test_player.pos() + direction_of_flight, nullptr, 0 ); - tracker.push_back( {'p', move_cost, rl_dist( test_monster.pos(), test_player.pos() ), + test_player.pos_bub(), test_player.pos_bub() + direction_of_flight, nullptr, 0 ); + tracker.push_back( {'p', move_cost, rl_dist( test_monster.pos_bub(), test_player.pos_bub() ), test_player.pos() } ); test_player.mod_moves( -move_cost ); @@ -164,10 +164,11 @@ static int can_catch_player( const std::string &monster_type, const tripoint &di // Verify that the named monster has the expected effective speed, not reduced // due to wasted motion from shambling. -static void check_shamble_speed( const std::string &monster_type, const tripoint &destination ) +static void check_shamble_speed( const std::string &monster_type, + const tripoint_bub_ms &destination ) { // Scale the scaling factor based on the ratio of diagonal to cardinal steps. - const float slope = get_normalized_angle( point_zero, destination.xy() ); + const float slope = get_normalized_angle( point_zero, destination.xy().raw() ); const float diagonal_multiplier = 1.0 + ( get_option( "CIRCLEDIST" ) ? ( slope * 0.41 ) : 0.0 ); INFO( monster_type << " " << destination ); diff --git a/tests/player_activities_test.cpp b/tests/player_activities_test.cpp index 1238079496a43..fac111b5dacf4 100644 --- a/tests/player_activities_test.cpp +++ b/tests/player_activities_test.cpp @@ -489,7 +489,7 @@ TEST_CASE( "shearing", "[activity][shearing][animals]" ) WHEN( "shearing finishes" ) { CHECK( dummy.activity.id() == ACT_NULL ); THEN( "player receives the items" ) { - const map_stack items = get_map().i_at( dummy.pos() ); + const map_stack items = get_map().i_at( dummy.pos_bub() ); int count_amount = 0; int count_random = 0; int count_mass = 0; @@ -1842,7 +1842,7 @@ TEST_CASE( "activity_interruption_by_distractions", "[activity][interruption]" ) CHECK( dists.empty() ); THEN( "interruption by zombie moving towards dummy" ) { - zombie.set_dest( get_map().getglobal( dummy.pos() ) ); + zombie.set_dest( get_map().getglobal( dummy.pos_bub() ) ); int turns = 0; do { move_monster_turn( zombie ); diff --git a/tests/uncraft_test.cpp b/tests/uncraft_test.cpp index ce1ad89e133f0..32321952ff8ca 100644 --- a/tests/uncraft_test.cpp +++ b/tests/uncraft_test.cpp @@ -65,7 +65,7 @@ static std::map repeat_uncraft( Character &they, const itype_id & they.complete_disassemble( it_dis_loc, dis_recip ); // Count how many of each type of item are here - for( item &it : get_map().i_at( they.pos() ) ) { + for( item &it : get_map().i_at( they.pos_bub() ) ) { if( yield_items.count( it.typeId() ) == 0 ) { yield_items[it.typeId()] = it.count(); } else { diff --git a/tests/visitable_remove_test.cpp b/tests/visitable_remove_test.cpp index 796ff72e3abaf..93c3fc48f600a 100644 --- a/tests/visitable_remove_test.cpp +++ b/tests/visitable_remove_test.cpp @@ -307,7 +307,7 @@ TEST_CASE( "visitable_remove", "[visitable]" ) } GIVEN( "A player surrounded by several bottles of water" ) { - std::vector tiles = closest_points_first( p.pos(), 1 ); + std::vector tiles = closest_points_first( p.pos_bub(), 1 ); tiles.erase( tiles.begin() ); // player tile int our = 0; // bottles placed on player tile