From f12bfe22bdf910c8cfed669323479013669e7678 Mon Sep 17 00:00:00 2001 From: CLIDragon <84266961+CLIDragon@users.noreply.github.com> Date: Fri, 30 Aug 2024 12:19:21 +1000 Subject: [PATCH] Remove inline of function. --- src/point.cpp | 16 ++++++++++++++++ src/point.h | 16 +--------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/point.cpp b/src/point.cpp index bb5b47facc40c..efed6bcd75332 100644 --- a/src/point.cpp +++ b/src/point.cpp @@ -117,6 +117,22 @@ std::istream &operator>>( std::istream &is, tripoint &pos ) return is; } +std::optional rectangle_size( int min_dist, int max_dist ) +{ + min_dist = std::max( min_dist, 0 ); + max_dist = std::max( max_dist, 0 ); + + if( min_dist > max_dist ) { + return std::nullopt; + } + + const int min_edge = min_dist * 2 + 1; + const int max_edge = max_dist * 2 + 1; + + const int n = max_edge * max_edge - ( min_edge - 2 ) * ( min_edge - 2 ) + ( min_dist == 0 ? 1 : 0 ); + return n; +} + std::vector closest_points_first( const tripoint ¢er, int max_dist ) { return closest_points_first( center, 0, max_dist ); diff --git a/src/point.h b/src/point.h index ad0fbd916c45e..94e1ca831c8b1 100644 --- a/src/point.h +++ b/src/point.h @@ -301,21 +301,7 @@ std::optional find_point_closest_first( const Point ¢er, int max_dist // Calculate the number of tiles in a square from min_dist to max_dist about an arbitrary centre. -inline std::optional rectangle_size( int min_dist, int max_dist ) -{ - min_dist = std::max( min_dist, 0 ); - max_dist = std::max( max_dist, 0 ); - - if( min_dist > max_dist ) { - return std::nullopt; - } - - const int min_edge = min_dist * 2 + 1; - const int max_edge = max_dist * 2 + 1; - - const int n = max_edge * max_edge - ( min_edge - 2 ) * ( min_edge - 2 ) + ( min_dist == 0 ? 1 : 0 ); - return n; -}; +std::optional rectangle_size( int min_dist, int max_dist ); inline constexpr tripoint tripoint_min { INT_MIN, INT_MIN, INT_MIN }; inline constexpr tripoint tripoint_max{ INT_MAX, INT_MAX, INT_MAX };