refactor(Core/Entities): clean up vendor item removal and add QuaternionData Euler helpers (#24790)

This commit is contained in:
Francesco Borzì
2026-02-21 17:42:52 +01:00
committed by GitHub
parent 07e9cef70f
commit f7bc41eebe
3 changed files with 14 additions and 1 deletions

View File

@@ -88,7 +88,7 @@ bool VendorItemData::RemoveItem(uint32 item_id)
{
if ((*i)->item == item_id)
{
i = m_items.erase(i++);
i = m_items.erase(i);
found = true;
}
else

View File

@@ -43,6 +43,17 @@ bool QuaternionData::IsUnit() const
return fabs(x * x + y * y + z * z + w * w - 1.0f) < 1e-5f;
}
void QuaternionData::ToEulerAnglesZYX(float& Z, float& Y, float& X) const
{
G3D::Matrix3(G3D::Quat(x, y, z, w)).toEulerAnglesZYX(Z, Y, X);
}
QuaternionData QuaternionData::FromEulerAnglesZYX(float Z, float Y, float X)
{
G3D::Quat quat(G3D::Matrix3::fromEulerAnglesZYX(Z, Y, X));
return QuaternionData(quat.x, quat.y, quat.z, quat.w);
}
GameObject::GameObject() : WorldObject(), MovableMapObject(),
m_model(nullptr), m_goValue(), m_AI(nullptr)
{

View File

@@ -689,6 +689,8 @@ struct AC_GAME_API QuaternionData
QuaternionData(float X, float Y, float Z, float W) : x(X), y(Y), z(Z), w(W) { }
[[nodiscard]] bool IsUnit() const;
void ToEulerAnglesZYX(float& Z, float& Y, float& X) const;
[[nodiscard]] static QuaternionData FromEulerAnglesZYX(float Z, float Y, float X);
};
// `gameobject_addon` table