Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename map:: get_global->get_abs, bub_from_abs->get_bub, omt_from_abs->get_omt #79167

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions src/activity_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ static hack_type get_hack_type( const tripoint_bub_ms &examp )

void hacking_activity_actor::finish( player_activity &act, Character &who )
{
tripoint_bub_ms examp = get_map().bub_from_abs( act.placement );
tripoint_bub_ms examp = get_map().get_bub( act.placement );
hack_type type = get_hack_type( examp );
switch( hack_attempt( who, tool ) ) {
case hack_result::UNABLE:
Expand Down Expand Up @@ -1270,7 +1270,7 @@ void hotwire_car_activity_actor::do_turn( player_activity &act, Character &who )
{
map &here = get_map();
if( calendar::once_every( 1_minutes ) ) {
bool lost = !here.veh_at( here.bub_from_abs( target ) ).has_value();
bool lost = !here.veh_at( here.get_bub( target ) ).has_value();
if( lost ) {
act.set_to_null();
debugmsg( "Lost ACT_HOTWIRE_CAR target vehicle" );
Expand All @@ -1286,7 +1286,7 @@ void hotwire_car_activity_actor::finish( player_activity &act, Character &who )
act.set_to_null();

map &here = get_map();
const optional_vpart_position vp = here.veh_at( here.bub_from_abs( target ) );
const optional_vpart_position vp = here.veh_at( here.get_bub( target ) );
if( !vp ) {
debugmsg( "Lost ACT_HOTWIRE_CAR target vehicle" );
return;
Expand Down Expand Up @@ -2804,7 +2804,7 @@ void lockpick_activity_actor::finish( player_activity &act, Character &who )
}

map &here = get_map();
const tripoint_bub_ms target = here.bub_from_abs( this->target );
const tripoint_bub_ms target = here.get_bub( this->target );
const ter_id &ter_type = here.ter( target );
const furn_id &furn_type = here.furn( target );
optional_vpart_position const veh = here.veh_at( target );
Expand Down Expand Up @@ -5024,7 +5024,7 @@ void milk_activity_actor::do_turn( player_activity &act, Character &who )
return;
}
map &here = get_map();
const tripoint_bub_ms source_pos = here.bub_from_abs( tripoint_abs_ms( monster_coords.at( 0 ) ) );
const tripoint_bub_ms source_pos = here.get_bub( tripoint_abs_ms( monster_coords.at( 0 ) ) );
monster *source_mon = get_creature_tracker().creature_at<monster>( source_pos );
if( source_mon == nullptr ) {
// We might end up here if the creature dies while being milked
Expand All @@ -5041,7 +5041,7 @@ void milk_activity_actor::finish( player_activity &act, Character &who )
return;
}
map &here = get_map();
const tripoint_bub_ms source_pos = here.bub_from_abs( tripoint_abs_ms( monster_coords.at( 0 ) ) );
const tripoint_bub_ms source_pos = here.get_bub( tripoint_abs_ms( monster_coords.at( 0 ) ) );
monster *source_mon = get_creature_tracker().creature_at<monster>( source_pos );
if( source_mon == nullptr ) {
debugmsg( "could not find source creature for liquid transfer" );
Expand Down Expand Up @@ -6397,10 +6397,10 @@ static void chop_single_do_turn( player_activity &act )
{
const map &here = get_map();
sfx::play_activity_sound( "tool", "axe",
sfx::get_heard_volume( here.bub_from_abs( act.placement ) ) );
sfx::get_heard_volume( here.get_bub( act.placement ) ) );
if( calendar::once_every( 1_minutes ) ) {
//~ Sound of a wood chopping tool at work!
sounds::sound( here.bub_from_abs( act.placement ), 15, sounds::sound_t::activity, _( "CHK!" ) );
sounds::sound( here.get_bub( act.placement ), 15, sounds::sound_t::activity, _( "CHK!" ) );
}
}

Expand All @@ -6418,7 +6418,7 @@ void chop_logs_activity_actor::do_turn( player_activity &act, Character & )
void chop_logs_activity_actor::finish( player_activity &act, Character &who )
{
map &here = get_map();
const tripoint_bub_ms &pos = here.bub_from_abs( act.placement );
const tripoint_bub_ms &pos = here.get_bub( act.placement );
int log_quan;
int stick_quan;
int splint_quan;
Expand Down Expand Up @@ -6502,12 +6502,12 @@ void chop_planks_activity_actor::finish( player_activity &act, Character &who )

map &here = get_map();
if( planks > 0 ) {
here.spawn_item( here.bub_from_abs( act.placement ), itype_2x4, planks, 0, calendar::turn );
here.spawn_item( here.get_bub( act.placement ), itype_2x4, planks, 0, calendar::turn );
who.add_msg_if_player( m_good, n_gettext( "You produce %d plank.", "You produce %d planks.",
planks ), planks );
}
if( scraps > 0 ) {
here.spawn_item( here.bub_from_abs( act.placement ), itype_splinter, scraps, 0, calendar::turn );
here.spawn_item( here.get_bub( act.placement ), itype_splinter, scraps, 0, calendar::turn );
who.add_msg_if_player( m_good, n_gettext( "You produce %d splinter.", "You produce %d splinters.",
scraps ), scraps );
}
Expand Down Expand Up @@ -6552,7 +6552,7 @@ void chop_tree_activity_actor::do_turn( player_activity &act, Character & )
void chop_tree_activity_actor::finish( player_activity &act, Character &who )
{
map &here = get_map();
const tripoint_bub_ms &pos = here.bub_from_abs( act.placement );
const tripoint_bub_ms &pos = here.get_bub( act.placement );

tripoint_rel_ms direction;
if( !who.is_npc() &&
Expand Down Expand Up @@ -6612,7 +6612,7 @@ void chop_tree_activity_actor::finish( player_activity &act, Character &who )
// sound of falling tree
here.collapse_at( pos, false, true, false );
sfx::play_variant_sound( "misc", "timber",
sfx::get_heard_volume( here.bub_from_abs( act.placement ) ) );
sfx::get_heard_volume( here.get_bub( act.placement ) ) );
get_event_bus().send<event_type::cuts_tree>( who.getID() );
act.set_to_null();
activity_handlers::resume_for_multi_activities( who );
Expand Down Expand Up @@ -6650,7 +6650,7 @@ void churn_activity_actor::finish( player_activity &act, Character &who )
{
map &here = get_map();
who.add_msg_if_player( _( "You finish churning up the earth here." ) );
here.ter_set( here.bub_from_abs( act.placement ), ter_t_dirtmound );
here.ter_set( here.get_bub( act.placement ), ter_t_dirtmound );
// Go back to what we were doing before
// could be player zone activity, or could be NPC multi-farming
act.set_to_null();
Expand Down Expand Up @@ -6688,7 +6688,7 @@ void clear_rubble_activity_actor::start( player_activity &act, Character & )
void clear_rubble_activity_actor::finish( player_activity &act, Character &who )
{
map &here = get_map();
const tripoint_bub_ms &pos = here.bub_from_abs( act.placement );
const tripoint_bub_ms &pos = here.get_bub( act.placement );
who.add_msg_if_player( m_info, _( "You clear up the %s." ), here.furnname( pos ) );
here.furn_set( pos, furn_str_id::NULL_ID() );

Expand Down Expand Up @@ -6832,7 +6832,7 @@ void forage_activity_actor::finish( player_activity &act, Character &who )
bool next_to_bush = false;
map &here = get_map();
for( const tripoint_bub_ms &pnt : here.points_in_radius( who.pos_bub(), 1 ) ) {
if( here.getglobal( pnt ) == act.placement ) {
if( here.get_abs( pnt ) == act.placement ) {
next_to_bush = true;
break;
}
Expand Down Expand Up @@ -6870,7 +6870,7 @@ void forage_activity_actor::finish( player_activity &act, Character &who )
debugmsg( "Invalid season" );
}

const tripoint_bub_ms bush_pos = here.bub_from_abs( act.placement );
const tripoint_bub_ms bush_pos = here.get_bub( act.placement );
here.ter_set( bush_pos, next_ter );

// Survival gives a bigger boost, and Perception is leveled a bit.
Expand Down Expand Up @@ -7110,7 +7110,7 @@ void mop_activity_actor::finish( player_activity &act, Character &who )
const bool will_mop = one_in( who.is_blind() ? 1 : 3 );
if( will_mop ) {
map &here = get_map();
here.mop_spills( here.bub_from_abs( act.placement ) );
here.mop_spills( here.get_bub( act.placement ) );
}
activity_handlers::resume_for_multi_activities( who );
}
Expand Down Expand Up @@ -7264,7 +7264,7 @@ void unload_loot_activity_actor::do_turn( player_activity &act, Character &you )
placement = src;
coord_set.erase( src );

const tripoint_bub_ms &src_loc = here.bub_from_abs( src );
const tripoint_bub_ms &src_loc = here.get_bub( src );
if( !here.inbounds( src_loc ) ) {
if( !here.inbounds( you.pos_bub() ) ) {
// p is implicitly an NPC that has been moved off the map, so reset the activity
Expand Down Expand Up @@ -7349,7 +7349,7 @@ void unload_loot_activity_actor::do_turn( player_activity &act, Character &you )
}
if( stage == DO ) {
const tripoint_abs_ms src( placement );
const tripoint_bub_ms src_loc = here.bub_from_abs( src );
const tripoint_bub_ms src_loc = here.get_bub( src );

bool is_adjacent_or_closer = square_dist( you.pos_bub(), src_loc ) <= 1;
// before we move any item, check if player is at or
Expand Down Expand Up @@ -8035,7 +8035,7 @@ void pulp_activity_actor::do_turn( player_activity &act, Character &you )

int moves = 0;
for( auto pos_iter = placement.cbegin(); pos_iter != placement.end();/*left - out*/ ) {
const tripoint_bub_ms &pos = here.bub_from_abs( *pos_iter );
const tripoint_bub_ms &pos = here.get_bub( *pos_iter );
map_stack corpse_pile = here.i_at( pos );
for( item &corpse : corpse_pile ) {
if( !corpse.is_corpse() || !corpse.can_revive() ) {
Expand Down
44 changes: 22 additions & 22 deletions src/activity_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,7 @@ void activity_handlers::fill_liquid_do_turn( player_activity *act, Character *yo
// 1. Gather the source item.
vehicle *source_veh = nullptr;
map &here = get_map();
const tripoint_bub_ms source_pos = here.bub_from_abs( act_ref.coords.at( 0 ) );
const tripoint_bub_ms source_pos = here.get_bub( act_ref.coords.at( 0 ) );
map_stack source_stack = here.i_at( source_pos );
map_stack::iterator on_ground;
monster *source_mon = nullptr;
Expand Down Expand Up @@ -1661,7 +1661,7 @@ void activity_handlers::fill_liquid_do_turn( player_activity *act, Character *yo
size_t part;
switch( static_cast<liquid_target_type>( act_ref.values.at( 2 ) ) ) {
case liquid_target_type::VEHICLE: {
const optional_vpart_position vp = here.veh_at( here.bub_from_abs( act_ref.coords.at( 1 ) ) );
const optional_vpart_position vp = here.veh_at( here.get_bub( act_ref.coords.at( 1 ) ) );
if( act_ref.values.size() > 4 && vp ) {
const vpart_reference vpr( vp->vehicle(), act_ref.values[4] );
veh = &vp->vehicle();
Expand All @@ -1686,10 +1686,10 @@ void activity_handlers::fill_liquid_do_turn( player_activity *act, Character *yo
you->pour_into( act_ref.targets.at( 0 ), liquid, true );
break;
case liquid_target_type::MAP:
if( iexamine::has_keg( here.bub_from_abs( act_ref.coords.at( 1 ) ) ) ) {
iexamine::pour_into_keg( here.bub_from_abs( act_ref.coords.at( 1 ) ), liquid );
if( iexamine::has_keg( here.get_bub( act_ref.coords.at( 1 ) ) ) ) {
iexamine::pour_into_keg( here.get_bub( act_ref.coords.at( 1 ) ), liquid );
} else {
here.add_item_or_charges( here.bub_from_abs( act_ref.coords.at( 1 ) ), liquid );
here.add_item_or_charges( here.get_bub( act_ref.coords.at( 1 ) ), liquid );
you->add_msg_if_player( _( "You pour %1$s onto the ground." ), liquid.tname() );
liquid.charges = 0;
}
Expand Down Expand Up @@ -1856,7 +1856,7 @@ void activity_handlers::game_do_turn( player_activity *act, Character *you )

void activity_handlers::pickaxe_do_turn( player_activity *act, Character * )
{
const tripoint_bub_ms &pos = get_map().bub_from_abs( act->placement );
const tripoint_bub_ms &pos = get_map().get_bub( act->placement );
sfx::play_activity_sound( "tool", "pickaxe", sfx::get_heard_volume( pos ) );
// each turn is too much
if( calendar::once_every( 1_minutes ) ) {
Expand All @@ -1868,7 +1868,7 @@ void activity_handlers::pickaxe_do_turn( player_activity *act, Character * )
void activity_handlers::pickaxe_finish( player_activity *act, Character *you )
{
map &here = get_map();
const tripoint_bub_ms pos( here.bub_from_abs( act->placement ) );
const tripoint_bub_ms pos( here.get_bub( act->placement ) );
// Invalidate the activity early to prevent a query from mod_pain()
act->set_to_null();
if( you->is_avatar() ) {
Expand Down Expand Up @@ -1928,14 +1928,14 @@ void activity_handlers::start_fire_finish( player_activity *act, Character *you

you->practice( skill_survival, act->index, 5 );

firestarter_actor::resolve_firestarter_use( you, get_map().bub_from_abs( act->placement ) );
firestarter_actor::resolve_firestarter_use( you, get_map().get_bub( act->placement ) );
act->set_to_null();
}

void activity_handlers::start_fire_do_turn( player_activity *act, Character *you )
{
map &here = get_map();
tripoint_bub_ms where = here.bub_from_abs( act->placement );
tripoint_bub_ms where = here.get_bub( act->placement );
if( !here.is_flammable( where ) ) {
try_fuel_fire( *act, *you, true );
if( !here.is_flammable( where ) ) {
Expand Down Expand Up @@ -2142,7 +2142,7 @@ void activity_handlers::vehicle_finish( player_activity *act, Character *you )
{
map &here = get_map();
//Grab this now, in case the vehicle gets shifted
const optional_vpart_position vp = here.veh_at( here.bub_from_abs( tripoint_abs_ms( act->values[0],
const optional_vpart_position vp = here.veh_at( here.get_bub( tripoint_abs_ms( act->values[0],
act->values[1],
you->posz() ) ) );
veh_interact::complete_vehicle( *you );
Expand Down Expand Up @@ -2397,7 +2397,7 @@ struct weldrig_hack {
}

const map &here = get_map();
const optional_vpart_position vp = here.veh_at( here.bub_from_abs( act.coords[0] ) );
const optional_vpart_position vp = here.veh_at( here.get_bub( act.coords[0] ) );
if( !vp ) {
return false;
}
Expand Down Expand Up @@ -2886,7 +2886,7 @@ void activity_handlers::travel_do_turn( player_activity *act, Character *you )
waypoint = clamp( cur_omt_mid, project_bounds<coords::ms>( next_omt ) );
}
map &here = get_map();
tripoint_bub_ms centre_sub = here.bub_from_abs( waypoint );
tripoint_bub_ms centre_sub = here.get_bub( waypoint );
if( !here.passable( centre_sub ) ) {
tripoint_range<tripoint_bub_ms> candidates = here.points_in_radius( centre_sub, 2 );
for( const tripoint_bub_ms &elem : candidates ) {
Expand Down Expand Up @@ -3300,7 +3300,7 @@ void activity_handlers::operation_finish( player_activity *act, Character *you )
void activity_handlers::plant_seed_finish( player_activity *act, Character *you )
{
map &here = get_map();
tripoint_bub_ms examp = here.bub_from_abs( act->placement );
tripoint_bub_ms examp = here.get_bub( act->placement );
const itype_id seed_id( act->str_values[0] );
std::list<item> used_seed;
if( item::count_by_charges( seed_id ) ) {
Expand Down Expand Up @@ -3334,7 +3334,7 @@ void activity_handlers::plant_seed_finish( player_activity *act, Character *you
void activity_handlers::build_do_turn( player_activity *act, Character *you )
{
map &here = get_map();
partial_con *pc = here.partial_con_at( here.bub_from_abs( act->placement ) );
partial_con *pc = here.partial_con_at( here.get_bub( act->placement ) );
// Maybe the player and the NPC are working on the same construction at the same time
if( !pc ) {
if( you->is_npc() ) {
Expand Down Expand Up @@ -3375,7 +3375,7 @@ void activity_handlers::build_do_turn( player_activity *act, Character *you )
const double current_progress = old_counter * base_total_moves / 10000000.0 +
delta_progress;
you->set_moves( 0 );
pc->id->do_turn_special( here.bub_from_abs( act->placement ), *you );
pc->id->do_turn_special( here.get_bub( act->placement ), *you );
// Current progress as a percent of base_total_moves to 2 decimal places
pc->counter = std::round( current_progress / base_total_moves * 10000000.0 );
pc->counter = std::min( pc->counter, 10000000 );
Expand Down Expand Up @@ -3485,9 +3485,9 @@ void activity_handlers::jackhammer_do_turn( player_activity *act, Character * )
{
map &here = get_map();
sfx::play_activity_sound( "tool", "jackhammer",
sfx::get_heard_volume( here.bub_from_abs( act->placement ) ) );
sfx::get_heard_volume( here.get_bub( act->placement ) ) );
if( calendar::once_every( 1_minutes ) ) {
sounds::sound( here.bub_from_abs( act->placement ), 15, sounds::sound_t::destructive_activity,
sounds::sound( here.get_bub( act->placement ), 15, sounds::sound_t::destructive_activity,
//~ Sound of a jackhammer at work!
_( "TATATATATATATAT!" ) );
}
Expand All @@ -3496,7 +3496,7 @@ void activity_handlers::jackhammer_do_turn( player_activity *act, Character * )
void activity_handlers::jackhammer_finish( player_activity *act, Character *you )
{
map &here = get_map();
const tripoint_bub_ms &pos = here.bub_from_abs( act->placement );
const tripoint_bub_ms &pos = here.get_bub( act->placement );

here.destroy( pos, true );

Expand Down Expand Up @@ -3525,7 +3525,7 @@ static void cleanup_tiles( std::unordered_set<tripoint_abs_ms> &tiles, fn &clean
while( it != tiles.end() ) {
auto current = it++;

const tripoint_bub_ms &tile_loc = here.bub_from_abs( *current );
const tripoint_bub_ms &tile_loc = here.get_bub( *current );

if( cleanup( tile_loc ) ) {
tiles.erase( current );
Expand All @@ -3551,7 +3551,7 @@ static void perform_zone_activity_turn(
get_sorted_tiles_by_distance( abspos, unsorted_tiles );

for( const tripoint_abs_ms &tile : tiles ) {
const tripoint_bub_ms &tile_loc = here.bub_from_abs( tile );
const tripoint_bub_ms &tile_loc = here.get_bub( tile );

std::vector<tripoint_bub_ms> route =
here.route( you->pos_bub(), tile_loc, you->get_pathfinding_settings(),
Expand Down Expand Up @@ -3714,7 +3714,7 @@ void activity_handlers::pull_creature_finish( player_activity *act, Character *y
if( you->is_avatar() ) {
you->as_avatar()->longpull( act->name );
} else {
you->longpull( act->name, get_map().bub_from_abs( act->placement ) );
you->longpull( act->name, get_map().get_bub( act->placement ) );
}
act->set_to_null();
}
Expand Down Expand Up @@ -3830,7 +3830,7 @@ void activity_handlers::spellcasting_finish( player_activity *act, Character *yo

// choose target for spell before continuing
const std::optional<tripoint_bub_ms> target = act->coords.empty() ? spell_being_cast.select_target(
you ) : get_map().bub_from_abs( act->coords.front() );
you ) : get_map().get_bub( act->coords.front() );
if( target ) {
// npcs check for target viability
if( !you->is_npc() || spell_being_cast.is_valid_target( *you, *target ) ) {
Expand Down
Loading
Loading