aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/diplomacy/DiplomaticAction.hpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-06-13 00:24:00 +0200
committer hop311 <hop3114@gmail.com>2024-06-13 00:24:00 +0200
commit4b39e77304094708d5c503b6a221386408cc4409 (patch)
tree7ba5a06714c267185dd3a59aabc6556a105c122f /src/openvic-simulation/diplomacy/DiplomaticAction.hpp
parentc0ba822ee46551a40ad6b43e8f56b80e27ae35b5 (diff)
Separated GameManager into Definition and Instance Managersinstance-definition-managers
Diffstat (limited to 'src/openvic-simulation/diplomacy/DiplomaticAction.hpp')
-rw-r--r--src/openvic-simulation/diplomacy/DiplomaticAction.hpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/openvic-simulation/diplomacy/DiplomaticAction.hpp b/src/openvic-simulation/diplomacy/DiplomaticAction.hpp
index 352b16e..cf93c75 100644
--- a/src/openvic-simulation/diplomacy/DiplomaticAction.hpp
+++ b/src/openvic-simulation/diplomacy/DiplomaticAction.hpp
@@ -7,33 +7,33 @@
#include <type_traits>
#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 InstanceManager;
struct DiplomaticActionType {
friend struct DiplomaticActionManager;
friend struct CancelableDiplomaticActionType;
struct Argument {
+ InstanceManager& instance_manager;
CountryInstance* sender;
CountryInstance* reciever;
std::any context_data;
};
- using allowed_to_commit_func = FunctionRef<bool(const Argument&)>;
- using get_acceptance_func = FunctionRef<std::int32_t(const Argument&)>;
+ using allowed_to_commit_func = FunctionRef<bool(Argument const&)>;
+ using get_acceptance_func = FunctionRef<std::int32_t(Argument const&)>;
using commit_action_func = FunctionRef<void(Argument&)>;
- static bool allowed_to_commit_default(const Argument& argument) {
+ static bool allowed_to_commit_default(Argument const& argument) {
return true;
}
- static std::int32_t get_acceptance_default(const Argument& argument) {
+ static std::int32_t get_acceptance_default(Argument const& argument) {
return 1;
}
@@ -58,9 +58,9 @@ namespace OpenVic {
struct CancelableDiplomaticActionType : DiplomaticActionType {
friend struct DiplomaticActionManager;
- using allowed_to_cancel_func = FunctionRef<bool(const Argument&)>;
+ using allowed_to_cancel_func = FunctionRef<bool(Argument const&)>;
- static bool allowed_to_cancel_default(const Argument& argument) {
+ static bool allowed_to_cancel_default(Argument const& argument) {
return true;
}
@@ -113,7 +113,7 @@ namespace OpenVic {
struct DiplomaticActionTickCache {
DiplomaticActionType::Argument argument;
- const DiplomaticActionTypeStorage* type;
+ DiplomaticActionTypeStorage const* type;
bool allowed_to_commit;
std::int32_t acceptance = -1;
};
@@ -131,9 +131,10 @@ namespace OpenVic {
);
DiplomaticActionTickCache create_diplomatic_action_tick(
- std::string_view identifier, CountryInstance* sender, CountryInstance* reciever, std::any context_data
+ std::string_view identifier, CountryInstance* sender, CountryInstance* reciever, std::any context_data,
+ InstanceManager& instance_manager
);
- bool setup_diplomatic_actions(GameManager& manager);
+ bool setup_diplomatic_actions();
};
}