diff options
| -rw-r--r-- | core/include/turns/core/participant.hpp | 6 | ||||
| -rw-r--r-- | core/src/participant.cpp | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/core/include/turns/core/participant.hpp b/core/include/turns/core/participant.hpp index cd99fbb..a58e198 100644 --- a/core/include/turns/core/participant.hpp +++ b/core/include/turns/core/participant.hpp @@ -24,6 +24,11 @@ namespace turns::core auto operator<=>(participant const & other) const noexcept -> std::partial_ordering; + auto defeated(this auto && self) + { + return self.m_defeated.get_proxy(); + } + template<typename Self> auto disposition(this Self && self) { @@ -51,6 +56,7 @@ namespace turns::core auto serialize() -> nlohmann::json; private: + Glib::Property<bool> m_defeated{*this, "defeated", false}; Glib::Property<core::disposition> m_disposition{*this, "disposition", core::disposition::neutral}; Glib::Property<bool> m_is_active{*this, "active", false}; Glib::Property<Glib::ustring> m_name{*this, "name", ""}; diff --git a/core/src/participant.cpp b/core/src/participant.cpp index 63df96e..3aadc80 100644 --- a/core/src/participant.cpp +++ b/core/src/participant.cpp @@ -27,8 +27,10 @@ namespace turns::core auto disposition = serialized.value("disposition", disposition::neutral); auto priority = serialized.value("priority", 0.0f); auto name = serialized.value("name", std::string{}); + auto defeated = serialized.value("defeated", false); auto instance = create(name, priority, disposition); + instance->defeated() = defeated; instance->is_active() = active; return instance; @@ -57,6 +59,7 @@ namespace turns::core { return nlohmann::json{ {"active", m_is_active }, + {"defeated", m_defeated }, {"disposition", m_disposition}, {"name", m_name }, {"priority", m_priority }, |
