From 0c2134a645df34e05cd69bc084506c58694eb697 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Sat, 23 Jan 2021 23:46:20 +1100 Subject: [PATCH] Further boost cleanup * Removed more unnecessary includes * Used std::swap instead of boost::swap in fake_unit_ptr. This is since unit_ptr (the type of `unit_` here) is now just a shared_ptr instead of a boost::intrusive_ptr. * Used std::gcd instead of boost::integer::gcd --- src/chat_events.cpp | 2 -- src/config_attribute_value.hpp | 3 --- src/fake_unit_ptr.cpp | 4 +--- src/gui/dialogs/preferences_dialog.cpp | 14 ++------------ src/gui/widgets/slider.cpp | 21 ++++----------------- src/log.cpp | 3 +-- src/team.cpp | 2 -- 7 files changed, 8 insertions(+), 41 deletions(-) diff --git a/src/chat_events.cpp b/src/chat_events.cpp index e92de7fc4e1..dc4becfb01d 100644 --- a/src/chat_events.cpp +++ b/src/chat_events.cpp @@ -22,8 +22,6 @@ #include "preferences/general.hpp" #include "preferences/game.hpp" -#include - static lg::log_domain log_engine("engine"); #define ERR_NG LOG_STREAM(err, log_engine) #define LOG_NG LOG_STREAM(info, log_engine) diff --git a/src/config_attribute_value.hpp b/src/config_attribute_value.hpp index ee012b3ed82..98aeeb47344 100644 --- a/src/config_attribute_value.hpp +++ b/src/config_attribute_value.hpp @@ -41,9 +41,6 @@ #include #include -#include -#include - class enum_tag; /** diff --git a/src/fake_unit_ptr.cpp b/src/fake_unit_ptr.cpp index 401fc9043c8..4d321ae6913 100644 --- a/src/fake_unit_ptr.cpp +++ b/src/fake_unit_ptr.cpp @@ -19,8 +19,6 @@ #include "units/unit.hpp" #include "units/ptr.hpp" -#include - fake_unit_ptr::fake_unit_ptr() : unit_(), my_manager_(nullptr) {} fake_unit_ptr::fake_unit_ptr(const internal_ptr & u) : unit_(u), my_manager_(nullptr) {} fake_unit_ptr::fake_unit_ptr(const internal_ptr & u, fake_unit_manager * mgr) : unit_(u), my_manager_(nullptr) @@ -40,7 +38,7 @@ fake_unit_ptr::fake_unit_ptr(fake_unit_ptr && ptr) } void fake_unit_ptr::swap (fake_unit_ptr & o) { - boost::swap(unit_, o.unit_); + std::swap(unit_, o.unit_); std::swap(my_manager_, o.my_manager_); } diff --git a/src/gui/dialogs/preferences_dialog.cpp b/src/gui/dialogs/preferences_dialog.cpp index cc3aa2832cf..a5cae212846 100644 --- a/src/gui/dialogs/preferences_dialog.cpp +++ b/src/gui/dialogs/preferences_dialog.cpp @@ -57,13 +57,8 @@ #include "gui/widgets/toggle_button.hpp" #include "gui/widgets/window.hpp" -#if BOOST_VERSION >= 106700 -#include -#else -#include -#endif - #include +#include namespace gui2 { @@ -142,12 +137,7 @@ void preferences_dialog::set_resolution_list(menu_button& res_list) config option; option["label"] = formatter() << res.x << font::unicode_multiplication_sign << res.y; -#if BOOST_VERSION >= 106700 - const int div = boost::integer::gcd(res.x, res.y); -#else - const int div = boost::math::gcd(res.x, res.y); -#endif - + const int div = std::gcd(12, 4); const int x_ratio = res.x / div; const int y_ratio = res.y / div; diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index 858573fd6ac..6b7289b1d51 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -29,12 +29,7 @@ #include "wml_exception.hpp" #include - -#if BOOST_VERSION >= 106700 -#include -#else -#include -#endif +#include #define LOG_SCOPE_HEADER get_control_type() + " [" + id() + "] " + __func__ #define LOG_HEADER LOG_SCOPE_HEADER + ':' @@ -265,12 +260,7 @@ void slider::set_value_range(int min_value, int max_value) int diff = max_value - min_value; int old_value = get_value(); -#if BOOST_VERSION >= 106700 - step_size_ = boost::integer::gcd(diff, step_size_); -#else - step_size_ = boost::math::gcd(diff, step_size_); -#endif - + step_size_ = std::gcd(diff, step_size_); minimum_value_ = min_value; slider_set_item_last(diff / step_size_); @@ -289,11 +279,8 @@ void slider::set_step_size(int step_size) const int range_diff = get_item_count() - 1; const int old_value = get_value(); -#if BOOST_VERSION >= 106700 - step_size_ = boost::integer::gcd(range_diff, step_size); -#else - step_size_ = boost::math::gcd(range_diff, step_size); -#endif + step_size_ = std::gcd(range_diff, step_size); + slider_set_item_last(range_diff / step_size_); set_value(old_value); diff --git a/src/log.cpp b/src/log.cpp index 8a071ed87c8..1b5216ae3fd 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -21,12 +21,11 @@ #include "log.hpp" -#include - #include #include #include #include +#include namespace { diff --git a/src/team.cpp b/src/team.cpp index 086301990eb..508090b743c 100644 --- a/src/team.cpp +++ b/src/team.cpp @@ -35,8 +35,6 @@ #include "units/types.hpp" #include "whiteboard/side_actions.hpp" -#include - static lg::log_domain log_engine("engine"); #define DBG_NG LOG_STREAM(debug, log_engine) #define LOG_NG LOG_STREAM(info, log_engine)