aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-09-24 22:03:24 +0200
committer zaaarf <zaaarf@proton.me>2023-09-24 22:03:24 +0200
commitd34075e3cf78474a0203d3aedcb4df63f1159d46 (patch)
treeb8d1342ba6d9fa3f68221844618da932b5933629 /src
parent5b0a02a1bd8caad21caa7d000173270d31df4201 (diff)
fix: fixed multiple compile-time warnings
Diffstat (limited to 'src')
-rw-r--r--src/openvic-simulation/Modifier.cpp18
-rw-r--r--src/openvic-simulation/Modifier.hpp2
-rw-r--r--src/openvic-simulation/types/IdentifierRegistry.hpp1
-rw-r--r--src/openvic-simulation/types/Vector.cpp6
-rw-r--r--src/openvic-simulation/types/Vector.hpp15
5 files changed, 24 insertions, 18 deletions
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<ModifierValue&
return ret;
};
}
+
+namespace OpenVic { //so the compiler shuts up
+ std::ostream& 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;
+ }
+} \ No newline at end of file
diff --git a/src/openvic-simulation/Modifier.hpp b/src/openvic-simulation/Modifier.hpp
index a5213eb..6db2c0c 100644
--- a/src/openvic-simulation/Modifier.hpp
+++ b/src/openvic-simulation/Modifier.hpp
@@ -76,6 +76,8 @@ namespace OpenVic {
Modifier const& modifier;
Date expiry_date;
+ ModifierInstance(Modifier const& modifier, Date expiry_date);
+
public:
Modifier const& get_modifier() const;
Date const& get_expiry_date() const;
diff --git a/src/openvic-simulation/types/IdentifierRegistry.hpp b/src/openvic-simulation/types/IdentifierRegistry.hpp
index 414c96d..7b61cf8 100644
--- a/src/openvic-simulation/types/IdentifierRegistry.hpp
+++ b/src/openvic-simulation/types/IdentifierRegistry.hpp
@@ -177,6 +177,7 @@ namespace OpenVic {
for (identifier_index_map_t::value_type const& entry : identifier_index_map) {
identifiers.push_back(entry.first);
}
+ return identifiers;
}
NodeTools::node_callback_t expect_item_identifier(NodeTools::callback_t<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,14 +1,8 @@
#include "Vector.hpp"
-#include <ostream>
-#include <tuple>
-
using namespace OpenVic;
template<typename T>
-constexpr vec2_t<T>::vec2_t() = default;
-
-template<typename T>
constexpr vec2_t<T>::vec2_t(T new_val) : x { new_val }, y { new_val } {}
template<typename T>
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 <typename S>
+ constexpr friend vec2_t<S> operator+(vec2_t<S> const& left, vec2_t<S> 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 <typename S>
+ constexpr friend vec2_t<S> operator-(vec2_t<S> const& arg);
+
+ template <typename S>
+ constexpr friend vec2_t<S> operator-(vec2_t<S> const& left, vec2_t<S> const& right);
constexpr vec2_t& operator-=(vec2_t const& right);
- constexpr friend std::ostream& operator<<(std::ostream& stream, vec2_t const& value);
+ template <typename S>
+ constexpr friend std::ostream& operator<<(std::ostream& stream, vec2_t<S> const& value);
};
using ivec2_t = vec2_t<int64_t>;