diff --git a/src/iexamine_elevator.cpp b/src/iexamine_elevator.cpp index 7a01baa94c14..2e24e96f655f 100644 --- a/src/iexamine_elevator.cpp +++ b/src/iexamine_elevator.cpp @@ -19,7 +19,8 @@ namespace /// poor person's https://en.cppreference.com/w/cpp/utility/optional/and_then template -auto and_then( std::optional const &opt, Fn &&f ) -> std::optional> +inline auto and_then( std::optional const &opt, Fn &&f ) +-> std::optional> { if( opt ) { return std::optional{f( *opt )}; @@ -29,7 +30,7 @@ auto and_then( std::optional const &opt, Fn &&f ) -> std::optional void +inline auto move_item( map &here, const tripoint &src, const tripoint &dest ) -> void { map_stack items = here.i_at( src ); for( auto it = items.begin(); it != items.end(); ) { @@ -43,7 +44,7 @@ namespace elevator using tiles = std::vector; -auto here( const Character &you ) -> elevator::tiles +inline auto here( const Character &you ) -> elevator::tiles { const auto &here = get_map(); const auto &points = closest_points_first( you.pos(), SEEX - 1 ); @@ -57,10 +58,10 @@ auto here( const Character &you ) -> elevator::tiles return tiles; } -auto dest( const elevator::tiles &elevator_here, - const tripoint &sm_orig, - int turns, - int movez ) -> elevator::tiles +inline auto dest( const elevator::tiles &elevator_here, + const tripoint &sm_orig, + int turns, + int movez ) -> elevator::tiles { elevator::tiles tiles; std::transform( elevator_here.begin(), elevator_here.end(), std::back_inserter( tiles ), @@ -73,7 +74,7 @@ auto dest( const elevator::tiles &elevator_here, /// allow using misaligned elevators. /// doesn't prevent you being stuck in the wall tho cause i was lazy -auto find_elevators_nearby( const tripoint &pos ) -> std::optional +inline auto find_elevators_nearby( const tripoint &pos ) -> std::optional { constexpr int max_misalign = 3; map &here = get_map(); @@ -86,8 +87,8 @@ auto find_elevators_nearby( const tripoint &pos ) -> std::optional return {}; } -auto choose_floor( const tripoint &examp, const tripoint_abs_omt &this_omt, - const tripoint &sm_orig ) -> int +inline auto choose_floor( const tripoint &examp, const tripoint_abs_omt &this_omt, + const tripoint &sm_orig ) -> int { constexpr int retval_offset = 10000; // workaround for uilist retval autoassign when retval == -1 const auto this_floor = _( " (this floor)" ); @@ -115,7 +116,8 @@ auto choose_floor( const tripoint &examp, const tripoint_abs_omt &this_omt, enum class overlap_status { outside, inside, overlap }; -auto vehicle_status( const wrapped_vehicle &veh, const elevator::tiles &tiles ) -> overlap_status +inline auto vehicle_status( const wrapped_vehicle &veh, + const elevator::tiles &tiles ) -> overlap_status { const auto &ps = veh.v->get_all_parts(); const int all_vparts_count = ps.part_count(); @@ -139,7 +141,7 @@ struct elevator_vehicles { std::vector v; }; -auto vehicles_on( const elevator::tiles &tiles ) -> elevator_vehicles +inline auto vehicles_on( const elevator::tiles &tiles ) -> elevator_vehicles { const VehicleList vehs = get_map().get_vehicles(); std::vector ret; @@ -156,13 +158,13 @@ auto vehicles_on( const elevator::tiles &tiles ) -> elevator_vehicles return { false, ret }; } -auto warn_blocking( const elevator_vehicles &vehs, std::string_view location ) -> void +inline auto warn_blocking( const elevator_vehicles &vehs, std::string_view location ) -> void { const auto &first_veh_name = vehs.v.front()->name; popup( string_format( _( "%1$s %2$s is blocking the elevator." ), first_veh_name, location ) ); } -auto move_creatures_away( const elevator::tiles &dest ) -> void +inline auto move_creatures_away( const elevator::tiles &dest ) -> void { map &here = get_map(); @@ -189,7 +191,8 @@ auto move_creatures_away( const elevator::tiles &dest ) -> void } } -auto move_items( const elevator::tiles from, const elevator::tiles dest ) -> void +// NOLINTNEXTLINE(bugprone-easily-swappable-parameters) +inline auto move_items( const elevator::tiles from, const elevator::tiles dest ) -> void { map &here = get_map(); @@ -199,7 +202,7 @@ auto move_items( const elevator::tiles from, const elevator::tiles dest ) -> voi } } -auto move_creatures( const elevator::tiles from, const elevator::tiles dest ) -> void +inline auto move_creatures( const elevator::tiles from, const elevator::tiles dest ) -> void { for( Creature &critter : g->all_creatures() ) { const auto eit = std::find( from.cbegin(), from.cend(), critter.pos() ); @@ -209,8 +212,8 @@ auto move_creatures( const elevator::tiles from, const elevator::tiles dest ) -> } } -auto move_vehicles( const elevator_vehicles &vehs, const tripoint &sm_orig, int movez, - int turns ) -> void +inline auto move_vehicles( const elevator_vehicles &vehs, const tripoint &sm_orig, int movez, + int turns ) -> void { map &here = get_map(); @@ -224,7 +227,7 @@ auto move_vehicles( const elevator_vehicles &vehs, const tripoint &sm_orig, int here.reset_vehicle_cache(); } -auto move_player( player &p, const int movez, tripoint_abs_ms old_abs_pos ) -> void +inline auto move_player( player &p, const int movez, tripoint_abs_ms old_abs_pos ) -> void { map &here = get_map();