diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index 1ab05183d41c0..506bc1952fdaf 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -409,14 +409,6 @@ static void set_up_butchery( player_activity &act, player &u, butcher_type actio } } - bool has_table_nearby = false; - for( const tripoint &pt : g->m.points_in_radius( u.pos(), 2 ) ) { - if( g->m.has_flag_furn( flag_FLAT_SURF, pt ) || g->m.has_flag( flag_FLAT_SURF, pt ) || - ( ( g->m.veh_at( pt ) && ( g->m.veh_at( pt )->vehicle().has_part( flag_KITCHEN ) || - g->m.veh_at( pt )->vehicle().has_part( flag_FLAT_SURF ) ) ) ) ) { - has_table_nearby = true; - } - } bool has_tree_nearby = false; for( const tripoint &pt : g->m.points_in_radius( u.pos(), 2 ) ) { if( g->m.has_flag( flag_TREE, pt ) ) { @@ -448,7 +440,7 @@ static void set_up_butchery( player_activity &act, player &u, butcher_type actio act.targets.pop_back(); return; } - if( !has_table_nearby ) { + if( !g->m.has_nearby_table( u.pos(), 2 ) ) { u.add_msg_if_player( m_info, _( "To perform a full butchery on a corpse this big, you need a table nearby or something else with a flat surface. A leather tarp spread out on the ground could suffice." ) ); act.targets.pop_back(); diff --git a/src/activity_item_handling.cpp b/src/activity_item_handling.cpp index 840b8a65ebdb6..42bbd87860690 100644 --- a/src/activity_item_handling.cpp +++ b/src/activity_item_handling.cpp @@ -1425,14 +1425,6 @@ static activity_reason_info can_do_activity_there( const activity_id &act, playe corpses.push_back( i ); } } - bool has_table_nearby = false; - for( const tripoint &pt : g->m.points_in_radius( src_loc, 2 ) ) { - if( g->m.has_flag_furn( flag_FLAT_SURF, pt ) || g->m.has_flag( flag_FLAT_SURF, pt ) || - ( ( g->m.veh_at( pt ) && ( g->m.veh_at( pt )->vehicle().has_part( flag_KITCHEN ) || - g->m.veh_at( pt )->vehicle().has_part( flag_FLAT_SURF ) ) ) ) ) { - has_table_nearby = true; - } - } bool b_rack_present = false; for( const tripoint &pt : g->m.points_in_radius( src_loc, 2 ) ) { if( g->m.has_flag_furn( flag_BUTCHER_EQ, pt ) ) { @@ -1441,7 +1433,7 @@ static activity_reason_info can_do_activity_there( const activity_id &act, playe } if( !corpses.empty() ) { if( big_count > 0 && small_count == 0 ) { - if( !has_table_nearby || !b_rack_present ) { + if( !b_rack_present || !g->m.has_nearby_table( src_loc, 2 ) ) { return activity_reason_info::fail( NO_ZONE ); } if( p.has_quality( quality_id( qual_BUTCHER ), 1 ) && ( p.has_quality( qual_SAW_W ) || diff --git a/src/consumption.cpp b/src/consumption.cpp index 86c2b2a840105..a05d41ad5cd91 100644 --- a/src/consumption.cpp +++ b/src/consumption.cpp @@ -840,20 +840,14 @@ bool player::eat( item &food, bool force ) add_msg_player_or_npc( _( "You eat your %s." ), _( " eats a %s." ), food.tname() ); if( !spoiled && !food.has_flag( flag_ALLERGEN_JUNK ) ) { - bool has_table_nearby = false; bool has_chair_nearby = false; for( const tripoint &pt : g->m.points_in_radius( pos(), 1 ) ) { - if( g->m.has_flag_furn( flag_FLAT_SURF, pt ) || g->m.has_flag( flag_FLAT_SURF, pt ) || - ( g->m.veh_at( pt ) && ( g->m.veh_at( pt )->vehicle().has_part( "KITCHEN" ) || - g->m.veh_at( pt )->vehicle().has_part( "FLAT_SURF" ) ) ) ) { - has_table_nearby = true; - } if( g->m.has_flag_furn( flag_CAN_SIT, pt ) || g->m.has_flag( flag_CAN_SIT, pt ) || ( g->m.veh_at( pt ) && ( g->m.veh_at( pt )->vehicle().has_part( "SEAT" ) ) ) ) { has_chair_nearby = true; } } - if( has_chair_nearby && has_table_nearby ) { + if( has_chair_nearby && g->m.has_nearby_table( pos(), 1 ) ) { if( has_trait( trait_TABLEMANNERS ) ) { rem_morale( MORALE_ATE_WITHOUT_TABLE ); add_morale( MORALE_ATE_WITH_TABLE, 3, 3, 3_hours, 2_hours, true ); diff --git a/src/map.cpp b/src/map.cpp index 30c10559c0fef..52b95ecacddd5 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -2598,6 +2598,7 @@ bool map::has_nearby_table( const tripoint &p, int radius ) return true; } } + return false; } bool map::mop_spills( const tripoint &p )