mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-05-23 15:22:28 +00:00
ItemComponent Pass
make use of Writing a length add C include guard
This commit is contained in:
parent
6fb1786cf1
commit
c22040c6eb
@ -2,7 +2,6 @@
|
|||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "eUgcModerationStatus.h"
|
#include "eUgcModerationStatus.h"
|
||||||
|
|
||||||
|
|
||||||
ItemComponent::ItemComponent(Entity* parent) : Component(parent) {
|
ItemComponent::ItemComponent(Entity* parent) : Component(parent) {
|
||||||
m_ParentEntity = 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) {
|
void ItemComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
|
||||||
|
|
||||||
outBitStream->Write(m_DirtyItemInfo || bIsInitialUpdate);
|
outBitStream->Write(m_DirtyItemInfo || bIsInitialUpdate);
|
||||||
if (m_DirtyItemInfo || bIsInitialUpdate){
|
if (m_DirtyItemInfo || bIsInitialUpdate) {
|
||||||
outBitStream->Write(m_UgId);
|
outBitStream->Write(m_UgId);
|
||||||
outBitStream->Write(m_UgModerationStatus);
|
outBitStream->Write(m_UgModerationStatus);
|
||||||
outBitStream->Write(m_UgDescription != u"");
|
outBitStream->Write(!m_UgDescription.empty());
|
||||||
if (m_UgDescription != u""){
|
if (!m_UgDescription.empty()){
|
||||||
outBitStream->Write<uint32_t>(m_UgDescription.length());
|
outBitStream->Write<uint32_t>(m_UgDescription.length());
|
||||||
for (uint16_t character : m_UgDescription) outBitStream->Write(character);
|
outBitStream->Write(reinterpret_cast<const char*>(m_UgDescription.c_str()), m_UgDescription.length() * sizeof(uint16_t));
|
||||||
}
|
}
|
||||||
m_DirtyItemInfo = false;
|
m_DirtyItemInfo = false;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
|
#ifndef __ITEMCOMPONENT__H__
|
||||||
|
#define __ITEMCOMPONENT__H__
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "dCommonVars.h"
|
#include "dCommonVars.h"
|
||||||
#include "RakNetTypes.h"
|
#include "RakNetTypes.h"
|
||||||
#include "NiPoint3.h"
|
#include "NiPoint3.h"
|
||||||
@ -39,7 +42,7 @@ private:
|
|||||||
LWOOBJID m_UgId;
|
LWOOBJID m_UgId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Whether or not the description of this item is approved.
|
||||||
*/
|
*/
|
||||||
eUgcModerationStatus m_UgModerationStatus;
|
eUgcModerationStatus m_UgModerationStatus;
|
||||||
|
|
||||||
@ -48,3 +51,5 @@ private:
|
|||||||
*/
|
*/
|
||||||
std::u16string m_UgDescription;
|
std::u16string m_UgDescription;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif //!__ITEMCOMPONENT__H__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user