diff --git a/dGame/dComponents/ItemComponent.cpp b/dGame/dComponents/ItemComponent.cpp index bb201b00..fb7133dc 100644 --- a/dGame/dComponents/ItemComponent.cpp +++ b/dGame/dComponents/ItemComponent.cpp @@ -2,7 +2,6 @@ #include "Entity.h" #include "eUgcModerationStatus.h" - ItemComponent::ItemComponent(Entity* parent) : Component(parent) { m_ParentEntity = parent; @@ -19,13 +18,13 @@ ItemComponent::ItemComponent(Entity* parent) : Component(parent) { void ItemComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) { outBitStream->Write(m_DirtyItemInfo || bIsInitialUpdate); - if (m_DirtyItemInfo || bIsInitialUpdate){ + if (m_DirtyItemInfo || bIsInitialUpdate) { outBitStream->Write(m_UgId); outBitStream->Write(m_UgModerationStatus); - outBitStream->Write(m_UgDescription != u""); - if (m_UgDescription != u""){ + outBitStream->Write(!m_UgDescription.empty()); + if (!m_UgDescription.empty()){ outBitStream->Write(m_UgDescription.length()); - for (uint16_t character : m_UgDescription) outBitStream->Write(character); + outBitStream->Write(reinterpret_cast(m_UgDescription.c_str()), m_UgDescription.length() * sizeof(uint16_t)); } m_DirtyItemInfo = false; } diff --git a/dGame/dComponents/ItemComponent.h b/dGame/dComponents/ItemComponent.h index ccfa63a8..c991d5b5 100644 --- a/dGame/dComponents/ItemComponent.h +++ b/dGame/dComponents/ItemComponent.h @@ -1,4 +1,7 @@ +#ifndef __ITEMCOMPONENT__H__ +#define __ITEMCOMPONENT__H__ #pragma once + #include "dCommonVars.h" #include "RakNetTypes.h" #include "NiPoint3.h" @@ -39,7 +42,7 @@ private: LWOOBJID m_UgId; /** - * + * Whether or not the description of this item is approved. */ eUgcModerationStatus m_UgModerationStatus; @@ -48,3 +51,5 @@ private: */ std::u16string m_UgDescription; }; + +#endif //!__ITEMCOMPONENT__H__