diff options
author | Hop311 <Hop3114@gmail.com> | 2024-06-13 18:59:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-13 18:59:47 +0200 |
commit | bfd539513af435564daf70f94f6cce146dd5c948 (patch) | |
tree | 7ba5a06714c267185dd3a59aabc6556a105c122f /src/openvic-simulation/diplomacy/DiplomaticAction.hpp | |
parent | 01a8f60aaca9784d814f4cb35a3fc4be86e1dd20 (diff) | |
parent | 4b39e77304094708d5c503b6a221386408cc4409 (diff) |
Merge pull request #165 from OpenVicProject/instance-definition-managers
Separated GameManager into Definition and Instance Managers
Diffstat (limited to 'src/openvic-simulation/diplomacy/DiplomaticAction.hpp')
-rw-r--r-- | src/openvic-simulation/diplomacy/DiplomaticAction.hpp | 23 |
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(); }; } |