From 82507e642afd510d59a35766008f742dcce77ccf Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Tue, 21 May 2024 04:06:16 -0700 Subject: [PATCH] add erase var helper for entity --- dGame/Entity.cpp | 9 +++++++++ dGame/Entity.h | 1 + 2 files changed, 10 insertions(+) diff --git a/dGame/Entity.cpp b/dGame/Entity.cpp index 6d0014bf..715e9231 100644 --- a/dGame/Entity.cpp +++ b/dGame/Entity.cpp @@ -2166,3 +2166,12 @@ void Entity::SetRespawnRot(const NiQuaternion& rotation) { auto* characterComponent = GetComponent(); if (characterComponent) characterComponent->SetRespawnRot(rotation); } + +void Entity::EraseVar(const std::u16string& name) { + for (auto it = m_Settings.begin(); it != m_Settings.end(); ++it) { + if ((*it)->GetKey() == name) { + m_Settings.erase(it); + return; + } + } +} diff --git a/dGame/Entity.h b/dGame/Entity.h index ffdcb713..278d81b0 100644 --- a/dGame/Entity.h +++ b/dGame/Entity.h @@ -299,6 +299,7 @@ public: // Scale will only be communicated to the client when the construction packet is sent void SetScale(const float scale) { m_Scale = scale; }; + void EraseVar(const std::u16string& name); protected: LWOOBJID m_ObjectID;