From d34075e3cf78474a0203d3aedcb4df63f1159d46 Mon Sep 17 00:00:00 2001 From: zaaarf Date: Sun, 24 Sep 2023 22:03:24 +0200 Subject: fix: fixed multiple compile-time warnings --- src/openvic-simulation/Modifier.cpp | 18 +++++++++++------- src/openvic-simulation/Modifier.hpp | 2 ++ src/openvic-simulation/types/IdentifierRegistry.hpp | 1 + src/openvic-simulation/types/Vector.cpp | 6 ------ src/openvic-simulation/types/Vector.hpp | 15 ++++++++++----- 5 files changed, 24 insertions(+), 18 deletions(-) (limited to 'src/openvic-simulation') diff --git a/src/openvic-simulation/Modifier.cpp b/src/openvic-simulation/Modifier.cpp index 46bba48..7871692 100644 --- a/src/openvic-simulation/Modifier.cpp +++ b/src/openvic-simulation/Modifier.cpp @@ -71,13 +71,6 @@ ModifierValue ModifierValue::operator-(ModifierValue const& right) const { return ret -= right; } -std::ostream& OpenVic::operator<<(std::ostream& stream, ModifierValue const& value) { - for (ModifierValue::effect_map_t::value_type const& effect : value.values) { - stream << effect.first << ": " << effect.second << "\n"; - } - return stream; -} - Modifier::Modifier(const std::string_view new_identifier, ModifierValue&& new_values, icon_t new_icon) : HasIdentifier { new_identifier }, ModifierValue { std::move(new_values) }, icon { new_icon } {} @@ -85,6 +78,8 @@ Modifier::icon_t Modifier::get_icon() const { return icon; } +ModifierInstance::ModifierInstance(Modifier const& modifier, Date expiry_date) : modifier { modifier }, expiry_date { expiry_date } {} + Modifier const& ModifierInstance::get_modifier() const { return modifier; } @@ -135,3 +130,12 @@ node_callback_t ModifierManager::expect_modifier_value(callback_t callback) { diff --git a/src/openvic-simulation/types/Vector.cpp b/src/openvic-simulation/types/Vector.cpp index 1c9d2f4..aa44710 100644 --- a/src/openvic-simulation/types/Vector.cpp +++ b/src/openvic-simulation/types/Vector.cpp @@ -1,13 +1,7 @@ #include "Vector.hpp" -#include -#include - using namespace OpenVic; -template -constexpr vec2_t::vec2_t() = default; - template constexpr vec2_t::vec2_t(T new_val) : x { new_val }, y { new_val } {} diff --git a/src/openvic-simulation/types/Vector.hpp b/src/openvic-simulation/types/Vector.hpp index 66f8d2b..eecd738 100644 --- a/src/openvic-simulation/types/Vector.hpp +++ b/src/openvic-simulation/types/Vector.hpp @@ -8,7 +8,7 @@ namespace OpenVic { struct vec2_t { T x, y; - constexpr vec2_t(); + constexpr vec2_t() = default; constexpr vec2_t(T new_val); constexpr vec2_t(T new_x, T new_y); @@ -21,14 +21,19 @@ namespace OpenVic { constexpr T& operator[](size_t index); constexpr T const& operator[](size_t index) const; - constexpr friend vec2_t operator+(vec2_t const& left, vec2_t const& right); + template + constexpr friend vec2_t operator+(vec2_t const& left, vec2_t const& right); constexpr vec2_t& operator+=(vec2_t const& right); - constexpr friend vec2_t operator-(vec2_t const& arg); - constexpr friend vec2_t operator-(vec2_t const& left, vec2_t const& right); + template + constexpr friend vec2_t operator-(vec2_t const& arg); + + template + constexpr friend vec2_t operator-(vec2_t const& left, vec2_t const& right); constexpr vec2_t& operator-=(vec2_t const& right); - constexpr friend std::ostream& operator<<(std::ostream& stream, vec2_t const& value); + template + constexpr friend std::ostream& operator<<(std::ostream& stream, vec2_t const& value); }; using ivec2_t = vec2_t; -- cgit v1.2.3-56-ga3b1