aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/diplomacy/DiplomaticAction.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/diplomacy/DiplomaticAction.hpp')
-rw-r--r--src/openvic-simulation/diplomacy/DiplomaticAction.hpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/openvic-simulation/diplomacy/DiplomaticAction.hpp b/src/openvic-simulation/diplomacy/DiplomaticAction.hpp
index 8f659c6..352b16e 100644
--- a/src/openvic-simulation/diplomacy/DiplomaticAction.hpp
+++ b/src/openvic-simulation/diplomacy/DiplomaticAction.hpp
@@ -8,17 +8,20 @@
#include <variant>
#include "openvic-simulation/country/Country.hpp"
+#include "openvic-simulation/country/CountryInstance.hpp"
#include "openvic-simulation/types/FunctionRef.hpp"
#include "openvic-simulation/types/IdentifierRegistry.hpp"
namespace OpenVic {
+ struct GameManager;
+
struct DiplomaticActionType {
friend struct DiplomaticActionManager;
friend struct CancelableDiplomaticActionType;
struct Argument {
- Country& sender;
- Country& reciever;
+ CountryInstance* sender;
+ CountryInstance* reciever;
std::any context_data;
};
@@ -68,7 +71,7 @@ namespace OpenVic {
allowed_to_cancel_func allowed_cancel = allowed_to_cancel_default;
operator DiplomaticActionType::Initializer() {
- return {commit, allowed, get_acceptance};
+ return { commit, allowed, get_acceptance };
}
};
@@ -87,7 +90,7 @@ namespace OpenVic {
constexpr DiplomaticActionTypeStorage(std::string_view identifier, T&& t) : HasIdentifier(identifier), base_type(t) {}
template<class Visitor>
- constexpr decltype(auto) visit(Visitor&& vis){
+ constexpr decltype(auto) visit(Visitor&& vis) {
return std::visit(std::forward<Visitor>(vis), *this);
}
@@ -99,7 +102,7 @@ namespace OpenVic {
constexpr bool is_cancelable() const {
return visit([](auto&& arg) -> bool {
using T = std::decay_t<decltype(arg)>;
- if constexpr(std::same_as<T, CancelableDiplomaticActionType>) {
+ if constexpr (std::same_as<T, CancelableDiplomaticActionType>) {
return true;
} else {
return false;
@@ -123,11 +126,14 @@ namespace OpenVic {
DiplomaticActionManager();
bool add_diplomatic_action(std::string_view identifier, DiplomaticActionType::Initializer&& initializer);
- bool add_cancelable_diplomatic_action(std::string_view identifier, CancelableDiplomaticActionType::Initializer&& initializer);
+ bool add_cancelable_diplomatic_action(
+ std::string_view identifier, CancelableDiplomaticActionType::Initializer&& initializer
+ );
- DiplomaticActionTickCache
- create_diplomatic_action_tick(std::string_view identifier, Country& sender, Country& reciever, std::any context_data);
+ DiplomaticActionTickCache create_diplomatic_action_tick(
+ std::string_view identifier, CountryInstance* sender, CountryInstance* reciever, std::any context_data
+ );
- bool setup_diplomatic_actions();
+ bool setup_diplomatic_actions(GameManager& manager);
};
}