mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-11-03 22:21:59 +00:00 
			
		
		
		
	ItemComponent Pass
make use of Writing a length add C include guard
This commit is contained in:
		@@ -2,7 +2,6 @@
 | 
			
		||||
#include "Entity.h"
 | 
			
		||||
#include "eUgcModerationStatus.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ItemComponent::ItemComponent(Entity* parent) : Component(parent) {
 | 
			
		||||
	m_ParentEntity = parent;
 | 
			
		||||
 | 
			
		||||
@@ -22,10 +21,10 @@ void ItemComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUp
 | 
			
		||||
	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<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;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -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__
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user