From 9513f7303ffde9fbda869e346523a23197f4ece9 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Tue, 13 May 2025 15:59:02 +0200 Subject: lib: begin TurnOrder implementation --- core/include/turns/core/disposition.hpp | 39 ---------------- core/include/turns/core/fwd.hpp | 14 ------ core/include/turns/core/init.hpp | 11 ----- core/include/turns/core/participant.hpp | 82 --------------------------------- 4 files changed, 146 deletions(-) delete mode 100644 core/include/turns/core/disposition.hpp delete mode 100644 core/include/turns/core/fwd.hpp delete mode 100644 core/include/turns/core/init.hpp delete mode 100644 core/include/turns/core/participant.hpp (limited to 'core/include') diff --git a/core/include/turns/core/disposition.hpp b/core/include/turns/core/disposition.hpp deleted file mode 100644 index cd00836..0000000 --- a/core/include/turns/core/disposition.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef TURNS_CORE_DISPOSITION_HPP -#define TURNS_CORE_DISPOSITION_HPP - -#include -#include - -#include - -#include - -namespace turns::core -{ - enum struct Disposition : std::uint8_t - { - Neutral, - Friendly, - Hostile, - Secret, - - ///! End marker - END - }; - - auto presentation_name_for(Disposition value) -> Glib::ustring; -} // namespace turns::core - -namespace Glib -{ - template<> - class Value : public Glib::Value_Enum - { - GType static constinit inline gtype_{}; - - public: - auto static value_type() -> GType; - }; -} // namespace Glib - -#endif \ No newline at end of file diff --git a/core/include/turns/core/fwd.hpp b/core/include/turns/core/fwd.hpp deleted file mode 100644 index c006084..0000000 --- a/core/include/turns/core/fwd.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef TURNS_CORE_FWD_HPP -#define TURNS_CORE_FWD_HPP - -#include - -namespace turns::core -{ - enum struct Disposition : std::uint8_t; - - struct Participant; - struct TurnOderModel; -} // namespace turns::core - -#endif \ No newline at end of file diff --git a/core/include/turns/core/init.hpp b/core/include/turns/core/init.hpp deleted file mode 100644 index f0dc70e..0000000 --- a/core/include/turns/core/init.hpp +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef TURNS_CORE_INIT_HPP -#define TURNS_CORE_INIT_HPP - -namespace turns::core -{ - - auto register_types() -> void; - -} // namespace turns::core - -#endif \ No newline at end of file diff --git a/core/include/turns/core/participant.hpp b/core/include/turns/core/participant.hpp deleted file mode 100644 index e6d9008..0000000 --- a/core/include/turns/core/participant.hpp +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef TURNS_CORE_PARTICIPANT_HPP -#define TURNS_CORE_PARTICIPANT_HPP - -#include "turns/core/disposition.hpp" - -#include -#include -#include -#include - -#include - -#include - -namespace turns::core -{ - struct Participant : Glib::Object - { - auto static create(Glib::ustring name, float priority, Disposition disposition) -> Glib::RefPtr; - auto static create(nlohmann::json const & serialized) -> Glib::RefPtr; - - Participant(); - Participant(Glib::ustring name, float priority, Disposition disposition); - - auto operator<=>(Participant const & other) const noexcept -> std::partial_ordering; - - [[nodiscard]] auto get_disposition() const -> Disposition; - [[nodiscard]] auto get_is_active() const -> bool; - [[nodiscard]] auto get_is_defeated() const -> bool; - [[nodiscard]] auto get_name() const -> Glib::ustring; - [[nodiscard]] auto get_priority() const -> float; - - auto set_disposition(Disposition value) -> void; - auto set_is_active(bool value) -> void; - auto set_is_defeated(bool value) -> void; - auto set_name(Glib::ustring const & value) -> void; - auto set_priority(float value) -> void; - - [[nodiscard]] auto property_disposition(this auto && self); - [[nodiscard]] auto property_is_active(this auto && self); - [[nodiscard]] auto property_is_defeated(this auto && self); - [[nodiscard]] auto property_name(this auto && self); - [[nodiscard]] auto property_priority(this auto && self); - - auto serialize() -> nlohmann::json; - - private: - Glib::Property m_disposition{*this, "disposition", core::Disposition::Neutral}; - Glib::Property m_is_active{*this, "is-active", false}; - Glib::Property m_is_defeated{*this, "is-defeated", false}; - Glib::Property m_name{*this, "name", ""}; - Glib::Property m_priority{*this, "priority", 0.0f}; - }; - - auto Participant::property_disposition(this auto && self) - { - return self.m_disposition.get_proxy(); - } - - auto Participant::property_is_active(this auto && self) - { - return self.m_is_active.get_proxy(); - } - - auto Participant::property_is_defeated(this auto && self) - { - return self.m_is_defeated.get_proxy(); - } - - auto Participant::property_name(this auto && self) - { - return self.m_name.get_proxy(); - } - - auto Participant::property_priority(this auto && self) - { - return self.m_priority.get_proxy(); - } - -} // namespace turns::core - -#endif \ No newline at end of file -- cgit v1.2.3