本文整理汇总了C++中UScriptStruct::InheritedCppStructOps方法的典型用法代码示例。如果您正苦于以下问题:C++ UScriptStruct::InheritedCppStructOps方法的具体用法?C++ UScriptStruct::InheritedCppStructOps怎么用?C++ UScriptStruct::InheritedCppStructOps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UScriptStruct
的用法示例。
在下文中一共展示了UScriptStruct::InheritedCppStructOps方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReceivedBunch
//.........这里部分代码省略.........
{
UE_LOG(LogRep, Error, TEXT("Element index too large %s in %s"), *ReplicatedProp->GetName(), *Object->GetFullName());
return false;
}
}
// Pointer to destination.
uint8* Data = ReplicatedProp->ContainerPtrToValuePtr<uint8>((uint8*)Object, Element);
TArray<uint8> MetaData;
const PTRINT DataOffset = Data - (uint8*)Object;
// Receive custom delta property.
UStructProperty * StructProperty = Cast< UStructProperty >( ReplicatedProp );
if ( StructProperty == NULL )
{
// This property isn't custom delta
UE_LOG(LogRepTraffic, Error, TEXT("Property isn't custom delta %s"), *ReplicatedProp->GetName());
return false;
}
UScriptStruct * InnerStruct = StructProperty->Struct;
if ( !( InnerStruct->StructFlags & STRUCT_NetDeltaSerializeNative ) )
{
// This property isn't custom delta
UE_LOG(LogRepTraffic, Error, TEXT("Property isn't custom delta %s"), *ReplicatedProp->GetName());
return false;
}
UScriptStruct::ICppStructOps * CppStructOps = InnerStruct->GetCppStructOps();
check( CppStructOps );
check( !InnerStruct->InheritedCppStructOps() );
FNetDeltaSerializeInfo Parms;
FNetSerializeCB NetSerializeCB( OwningChannel->Connection->Driver );
Parms.DebugName = StructProperty->GetName();
Parms.Struct = InnerStruct;
Parms.Map = PackageMap;
Parms.Reader = &Bunch;
Parms.NetSerializeCB = &NetSerializeCB;
// Call the custom delta serialize function to handle it
CppStructOps->NetDeltaSerialize( Parms, Data );
if ( Bunch.IsError() )
{
UE_LOG(LogNet, Error, TEXT("ReceivedBunch: NetDeltaSerialize - Bunch.IsError() == true: %s"), *Object->GetFullName());
return false;
}
if ( Parms.bOutHasMoreUnmapped )
{
UnmappedCustomProperties.Add( DataOffset, StructProperty );
bOutHasUnmapped = true;
}
// Successfully received it.
UE_LOG(LogRepTraffic, Log, TEXT(" %s - %s"), *Object->GetName(), *ReplicatedProp->GetName());
// Notify the Object if this var is RepNotify
QueuePropertyRepNotify( Object, ReplicatedProp, Element, MetaData );
}
示例2: ReceivedBunch
//.........这里部分代码省略.........
TArray<uint8> MetaData;
PTRINT Offset = 0;
// Copy current value over to Recent for comparison
if ( DestRecent )
{
Offset = ReplicatedProp->ContainerPtrToValuePtr<uint8>(DestRecent, Element) - DestRecent;
check( Offset >= 0 && Offset < RepState->StaticBuffer.Num() ); //@todo if we move properties outside of the memory block, then this will not work anyway
ReplicatedProp->CopySingleValue( DestRecent + Offset, Data );
}
// Receive custom delta property.
UStructProperty * StructProperty = Cast< UStructProperty >( ReplicatedProp );
if ( StructProperty == NULL )
{
// This property isn't custom delta
UE_LOG( LogNetTraffic, Error, TEXT( "Property isn't custom delta %s" ), *ReplicatedProp->GetName() );
return false;
}
UScriptStruct * InnerStruct = StructProperty->Struct;
if ( !( InnerStruct->StructFlags & STRUCT_NetDeltaSerializeNative ) )
{
// This property isn't custom delta
UE_LOG( LogNetTraffic, Error, TEXT( "Property isn't custom delta %s" ), *ReplicatedProp->GetName() );
return false;
}
UScriptStruct::ICppStructOps * CppStructOps = InnerStruct->GetCppStructOps();
check( CppStructOps );
check( !InnerStruct->InheritedCppStructOps() );
FNetDeltaSerializeInfo Parms;
FNetSerializeCB NetSerializeCB( OwningChannel->Connection->Driver );
Parms.DebugName = StructProperty->GetName();
Parms.Struct = InnerStruct;
Parms.Map = PackageMap;
Parms.InArchive = &Bunch;
Parms.NetSerializeCB = &NetSerializeCB;
// Call the custom delta serialize function to handle it
CppStructOps->NetDeltaSerialize( Parms, Data );
if ( Bunch.IsError() )
{
UE_LOG( LogNet, Error, TEXT( "ReceivedBunch: NetDeltaSerialize - Bunch.IsError() == true: %s" ), *Object->GetFullName() );
return false;
}
// See if it changed from our local value
bool PropertyChanged = true;
if ( DestRecent )
{
// POD types can do a memcmp with a call to Identical
if ( ReplicatedProp->Identical( DestRecent + Offset, Data ) )
{
PropertyChanged = false;
}
}
示例3: UpdateUnmappedObjects
void FObjectReplicator::UpdateUnmappedObjects( bool & bOutHasMoreUnmapped )
{
UObject* Object = GetObject();
if ( Object == NULL || Object->IsPendingKill() )
{
bOutHasMoreUnmapped = false;
return;
}
if ( Connection->State == USOCK_Closed )
{
UE_LOG(LogNet, Warning, TEXT("FObjectReplicator::UpdateUnmappedObjects: Connection->State == USOCK_Closed"));
return;
}
checkf( RepState->RepNotifies.Num() == 0, TEXT("Failed RepState RepNotifies check. Num=%d. Object=%s"), RepState->RepNotifies.Num(), *Object->GetFullName() );
checkf( RepNotifies.Num() == 0, TEXT("Failed replicator RepNotifies check. Num=%d. Object=%s."), RepNotifies.Num(), *Object->GetFullName() );
bool bSomeObjectsWereMapped = false;
// Let the rep layout update any unmapped properties
RepLayout->UpdateUnmappedObjects( RepState, Connection->PackageMap, Object, bSomeObjectsWereMapped, bOutHasMoreUnmapped );
// Update unmapped objects for custom properties (currently just fast tarray)
for ( auto It = UnmappedCustomProperties.CreateIterator(); It; ++It )
{
const int32 Offset = It.Key();
UStructProperty* StructProperty = It.Value();
UScriptStruct* InnerStruct = StructProperty->Struct;
check( InnerStruct->StructFlags & STRUCT_NetDeltaSerializeNative );
UScriptStruct::ICppStructOps* CppStructOps = InnerStruct->GetCppStructOps();
check( CppStructOps );
check( !InnerStruct->InheritedCppStructOps() );
FNetDeltaSerializeInfo Parms;
FNetSerializeCB NetSerializeCB( OwningChannel->Connection->Driver );
Parms.DebugName = StructProperty->GetName();
Parms.Struct = InnerStruct;
Parms.Map = Connection->PackageMap;
Parms.NetSerializeCB = &NetSerializeCB;
Parms.bUpdateUnmappedObjects = true;
Parms.bCalledPreNetReceive = bSomeObjectsWereMapped; // RepLayout used this to flag whether PreNetReceive was called
Parms.Object = Object;
// Call the custom delta serialize function to handle it
CppStructOps->NetDeltaSerialize( Parms, (uint8*)Object + Offset );
// Merge in results
bSomeObjectsWereMapped |= Parms.bOutSomeObjectsWereMapped;
bOutHasMoreUnmapped |= Parms.bOutHasMoreUnmapped;
if ( Parms.bOutSomeObjectsWereMapped )
{
// If we mapped a property, call the rep notify
TArray<uint8> MetaData;
QueuePropertyRepNotify( Object, StructProperty, 0, MetaData );
}
// If this property no longer has unmapped objects, we can stop checking it
if ( !Parms.bOutHasMoreUnmapped )
{
It.RemoveCurrent();
}
}
// Call any rep notifies that need to happen when object pointers change
// Pass in false to override the check for queued bunches. Otherwise, if the owning channel has queued bunches,
// the RepNotifies will remain in the list and the check for 0 RepNotifies above will fail next time.
CallRepNotifies(false);
if ( bSomeObjectsWereMapped )
{
// If we mapped some objects, make sure to call PostNetReceive (some game code will need to think this was actually replicated to work)
PostNetReceive();
}
}