From a9416b48e6ab18f2f611ae5eec62de6e257561bc Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Thu, 19 Dec 2024 23:50:28 +0100 Subject: [PATCH] typified character, npc and explosion stuff (#78655) --- src/animation.cpp | 9 ----- src/ballistics.cpp | 2 +- src/bionics.cpp | 7 ++-- src/character.cpp | 10 +++--- src/computer_session.cpp | 22 ++++++------ src/debug_menu.cpp | 10 +++--- src/explosion.cpp | 69 +++++++++++++++++++------------------- src/explosion.h | 16 ++++----- src/game.cpp | 6 ++-- src/iexamine.cpp | 4 +-- src/item.cpp | 4 +-- src/iuse.cpp | 14 ++++---- src/iuse_actor.cpp | 8 ++--- src/magic_spell_effect.cpp | 4 +-- src/map.cpp | 2 +- src/monster.cpp | 4 +-- src/npc.cpp | 7 ++-- src/npcmove.cpp | 25 +++++++------- src/npctalk.cpp | 13 ++++--- src/npctalk_funcs.cpp | 14 ++++---- src/npctrade_utils.cpp | 4 +-- src/projectile.cpp | 6 ++-- src/ranged.cpp | 2 +- src/teleport.cpp | 2 +- src/trapfunc.cpp | 6 ++-- src/turret.cpp | 8 ++--- src/ui.cpp | 13 +++---- src/ui.h | 2 +- src/vehicle.cpp | 2 +- src/vehicle_move.cpp | 2 +- 30 files changed, 142 insertions(+), 155 deletions(-) diff --git a/src/animation.cpp b/src/animation.cpp index 08095d3789e85..5502cf62a6256 100644 --- a/src/animation.cpp +++ b/src/animation.cpp @@ -302,20 +302,11 @@ void explosion_handler::draw_explosion( const tripoint_bub_ms &p, const int r, c } } -void explosion_handler::draw_explosion( const tripoint &p, const int r, const nc_color &col ) -{ - explosion_handler::draw_explosion( tripoint_bub_ms( p ), r, col ); -} #else void explosion_handler::draw_explosion( const tripoint_bub_ms &p, const int r, const nc_color &col ) { draw_explosion_curses( *g, p, r, col ); } - -void explosion_handler::draw_explosion( const tripoint &p, const int r, const nc_color &col ) -{ - draw_explosion_curses( *g, tripoint_bub_ms( p ), r, col ); -} #endif void explosion_handler::draw_custom_explosion( diff --git a/src/ballistics.cpp b/src/ballistics.cpp index 46c87d0f39b80..7ce0cc8db010d 100644 --- a/src/ballistics.cpp +++ b/src/ballistics.cpp @@ -527,7 +527,7 @@ dealt_projectile_attack projectile_attack( const projectile &proj_arg, apply_ammo_effects( null_source ? nullptr : origin, tp, proj.proj_effects, dealt_damage ); const explosion_data &expl = proj.get_custom_explosion(); if( expl.power > 0.0f ) { - explosion_handler::explosion( null_source ? nullptr : origin, tp.raw(), + explosion_handler::explosion( null_source ? nullptr : origin, tp, proj.get_custom_explosion() ); } diff --git a/src/bionics.cpp b/src/bionics.cpp index 181f28d4088af..2c3192831c2bf 100644 --- a/src/bionics.cpp +++ b/src/bionics.cpp @@ -953,7 +953,8 @@ bool Character::activate_bionic( bionic &bio, bool eff_only, bool *close_bionics set_rad( 0 ); } } else if( bio.id == bio_emp ) { - if( const std::optional pnt = choose_adjacent( _( "Create an EMP where?" ) ) ) { + if( const std::optional pnt = choose_adjacent_bub( + _( "Create an EMP where?" ) ) ) { add_msg_activate(); explosion_handler::emp_blast( *pnt ); mod_moves( -100 ); @@ -1049,11 +1050,11 @@ bool Character::activate_bionic( bionic &bio, bool eff_only, bool *close_bionics } } else if( bio.id == bio_flashbang ) { add_msg_activate(); - explosion_handler::flashbang( pos(), true ); + explosion_handler::flashbang( pos_bub(), true ); mod_moves( -100 ); } else if( bio.id == bio_shockwave ) { add_msg_activate(); - explosion_handler::shockwave( pos(), 3, 4, 2, 8, true ); + explosion_handler::shockwave( pos_bub(), 3, 4, 2, 8, true ); add_msg_if_player( m_neutral, _( "You unleash a powerful shockwave!" ) ); mod_moves( -100 ); } else if( bio.id == bio_meteorologist ) { diff --git a/src/character.cpp b/src/character.cpp index df3afb07a74c2..67449ecf2a7e9 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -1101,14 +1101,14 @@ double Character::aim_factor_from_volume( const item &gun ) const return std::max( factor, 0.2 ) ; } -static bool is_obstacle( tripoint pos ) +static bool is_obstacle( tripoint_bub_ms pos ) { return get_map().coverage( pos ) >= 50; } double Character::aim_factor_from_length( const item &gun ) const { - tripoint cur_pos = pos(); + tripoint_bub_ms cur_pos = pos_bub(); bool nw_to_se = is_obstacle( cur_pos + tripoint::south_east ) && is_obstacle( cur_pos + tripoint::north_west ); bool w_to_e = is_obstacle( cur_pos + tripoint::west ) && @@ -10474,7 +10474,7 @@ void Character::echo_pulse() sounds::sound( origin, 5, sounds::sound_t::sensory, _( "clack." ), true, "none", "none" ); // This only counts obstacles which can be moved through, so the echo is pretty quiet. - } else if( is_obstacle( origin.raw() ) && here.sees( pos_bub(), origin, pulse_range, false ) ) { + } else if( is_obstacle( origin ) && here.sees( pos_bub(), origin, pulse_range, false ) ) { sounds::sound( origin, 1, sounds::sound_t::sensory, _( "click." ), true, "none", "none" ); } @@ -11433,12 +11433,10 @@ bool Character::defer_move( const tripoint_bub_ms &next ) return false; } // next must be adjacent to subsequent move in any preexisting automove route - // TODO: fix point types if( has_destination() && square_dist( auto_move_route.front(), next ) != 1 ) { return false; } - // TODO: fix point types - auto_move_route.insert( auto_move_route.begin(), tripoint_bub_ms( next ) ); + auto_move_route.insert( auto_move_route.begin(), next ); next_expected_position = pos_bub(); return true; } diff --git a/src/computer_session.cpp b/src/computer_session.cpp index ebb00504d406e..fc8122ec59061 100644 --- a/src/computer_session.cpp +++ b/src/computer_session.cpp @@ -626,13 +626,13 @@ void computer_session::action_cascade() get_event_bus().send(); tripoint_bub_ms player_pos = get_player_character().pos_bub(); map &here = get_map(); - std::vector cascade_points; + std::vector cascade_points; for( const tripoint_bub_ms &dest : here.points_in_radius( player_pos, 10 ) ) { if( here.ter( dest ) == ter_t_radio_tower ) { - cascade_points.push_back( dest.raw() ); + cascade_points.push_back( dest ); } } - explosion_handler::resonance_cascade( random_entry( cascade_points, player_pos.raw() ) ); + explosion_handler::resonance_cascade( random_entry( cascade_points, player_pos ) ); } void computer_session::action_research() @@ -771,7 +771,7 @@ void computer_session::action_miss_launch() } //Only explode once. But make it large. - explosion_handler::explosion( &get_player_character(), nuke_location.raw(), 2000, 0.7, true ); + explosion_handler::explosion( &get_player_character(), nuke_location, 2000, 0.7, true ); //...ERASE MISSILE, OPEN SILO, DISABLE COMPUTER // For each level between here and the surface, remove the missile @@ -1234,13 +1234,13 @@ void computer_session::action_srcf_seal() const ter_id &t = here.ter( p ); if( t == ter_t_elevator || t == ter_t_vat ) { here.make_rubble( p, furn_f_rubble_rock, true ); - explosion_handler::explosion( &get_player_character(), p.raw(), 40, 0.7, true ); + explosion_handler::explosion( &get_player_character(), p, 40, 0.7, true ); } else if( t == ter_t_wall_glass || t == ter_t_sewage_pipe || t == ter_t_sewage || t == ter_t_grate ) { here.make_rubble( p, furn_f_rubble_rock, true ); } else if( t == ter_t_sewage_pump ) { here.make_rubble( p, furn_f_rubble_rock, true ); - explosion_handler::explosion( &get_player_character(), p.raw(), 50, 0.7, true ); + explosion_handler::explosion( &get_player_character(), p, 50, 0.7, true ); } } comp.options.clear(); // Disable the terminal. @@ -1340,7 +1340,7 @@ void computer_session::action_irradiator() // critical failure - radiation spike sets off electronic detonators if( it->typeId() == itype_mininuke || it->typeId() == itype_mininuke_act || it->typeId() == itype_c4 ) { - explosion_handler::explosion( &get_player_character(), dest.raw(), 40 ); + explosion_handler::explosion( &get_player_character(), dest, 40 ); reset_terminal(); print_error( _( "WARNING [409]: Primary sensors offline!" ) ); print_error( _( " >> Initialize secondary sensors: Geiger profiling…" ) ); @@ -1664,7 +1664,7 @@ void computer_session::failure_pump_explode() for( const tripoint_bub_ms &p : here.points_on_zlevel() ) { if( here.ter( p ) == ter_t_sewage_pump ) { here.make_rubble( p ); - explosion_handler::explosion( &get_player_character(), p.raw(), 10 ); + explosion_handler::explosion( &get_player_character(), p, 10 ); } } } @@ -1706,9 +1706,11 @@ void computer_session::failure_amigara() get_player_character().add_effect( effect_amigara, 2_minutes ); map &here = get_map(); explosion_handler::explosion( &get_player_character(), - tripoint( rng( 0, MAPSIZE_X ), rng( 0, MAPSIZE_Y ), here.get_abs_sub().z() ), 10, 0.7, false, 10 ); + tripoint_bub_ms( rng( 0, MAPSIZE_X ), rng( 0, MAPSIZE_Y ), here.get_abs_sub().z() ), 10, 0.7, false, + 10 ); explosion_handler::explosion( &get_player_character(), - tripoint( rng( 0, MAPSIZE_X ), rng( 0, MAPSIZE_Y ), here.get_abs_sub().z() ), 10, 0.7, false, 10 ); + tripoint_bub_ms( rng( 0, MAPSIZE_X ), rng( 0, MAPSIZE_Y ), here.get_abs_sub().z() ), 10, 0.7, false, + 10 ); comp.remove_option( COMPACT_AMIGARA_START ); } diff --git a/src/debug_menu.cpp b/src/debug_menu.cpp index 2bfd911e463a4..5e6309bf0b57c 100644 --- a/src/debug_menu.cpp +++ b/src/debug_menu.cpp @@ -697,12 +697,12 @@ static int creature_uilist() static void monster_edit_menu() { - std::vector locations; + std::vector locations; uilist monster_menu; int charnum = 0; for( const monster &mon : g->all_monsters() ) { monster_menu.addentry( charnum++, true, MENU_AUTOASSIGN, mon.disp_name() ); - locations.emplace_back( mon.pos() ); + locations.emplace_back( mon.pos_bub() ); } if( locations.empty() ) { @@ -2284,16 +2284,16 @@ static faction *select_faction() static void character_edit_menu() { - std::vector< tripoint > locations; + std::vector< tripoint_bub_ms > locations; uilist charmenu; charmenu.title = _( "Edit which character?" ); int charnum = 0; avatar &player_character = get_avatar(); charmenu.addentry( charnum++, true, MENU_AUTOASSIGN, "%s", _( "You" ) ); - locations.emplace_back( player_character.pos() ); + locations.emplace_back( player_character.pos_bub() ); for( const npc &guy : g->all_npcs() ) { charmenu.addentry( charnum++, true, MENU_AUTOASSIGN, guy.get_name() ); - locations.emplace_back( guy.pos() ); + locations.emplace_back( guy.pos_bub() ); } pointmenu_cb callback( locations ); diff --git a/src/explosion.cpp b/src/explosion.cpp index 578c41c4a3f62..6167d2d073556 100644 --- a/src/explosion.cpp +++ b/src/explosion.cpp @@ -509,7 +509,8 @@ static std::vector shrapnel( map *m, const Creature *source, return distrib; } -void explosion( const Creature *source, const tripoint &p, float power, float factor, bool fire, +void explosion( const Creature *source, const tripoint_bub_ms &p, float power, float factor, + bool fire, int casing_mass, float frag_mass ) { explosion_data data; @@ -532,7 +533,7 @@ bool explosion_processing_active() return process_explosions_in_progress; } -void explosion( const Creature *source, const tripoint &p, const explosion_data &ex ) +void explosion( const Creature *source, const tripoint_bub_ms &p, const explosion_data &ex ) { _explosions.emplace_back( source, get_map().getglobal( p ), ex ); } @@ -595,18 +596,18 @@ void _make_explosion( map *m, const Creature *source, const tripoint_bub_ms &p, } } -void flashbang( const tripoint &p, bool player_immune ) +void flashbang( const tripoint_bub_ms &p, bool player_immune ) { draw_explosion( p, 8, c_white ); Character &player_character = get_player_character(); - int dist = rl_dist( player_character.pos(), p ); + int dist = rl_dist( player_character.pos_bub(), p ); map &here = get_map(); if( dist <= 8 && !player_immune ) { if( !player_character.has_flag( STATIC( json_character_flag( "IMMUNE_HEARING_DAMAGE" ) ) ) && !player_character.is_wearing( itype_rm13_armor_on ) ) { player_character.add_effect( effect_deaf, time_duration::from_turns( 40 - dist * 4 ) ); } - if( here.sees( player_character.pos(), p, 8 ) ) { + if( here.sees( player_character.pos_bub(), p, 8 ) ) { int flash_mod = 0; if( player_character.has_trait( trait_PER_SLIME ) ) { if( one_in( 2 ) ) { @@ -630,12 +631,12 @@ void flashbang( const tripoint &p, bool player_immune ) continue; } // TODO: can the following code be called for all types of creatures - dist = rl_dist( critter.pos(), p ); + dist = rl_dist( critter.pos_bub(), p ); if( dist <= 8 ) { if( dist <= 4 ) { critter.add_effect( effect_stunned, time_duration::from_turns( 10 - dist ) ); } - if( critter.has_flag( mon_flag_SEES ) && here.sees( critter.pos(), p, 8 ) ) { + if( critter.has_flag( mon_flag_SEES ) && here.sees( critter.pos_bub(), p, 8 ) ) { critter.add_effect( effect_blind, time_duration::from_turns( 18 - dist ) ); } if( critter.has_flag( mon_flag_HEARS ) ) { @@ -647,44 +648,43 @@ void flashbang( const tripoint &p, bool player_immune ) // TODO: Blind/deafen NPC } -void shockwave( const tripoint &p, int radius, int force, int stun, int dam_mult, +void shockwave( const tripoint_bub_ms &p, int radius, int force, int stun, int dam_mult, bool ignore_player ) { - const tripoint_bub_ms pos{p}; // TODO: Remove when operation is typified - draw_explosion( pos, radius, c_blue ); + draw_explosion( p, radius, c_blue ); - sounds::sound( pos, force * force * dam_mult / 2, sounds::sound_t::combat, _( "Crack!" ), false, + sounds::sound( p, force * force * dam_mult / 2, sounds::sound_t::combat, _( "Crack!" ), false, "misc", "shockwave" ); for( monster &critter : g->all_monsters() ) { - if( critter.posz() != pos.z() ) { + if( critter.posz() != p.z() ) { continue; } - if( rl_dist( critter.pos_bub(), pos ) <= radius ) { + if( rl_dist( critter.pos_bub(), p ) <= radius ) { add_msg( _( "%s is caught in the shockwave!" ), critter.name() ); - g->knockback( pos, critter.pos_bub(), force, stun, dam_mult ); + g->knockback( p, critter.pos_bub(), force, stun, dam_mult ); } } // TODO: combine the two loops and the case for avatar using all_creatures() for( npc &guy : g->all_npcs() ) { - if( guy.posz() != pos.z() ) { + if( guy.posz() != p.z() ) { continue; } - if( rl_dist( guy.pos_bub(), pos ) <= radius ) { + if( rl_dist( guy.pos_bub(), p ) <= radius ) { add_msg( _( "%s is caught in the shockwave!" ), guy.get_name() ); - g->knockback( pos, guy.pos_bub(), force, stun, dam_mult ); + g->knockback( p, guy.pos_bub(), force, stun, dam_mult ); } } Character &player_character = get_player_character(); - if( rl_dist( player_character.pos_bub(), pos ) <= radius && !ignore_player && + if( rl_dist( player_character.pos_bub(), p ) <= radius && !ignore_player && ( !player_character.has_trait( trait_LEG_TENT_BRACE ) || !player_character.is_barefoot() ) ) { add_msg( m_bad, _( "You're caught in the shockwave!" ) ); - g->knockback( pos, player_character.pos_bub(), force, stun, dam_mult ); + g->knockback( p, player_character.pos_bub(), force, stun, dam_mult ); } } -void scrambler_blast( const tripoint &p ) +void scrambler_blast( const tripoint_bub_ms &p ) { if( monster *const mon_ptr = get_creature_tracker().creature_at( p ) ) { monster &critter = *mon_ptr; @@ -696,7 +696,7 @@ void scrambler_blast( const tripoint &p ) } } -void emp_blast( const tripoint &p ) +void emp_blast( const tripoint_bub_ms &p ) { Character &player_character = get_player_character(); const bool sight = player_character.sees( p ); @@ -723,7 +723,7 @@ void emp_blast( const tripoint &p ) if( sight ) { add_msg( _( "The nearby doors slide open!" ) ); } - for( const tripoint &pos : here.points_in_radius( p, 3 ) ) { + for( const tripoint_bub_ms &pos : here.points_in_radius( p, 3 ) ) { if( here.ter( pos ) == ter_t_door_metal_locked ) { here.ter_set( pos, ter_t_floor ); } @@ -795,8 +795,7 @@ void emp_blast( const tripoint &p ) add_msg( _( "The %s is unaffected by the EMP blast." ), critter.name() ); } } - if( player_character.posx() == p.x && player_character.posy() == p.y && - player_character.posz() == p.z ) { + if( player_character.pos_bub() == p ) { if( player_character.get_power_level() > 0_kJ && !player_character.has_flag( json_flag_EMP_IMMUNE ) && !player_character.has_flag( json_flag_EMP_ENERGYDRAIN_IMMUNE ) ) { @@ -843,28 +842,28 @@ void emp_blast( const tripoint &p ) // TODO: Drain NPC energy reserves } -void resonance_cascade( const tripoint &p ) +void resonance_cascade( const tripoint_bub_ms &p ) { Character &player_character = get_player_character(); const time_duration maxglow = time_duration::from_turns( 100 - 5 * trig_dist( p, - player_character.pos() ) ); + player_character.pos_bub() ) ); if( maxglow > 0_turns ) { const time_duration minglow = std::max( 0_turns, time_duration::from_turns( 60 - 5 * trig_dist( p, - player_character.pos() ) ) ); + player_character.pos_bub() ) ) ); player_character.add_effect( effect_teleglow, rng( minglow, maxglow ) * 100 ); } - int startx = p.x < 8 ? 0 : p.x - 8; - int endx = p.x + 8 >= SEEX * 3 ? SEEX * 3 - 1 : p.x + 8; - int starty = p.y < 8 ? 0 : p.y - 8; - int endy = p.y + 8 >= SEEY * 3 ? SEEY * 3 - 1 : p.y + 8; - tripoint_bub_ms dest( startx, starty, p.z ); + int startx = p.x() < 8 ? 0 : p.x() - 8; + int endx = p.x() + 8 >= SEEX * 3 ? SEEX * 3 - 1 : p.x() + 8; + int starty = p.y() < 8 ? 0 : p.y() - 8; + int endy = p.y() + 8 >= SEEY * 3 ? SEEY * 3 - 1 : p.y() + 8; + tripoint_bub_ms dest( startx, starty, p.z() ); map &here = get_map(); for( int &i = dest.x(); i <= endx; i++ ) { for( int &j = dest.y(); j <= endy; j++ ) { switch( rng( 1, 80 ) ) { case 1: case 2: - emp_blast( dest.raw() ); + emp_blast( dest ); break; case 3: case 4: @@ -893,7 +892,7 @@ void resonance_cascade( const tripoint &p ) } if( !one_in( 3 ) ) { // TODO: fix point types - here.add_field( tripoint_bub_ms{ k, l, p.z }, type, 3 ); + here.add_field( tripoint_bub_ms{ k, l, p.z()}, type, 3 ); } } } @@ -925,7 +924,7 @@ void resonance_cascade( const tripoint &p ) here.destroy( dest ); break; case 19: - explosion( &player_character, dest.raw(), rng( 1, 10 ), rng( 0, 1 ) * rng( 0, 6 ), one_in( 4 ) ); + explosion( &player_character, dest, rng( 1, 10 ), rng( 0, 1 ) * rng( 0, 6 ), one_in( 4 ) ); break; default: break; diff --git a/src/explosion.h b/src/explosion.h index 5d27bff43b06e..a8246a0f8e9ac 100644 --- a/src/explosion.h +++ b/src/explosion.h @@ -75,7 +75,7 @@ inline std::vector _explosions; If factor <= 0, no blast is produced The explosion won't actually occur until process_explosions() */ void explosion( - const Creature *source, const tripoint &p, float power, float factor = 0.8f, + const Creature *source, const tripoint_bub_ms &p, float power, float factor = 0.8f, bool fire = false, int casing_mass = 0, float frag_mass = 0.05 ); @@ -83,26 +83,24 @@ void explosion( // would potentially set off additional explosions should not be performed. They should wait // until triggered normally. bool explosion_processing_active(); -void explosion( const Creature *source, const tripoint &p, const explosion_data &ex ); +void explosion( const Creature *source, const tripoint_bub_ms &p, const explosion_data &ex ); void _make_explosion( map *m, const Creature *source, const tripoint_bub_ms &p, const explosion_data &ex ); /** Triggers a flashbang explosion at p. */ -void flashbang( const tripoint &p, bool player_immune = false ); +void flashbang( const tripoint_bub_ms &p, bool player_immune = false ); /** Triggers a resonance cascade at p. */ -void resonance_cascade( const tripoint &p ); +void resonance_cascade( const tripoint_bub_ms &p ); /** Triggers a scrambler blast at p. */ -void scrambler_blast( const tripoint &p ); +void scrambler_blast( const tripoint_bub_ms &p ); /** Triggers an EMP blast at p. */ -void emp_blast( const tripoint &p ); +void emp_blast( const tripoint_bub_ms &p ); // shockwave applies knockback to all targets within radius of p // parameters force, stun, and dam_mult are passed to knockback() // ignore_player determines if player is affected, useful for bionic, etc. -void shockwave( const tripoint &p, int radius, int force, int stun, int dam_mult, +void shockwave( const tripoint_bub_ms &p, int radius, int force, int stun, int dam_mult, bool ignore_player ); -// TODO: Get rid of untyped overload -void draw_explosion( const tripoint &p, int radius, const nc_color &col ); void draw_explosion( const tripoint_bub_ms &p, int radius, const nc_color &col ); void draw_custom_explosion( const std::map &area, const std::optional &tile_id = std::nullopt ); diff --git a/src/game.cpp b/src/game.cpp index 97bc2e170c103..89b45d876ccd7 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -13171,17 +13171,17 @@ void game::display_visibility() if( use_tiles ) { display_toggle_overlay( ACTION_DISPLAY_VISIBILITY ); if( display_overlay_state( ACTION_DISPLAY_VISIBILITY ) ) { - std::vector< tripoint > locations; + std::vector< tripoint_bub_ms > locations; uilist creature_menu; int num_creatures = 0; creature_menu.addentry( num_creatures++, true, MENU_AUTOASSIGN, "%s", _( "You" ) ); - locations.emplace_back( get_player_character().pos() ); // add player first. + locations.emplace_back( get_player_character().pos_bub() ); // add player first. for( const Creature &critter : g->all_creatures() ) { if( critter.is_avatar() ) { continue; } creature_menu.addentry( num_creatures++, true, MENU_AUTOASSIGN, critter.disp_name() ); - locations.emplace_back( critter.pos() ); + locations.emplace_back( critter.pos_bub() ); } pointmenu_cb callback( locations ); diff --git a/src/iexamine.cpp b/src/iexamine.cpp index fb7f80e7588d8..f3c09bf5b9f14 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -5342,11 +5342,11 @@ void iexamine::pay_gas( Character &you, const tripoint_bub_ms &examp ) amenu.selected = uistate.ags_pay_gas_selected_pump; amenu.text = str_to_illiterate_str( string_format( _( "Please choose %s pump:" ), fuelTypeStr ) ); - std::vector pumps; + std::vector pumps; for( int i = 0; i < pumpCount; i++ ) { amenu.addentry( i, true, -1, str_to_illiterate_str( _( "Pump " ) ) + std::to_string( i + 1 ) ); - pumps.emplace_back( getGasPumpByNumber( examp, i ).value_or( examp ).raw() ); + pumps.emplace_back( getGasPumpByNumber( examp, i ).value_or( examp ) ); } pointmenu_cb callback( pumps ); amenu.callback = &callback; diff --git a/src/item.cpp b/src/item.cpp index 4ef8b13eafa3e..6fde92bb035ec 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -12859,7 +12859,7 @@ bool item::detonate( const tripoint_bub_ms &p, std::vector &drops ) ? &get_player_character() : nullptr; if( type->explosion.power >= 0 ) { - explosion_handler::explosion( source, p.raw(), type->explosion ); + explosion_handler::explosion( source, p, type->explosion ); return true; } else if( type->ammo && ( type->ammo->special_cookoff || type->ammo->cookoff ) ) { int charges_remaining = charges; @@ -12871,7 +12871,7 @@ bool item::detonate( const tripoint_bub_ms &p, std::vector &drops ) if( type->ammo->cookoff ) { // If ammo type can burn, then create an explosion proportional to quantity. float power = 3.0f * std::pow( rounds_exploded / 25.0f, 0.25f ); - explosion_handler::explosion( nullptr, p.raw(), power, 0.0f, false, 0 ); + explosion_handler::explosion( nullptr, p, power, 0.0f, false, 0 ); } charges_remaining -= rounds_exploded; if( charges_remaining > 0 ) { diff --git a/src/iuse.cpp b/src/iuse.cpp index f437826283e7e..684c704ff22ad 100644 --- a/src/iuse.cpp +++ b/src/iuse.cpp @@ -3536,7 +3536,7 @@ std::optional iuse::grenade_inc_act( Character *p, item *, const tripoint_b here.add_field( flame, fd_fire, rng( 0, 2 ) ); } } - explosion_handler::explosion( p, pos.raw(), 8, 0.8, true ); + explosion_handler::explosion( p, pos, 8, 0.8, true ); for( const tripoint_bub_ms &dest : here.points_in_radius( pos, 2 ) ) { here.add_field( dest, fd_incendiary, 3 ); } @@ -5477,18 +5477,18 @@ std::optional iuse::robotcontrol( Character *p, item *it, const tripoint_bu // Build a list of all unfriendly robots in range. // TODO: change into vector std::vector< shared_ptr_fast< monster> > mons; - std::vector< tripoint > locations; + std::vector< tripoint_bub_ms > locations; int entry_num = 0; for( const monster &candidate : g->all_monsters() ) { if( robotcontrol_can_target( p, candidate ) ) { mons.push_back( g->shared_from( candidate ) ); pick_robot.addentry( entry_num++, true, MENU_AUTOASSIGN, candidate.name() ); - tripoint seen_loc; + tripoint_bub_ms seen_loc; // Show locations of seen robots, center on player if robot is not seen if( p->sees( candidate ) ) { - seen_loc = candidate.pos_bub().raw(); + seen_loc = candidate.pos_bub(); } else { - seen_loc = p->pos_bub().raw(); + seen_loc = p->pos_bub(); } locations.push_back( seen_loc ); } @@ -7379,10 +7379,10 @@ static vehicle *pickveh( const tripoint_bub_ms ¢er, bool advanced ) vehs.push_back( v ); } } - std::vector locations; + std::vector locations; for( int i = 0; i < static_cast( vehs.size() ); i++ ) { vehicle *veh = vehs[i]; - locations.push_back( veh->pos_bub().raw() ); + locations.push_back( veh->pos_bub() ); pmenu.addentry( i, true, MENU_AUTOASSIGN, veh->name ); } diff --git a/src/iuse_actor.cpp b/src/iuse_actor.cpp index bec793fffd336..1c8aeb33e6963 100644 --- a/src/iuse_actor.cpp +++ b/src/iuse_actor.cpp @@ -696,14 +696,14 @@ std::optional explosion_iuse::use( Character *p, item &it, const tripoint_b source = g->find_npc( thrower ); } } - explosion_handler::explosion( source, pos.raw(), explosion ); + explosion_handler::explosion( source, pos, explosion ); } if( draw_explosion_radius >= 0 ) { explosion_handler::draw_explosion( pos, draw_explosion_radius, draw_explosion_color ); } if( do_flashbang ) { - explosion_handler::flashbang( pos.raw(), flashbang_player_immune ); + explosion_handler::flashbang( pos, flashbang_player_immune ); } map &here = get_map(); if( fields_radius >= 0 && fields_type.id() ) { @@ -715,12 +715,12 @@ std::optional explosion_iuse::use( Character *p, item &it, const tripoint_b } if( scrambler_blast_radius >= 0 ) { for( const tripoint_bub_ms &dest : here.points_in_radius( pos, scrambler_blast_radius ) ) { - explosion_handler::scrambler_blast( dest.raw() ); + explosion_handler::scrambler_blast( dest ); } } if( emp_blast_radius >= 0 ) { for( const tripoint_bub_ms &dest : here.points_in_radius( pos, emp_blast_radius ) ) { - explosion_handler::emp_blast( dest.raw() ); + explosion_handler::emp_blast( dest ); } } return 1; diff --git a/src/magic_spell_effect.cpp b/src/magic_spell_effect.cpp index 181f5249309ad..a2e5e72926433 100644 --- a/src/magic_spell_effect.cpp +++ b/src/magic_spell_effect.cpp @@ -1445,13 +1445,13 @@ void spell_effect::pull_to_caster( const spell &sp, Creature &caster, void spell_effect::explosion( const spell &sp, Creature &caster, const tripoint_bub_ms &target ) { - explosion_handler::explosion( &caster, target.raw(), sp.damage( caster ), sp.aoe( caster ) / 10.0, + explosion_handler::explosion( &caster, target, sp.damage( caster ), sp.aoe( caster ) / 10.0, true ); } void spell_effect::flashbang( const spell &sp, Creature &caster, const tripoint_bub_ms &target ) { - explosion_handler::flashbang( target.raw(), caster.is_avatar() && + explosion_handler::flashbang( target, caster.is_avatar() && !sp.is_valid_target( spell_target::self ) ); } diff --git a/src/map.cpp b/src/map.cpp index 5bf5c9b18b78a..33a3b870386e1 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -4495,7 +4495,7 @@ void map::bash_ter_furn( const tripoint_bub_ms &p, bash_params ¶ms ) } if( bash->explosive > 0 ) { - explosion_handler::explosion( nullptr, p.raw(), bash->explosive, 0.8, false ); + explosion_handler::explosion( nullptr, p, bash->explosive, 0.8, false ); } if( will_collapse && !has_flag( ter_furn_flag::TFLAG_SUPPORTS_ROOF, p ) ) { diff --git a/src/monster.cpp b/src/monster.cpp index 175bfd95695b8..3fe48eda62833 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -2862,12 +2862,12 @@ void monster::process_turn() } } if( zap != pos_bub() ) { - explosion_handler::emp_blast( zap.raw() ); // Fries electronics due to the intensity of the field + explosion_handler::emp_blast( zap ); // Fries electronics due to the intensity of the field } const ter_id &t = here.ter( zap ); if( t == ter_t_gas_pump || t == ter_t_gas_pump_a ) { if( one_in( 4 ) ) { - explosion_handler::explosion( this, pos(), 40, 0.8, true ); + explosion_handler::explosion( this, pos_bub(), 40, 0.8, true ); add_msg_if_player_sees( zap.raw(), m_warning, _( "The %s explodes in a fiery inferno!" ), here.tername( zap ) ); } else { diff --git a/src/npc.cpp b/src/npc.cpp index 9426d4c7af9b6..57fe2016f2bc5 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -1136,7 +1136,6 @@ void npc::on_move( const tripoint_abs_ms &old_pos ) void npc::travel_overmap( const tripoint_abs_omt &pos ) { - // TODO: fix point types const point_abs_om pos_om_old = project_to( global_omt_location().xy() ); spawn_at_omt( pos ); const point_abs_om pos_om_new = project_to( global_omt_location().xy() ); @@ -2890,10 +2889,10 @@ std::string npc::opinion_text() const return ret; } -static void maybe_shift( tripoint_bub_ms &pos, const point &d ) +static void maybe_shift( tripoint_bub_ms &pos, const point_rel_ms &d ) { if( !pos.is_invalid() ) { - pos += d; + pos += d.raw(); // TODO: Make += etc. available to corresponding relative coordinates. } } @@ -2901,7 +2900,7 @@ void npc::shift( const point_rel_sm &s ) { const point_rel_ms shift = coords::project_to( s ); // TODO: convert these to absolute coords and get rid of shift() - maybe_shift( wanted_item_pos, point( -shift.x(), -shift.y() ) ); + maybe_shift( wanted_item_pos, -shift ); path.clear(); } diff --git a/src/npcmove.cpp b/src/npcmove.cpp index dd4b22e912864..c8423cb231756 100644 --- a/src/npcmove.cpp +++ b/src/npcmove.cpp @@ -241,12 +241,13 @@ bool compare_sound_alert( const dangerous_sound &sound_a, const dangerous_sound return sound_a.volume < sound_b.volume; } -static bool clear_shot_reach( const tripoint &from, const tripoint &to, bool check_ally = true ) +static bool clear_shot_reach( const tripoint_bub_ms &from, const tripoint_bub_ms &to, + bool check_ally = true ) { - std::vector path = line_to( from, to ); + std::vector path = line_to( from, to ); path.pop_back(); creature_tracker &creatures = get_creature_tracker(); - for( const tripoint &p : path ) { + for( const tripoint_bub_ms &p : path ) { Creature *inter = creatures.creature_at( p ); if( check_ally && inter != nullptr ) { return false; @@ -672,7 +673,8 @@ float npc::estimate_armour( const Character &candidate ) const return armour; } -static bool too_close( const tripoint &critter_pos, const tripoint &ally_pos, const int def_radius ) +static bool too_close( const tripoint_bub_ms &critter_pos, const tripoint_bub_ms &ally_pos, + const int def_radius ) { return rl_dist( critter_pos, ally_pos ) <= def_radius; } @@ -723,7 +725,7 @@ void npc::assess_danger() rules.engagement == combat_engagement::NONE; const bool no_fighting = rules.has_flag( ally_rule::forbid_engage ); const bool must_retreat = rules.has_flag( ally_rule::follow_close ) && - !too_close( pos(), player_character.pos(), follow_distance() ) && + !too_close( pos_bub(), player_character.pos_bub(), follow_distance() ) && !is_guarding(); if( is_player_ally() ) { @@ -749,7 +751,7 @@ void npc::assess_danger() case combat_engagement::CLOSE: // Either close to player or close enough that we can reach it and close to us return ( dist <= max_range && scaled_dist <= def_radius * 0.5 ) || - too_close( c.pos(), player_character.pos(), def_radius ); + too_close( c.pos_bub(), player_character.pos_bub(), def_radius ); case combat_engagement::WEAK: return c.get_hp() <= average_damage_dealt(); case combat_engagement::HIT: @@ -834,7 +836,7 @@ void npc::assess_danger() float critter_threat = evaluate_monster( critter, dist ); // ignore targets behind glass even if we can see them - if( !clear_shot_reach( pos(), critter.pos(), false ) ) { + if( !clear_shot_reach( pos_bub(), critter.pos_bub(), false ) ) { if( is_enemy() || !critter.friendly ) { // still warn about enemies behind impassable glass walls, but not as often. add_msg_debug( debugmode::DF_NPC_COMBATAI, @@ -891,7 +893,7 @@ void npc::assess_danger() // because the horse the NPC is riding is still in the ai_cache.friends vector, // so either one would count as a friendly for this purpose. if( guy.lock() ) { - is_too_close |= too_close( critter.pos(), guy.lock()->pos(), def_radius ); + is_too_close |= too_close( critter.pos_bub(), guy.lock()->pos_bub(), def_radius ); } } // ignore distant monsters that our rules prevent us from attacking @@ -923,7 +925,7 @@ void npc::assess_danger() const std::string & bogey, const std::string & warning ) { int dist = rl_dist( pos_bub(), foe.pos_bub() ); // ignore targets behind glass even if we can see them - if( !clear_shot_reach( pos(), foe.pos(), false ) ) { + if( !clear_shot_reach( pos_bub(), foe.pos_bub(), false ) ) { // still warn about enemies behind impassable glass walls, but not as often. // since NPC threats have a higher chance of ignoring soft obstacles, we'll ignore them here. if( foe_threat > 2 * ( 8.0f + personality.bravery + rng( 0, 5 ) ) ) { @@ -948,7 +950,7 @@ void npc::assess_danger() if( self_defense_only ) { break; } - is_too_close |= too_close( foe.pos(), guy.lock()->pos(), def_radius ); + is_too_close |= too_close( foe.pos_bub(), guy.lock()->pos_bub(), def_radius ); if( is_too_close ) { break; } @@ -1470,7 +1472,6 @@ void npc::move() } else { final_destination = activity_route.back(); } - // TODO: fix point types update_path( final_destination ); if( !path.empty() ) { move_to_next(); @@ -2980,7 +2981,6 @@ void npc::move_to( const tripoint_bub_ms &pt, bool no_bashing, std::setupdate_path( final_destination ); } } @@ -4974,7 +4974,6 @@ void npc::go_to_omt_destination() return; } } - // TODO: fix point types tripoint_bub_ms sm_tri = here.bub_from_abs( project_to( omt_path.back() ) ); tripoint_bub_ms centre_sub = sm_tri + point( SEEX, SEEY ); if( !here.passable( centre_sub ) ) { diff --git a/src/npctalk.cpp b/src/npctalk.cpp index 3a1a8ca3e3267..b7a23d982f11c 100644 --- a/src/npctalk.cpp +++ b/src/npctalk.cpp @@ -643,15 +643,15 @@ static int npc_select_menu( const std::vector &npc_list, const std::strin return 0; } else { uilist nmenu; - std::vector locations; + std::vector locations; nmenu.text = prompt; for( const npc *elem : npc_list ) { nmenu.addentry( -1, true, MENU_AUTOASSIGN, elem->name_and_activity() ); - locations.emplace_back( elem->pos_bub().raw() ); + locations.emplace_back( elem->pos_bub() ); } if( npc_count > 1 && everyone ) { nmenu.addentry( -1, true, MENU_AUTOASSIGN, _( "Everyone" ) ); - locations.emplace_back( get_avatar().pos_bub().raw() ); + locations.emplace_back( get_avatar().pos_bub() ); } pointmenu_cb callback( locations ); nmenu.callback = &callback; @@ -673,7 +673,7 @@ static int creature_select_menu( const std::vector &talker_list, return 0; } else { uilist nmenu; - std::vector locations; + std::vector locations; nmenu.text = prompt; for( const Creature *elem : talker_list ) { if( elem->is_npc() ) { @@ -681,11 +681,11 @@ static int creature_select_menu( const std::vector &talker_list, } else { nmenu.addentry( -1, true, MENU_AUTOASSIGN, elem->disp_name() ); } - locations.emplace_back( elem->pos_bub().raw() ); + locations.emplace_back( elem->pos_bub() ); } if( npc_count > 1 && everyone ) { nmenu.addentry( -1, true, MENU_AUTOASSIGN, _( "Everyone" ) ); - locations.emplace_back( get_avatar().pos_bub().raw() ); + locations.emplace_back( get_avatar().pos_bub() ); } pointmenu_cb callback( locations ); nmenu.callback = &callback; @@ -1509,7 +1509,6 @@ void npc::handle_sound( const sounds::sound_t spriority, const std::string &desc add_msg_debug( debugmode::DF_NPC, "%s added noise at pos %d:%d", get_name(), s_abs_pos.x(), s_abs_pos.y() ); dangerous_sound temp_sound; - // TODO: fix point types temp_sound.abs_pos = s_abs_pos; temp_sound.volume = heard_volume; temp_sound.type = spriority; diff --git a/src/npctalk_funcs.cpp b/src/npctalk_funcs.cpp index e46c9b1137ec3..807fe415c6290 100644 --- a/src/npctalk_funcs.cpp +++ b/src/npctalk_funcs.cpp @@ -1245,12 +1245,12 @@ void talk_function::start_training_gen( Character &teacher, std::vector followers; - std::vector locations; + std::vector locations; for( npc &guy : g->all_npcs() ) { if( guy.is_player_ally() && get_player_view().sees( guy ) ) { followers.push_back( &guy ); - locations.push_back( guy.pos() ); + locations.push_back( guy.pos_bub() ); } } @@ -1288,13 +1288,13 @@ void talk_function::distribute_food_auto( npc &p ) zone_manager &mgr = zone_manager::get_manager(); const tripoint_abs_ms &npc_abs_loc = p.get_location(); // 3x3 square with NPC in the center, includes NPC's tile and all adjacent ones, for overflow - // TODO: fix point types; Awful hack, zones want the raw value - const tripoint top_left = npc_abs_loc.raw() + point::north_west; - const tripoint bottom_right = npc_abs_loc.raw() + point::south_east; + const tripoint_abs_ms top_left = npc_abs_loc + point::north_west; + const tripoint_abs_ms bottom_right = npc_abs_loc + point::south_east; std::string zone_name = "ERROR IF YOU SEE THIS (dummy zone talk_function::distribute_food_auto)"; const faction_id &fac_id = p.get_fac_id(); - mgr.add( zone_name, zone_type_CAMP_FOOD, fac_id, false, true, top_left, bottom_right ); - mgr.add( zone_name, zone_type_CAMP_STORAGE, fac_id, false, true, top_left, bottom_right ); + mgr.add( zone_name, zone_type_CAMP_FOOD, fac_id, false, true, top_left.raw(), bottom_right.raw() ); + mgr.add( zone_name, zone_type_CAMP_STORAGE, fac_id, false, true, top_left.raw(), + bottom_right.raw() ); npc_camp->distribute_food( false ); // Now we clean up all camp zones, though there SHOULD only be the two we just made auto lambda_remove_zones = [&mgr, &fac_id]( zone_type_id type_to_remove ) { diff --git a/src/npctrade_utils.cpp b/src/npctrade_utils.cpp index be4fe84f91d8a..6dce766e37de2 100644 --- a/src/npctrade_utils.cpp +++ b/src/npctrade_utils.cpp @@ -55,7 +55,7 @@ dest_t _get_shuffled_point_set( std::unordered_set const &set ) } // returns true if item wasn't placed -bool _to_map( item const &it, map &here, tripoint const &dpoint_here ) +bool _to_map( item const &it, map &here, tripoint_bub_ms const &dpoint_here ) { if( here.can_put_items_ter_furn( dpoint_here ) && here.free_volume( dpoint_here ) >= it.volume() ) { @@ -141,7 +141,7 @@ std::list distribute_items_to_npc_zones( std::list &items, npc &guy if( vp && vp->vehicle().get_owner() == fac_id ) { leftover = _to_veh( it, vp ); } else { - leftover = _to_map( it, here, dpoint_here.raw() ); + leftover = _to_map( it, here, dpoint_here ); } if( !leftover ) { break; diff --git a/src/projectile.cpp b/src/projectile.cpp index e19d5477609e8..ced449f811c8a 100644 --- a/src/projectile.cpp +++ b/src/projectile.cpp @@ -179,13 +179,13 @@ void apply_ammo_effects( Creature *source, const tripoint_bub_ms &p, } } if( ae.aoe_explosion_data.power > 0 ) { - explosion_handler::explosion( source, p.raw(), ae.aoe_explosion_data ); + explosion_handler::explosion( source, p, ae.aoe_explosion_data ); } if( ae.do_flashbang ) { - explosion_handler::flashbang( p.raw() ); + explosion_handler::flashbang( p ); } if( ae.do_emp_blast ) { - explosion_handler::emp_blast( p.raw() ); + explosion_handler::emp_blast( p ); } if( ae.foamcrete_build ) { foamcrete_build( p ); diff --git a/src/ranged.cpp b/src/ranged.cpp index adb3144b5183d..01055ea7f72b1 100644 --- a/src/ranged.cpp +++ b/src/ranged.cpp @@ -903,7 +903,7 @@ bool Character::handle_gun_overheat( item &it ) add_msg_if_player( m_bad, _( "Your %s detonates!" ), it.tname() ); it.faults.insert( fault_overheat_melting ); - explosion_handler::explosion( this, this->pos(), 1200, 0.4 ); + explosion_handler::explosion( this, this->pos_bub(), 1200, 0.4 ); return false; } else if( it.faults_potential().count( fault_overheat_melting ) && fault_roll > 6 ) { add_msg_if_player( m_bad, _( "Acrid smoke pours from your %s as its internals fuse together." ), diff --git a/src/teleport.cpp b/src/teleport.cpp index 79e477af9c632..9798cf4651809 100644 --- a/src/teleport.cpp +++ b/src/teleport.cpp @@ -184,7 +184,7 @@ bool teleport::teleport_to_point( Creature &critter, tripoint_bub_ms target, boo collision_angle = rng( 0, 360 ); g->fling_creature( poor_soul, units::from_degrees( collision_angle - 180 ), 40, false, true ); //spawn a mostly cosmetic explosion for flair. - explosion_handler::explosion( &critter, target.raw(), 10 ); + explosion_handler::explosion( &critter, target, 10 ); //if it was grabbed, it isn't anymore. for( const effect &grab : poor_soul->get_effects_with_flag( json_flag_GRAB ) ) { poor_soul->remove_effect( grab.get_id() ); diff --git a/src/trapfunc.cpp b/src/trapfunc.cpp index 4fd944f1d55d7..cb9754726165e 100644 --- a/src/trapfunc.cpp +++ b/src/trapfunc.cpp @@ -810,7 +810,7 @@ bool trapfunc::landmine( const tripoint &p, Creature *c, item * ) c->add_msg_player_or_npc( m_bad, _( "You trigger a land mine!" ), _( " triggers a land mine!" ) ); } - explosion_handler::explosion( c, p, 18, 0.5, false, 8 ); + explosion_handler::explosion( c, tripoint_bub_ms( p ), 18, 0.5, false, 8 ); get_map().remove_trap( p ); return true; } @@ -1417,7 +1417,7 @@ bool trapfunc::glow( const tripoint &p, Creature *c, item * ) get_player_character().irradiate( rng( 10, 30 ) ); } else if( one_in( 4 ) ) { add_msg( m_bad, _( "A blinding flash strikes you!" ) ); - explosion_handler::flashbang( p ); + explosion_handler::flashbang( tripoint_bub_ms( p ) ); } else { add_msg( _( "Small flashes surround you." ) ); } @@ -1429,7 +1429,7 @@ bool trapfunc::glow( const tripoint &p, Creature *c, item * ) you->irradiate( rng( 10, 30 ) ); } else if( one_in( 4 ) ) { you->add_msg_if_player( m_bad, _( "A blinding flash strikes you!" ) ); - explosion_handler::flashbang( p ); + explosion_handler::flashbang( tripoint_bub_ms( p ) ); } else { c->add_msg_if_player( _( "Small flashes surround you." ) ); } diff --git a/src/turret.cpp b/src/turret.cpp index 9e83815fd3f8e..89d8c878f65e4 100644 --- a/src/turret.cpp +++ b/src/turret.cpp @@ -460,12 +460,12 @@ std::vector vehicle::find_all_ready_turrets( bool manual, bool a void vehicle::turrets_set_targeting() { std::vector turrets; - std::vector locations; + std::vector locations; for( vehicle_part &p : parts ) { if( p.is_turret() ) { turrets.push_back( &p ); - locations.push_back( bub_part_pos( p ).raw() ); + locations.push_back( bub_part_pos( p ) ); } } @@ -515,12 +515,12 @@ void vehicle::turrets_set_targeting() void vehicle::turrets_set_mode() { std::vector turrets; - std::vector locations; + std::vector locations; for( vehicle_part &p : parts ) { if( p.base.is_gun() ) { turrets.push_back( &p ); - locations.push_back( bub_part_pos( p ).raw() ); + locations.push_back( bub_part_pos( p ) ); } } diff --git a/src/ui.cpp b/src/ui.cpp index f59d3ab7e5c40..66b82a69761bb 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -1166,18 +1166,18 @@ int uimenu::query() } struct pointmenu_cb::impl_t { - const std::vector< tripoint > &points; + const std::vector< tripoint_bub_ms > &points; int last; // to suppress redrawing tripoint_rel_ms last_view; // to reposition the view after selecting shared_ptr_fast terrain_draw_cb; - explicit impl_t( const std::vector &pts ); + explicit impl_t( const std::vector &pts ); ~impl_t(); void select( uilist *menu ); }; -pointmenu_cb::impl_t::impl_t( const std::vector &pts ) : points( pts ) +pointmenu_cb::impl_t::impl_t( const std::vector &pts ) : points( pts ) { last = INT_MIN; avatar &player_character = get_avatar(); @@ -1205,15 +1205,16 @@ void pointmenu_cb::impl_t::select( uilist *const menu ) if( menu->selected < 0 || menu->selected >= static_cast( points.size() ) ) { player_character.view_offset = tripoint_rel_ms::zero; } else { - const tripoint ¢er = points[menu->selected]; - player_character.view_offset = tripoint_rel_ms( center - player_character.pos() ); + const tripoint_bub_ms ¢er = points[menu->selected]; + player_character.view_offset = center - player_character.pos_bub(); // TODO: Remove this line when it's safe player_character.view_offset.z() = 0; } g->invalidate_main_ui_adaptor(); } -pointmenu_cb::pointmenu_cb( const std::vector &pts ) : impl( pts ) + +pointmenu_cb::pointmenu_cb( const std::vector &pts ) : impl( pts ) { } diff --git a/src/ui.h b/src/ui.h index 8ce890d201b25..817b3bb0c6d54 100644 --- a/src/ui.h +++ b/src/ui.h @@ -556,7 +556,7 @@ class pointmenu_cb : public uilist_callback pimpl impl; public: - explicit pointmenu_cb( const std::vector< tripoint > &pts ); + explicit pointmenu_cb( const std::vector< tripoint_bub_ms > &pts ); ~pointmenu_cb() override; void select( uilist *menu ) override; }; diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 6510633f27544..1e40a08b7dc41 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -7720,7 +7720,7 @@ bool vehicle::explode_fuel( vehicle_part &vp, const damage_type_id &type ) get_event_bus().send( name ); const int pow = 120 * ( 1 - std::exp( data.explosion_factor / -5000 * ( vp.ammo_remaining() * data.fuel_size_factor ) ) ); - explosion_handler::explosion( nullptr, bub_part_pos( vp ).raw(), pow, 0.7, data.fiery_explosion ); + explosion_handler::explosion( nullptr, bub_part_pos( vp ), pow, 0.7, data.fiery_explosion ); mod_hp( vp, -vp.hp() ); vp.ammo_unset(); } diff --git a/src/vehicle_move.cpp b/src/vehicle_move.cpp index a4d087dd9a554..7534ca8b2d567 100644 --- a/src/vehicle_move.cpp +++ b/src/vehicle_move.cpp @@ -1266,7 +1266,7 @@ void vehicle::handle_trap( const tripoint_bub_ms &p, vehicle_part &vp_wheel ) veh_data.sound_type, veh_data.sound_variant ); } if( veh_data.do_explosion ) { - explosion_handler::explosion( driver, p.raw(), veh_data.damage, 0.5f, false, veh_data.shrapnel ); + explosion_handler::explosion( driver, p, veh_data.damage, 0.5f, false, veh_data.shrapnel ); // Don't damage wheels with very high durability, such as roller drums or rail wheels } else if( damage_done ) { // Hit the wheel directly since it ran right over the trap.