diff options
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(); }; } |