Hi guys
I’m trying to re-write an old script to the new version of EU4 and I’m having trouble.
The first error is that: **It gives error in the first STRUCT OFFSET
**(pointer to incomplete class type is not allowed)
FInterpCurveVector& HackAccessSplineInfo(ULandscapeSplineSegment* SplineSegment)
{
//This ugly code will crash badly if the ULandscapeSplineSegment changes
BYTE* HackPtr = (BYTE*)SplineSegment;
#if WITH_EDITORONLY_DATA
HackPtr += STRUCT_OFFSET(ULandscapeSplineSegment, LDMaxDrawDistance) + sizeof(uint32) * 3;
#else
HackPtr += STRUCT_OFFSET(ULandscapeSplineSegment, Connections[1]) + sizeof(FLandscapeSplineSegmentConnection);
#endif
return *(FInterpCurveVector*)HackPtr;
}
The second error (ULandscapeSplinesComponent* APlayerController::TrackSplines pointer to incomplete class type is not allowed) at the TrackSplines and CurrentControlPoint too.
if (GetPawn())
{
for (TObjectIterator<ULandscapeSplinesComponent> ObjIt; ObjIt; ++ObjIt)
{
TrackSplines = *ObjIt;
ULandscapeSplineControlPoint* ClosestControlPoint = nullptr;
//Find the controlpoint closest to the player start point
FVector PlayerStartLocation = GetPawn()->GetActorLocation() - TrackSplines->GetOwner()->GetActorLocation();
float ClosestDistSq = FLT_MAX;
for (int32 i = 0; i < TrackSplines->ControlPoints.Num(); i++)
{
float DistSq = (TrackSplines->ControlPoints*->Location - PlayerStartLocation).SizeSquared();
if (DistSq < ClosestDistSq)
{
ClosestDistSq = DistSq;
ClosestControlPoint = TrackSplines->ControlPoints*;
}
}
bool bTrackHasErrors = false;
OrderedSegments.Empty(TrackSplines->Segments.Num());
ULandscapeSplineControlPoint* CurrentControlPoint = ClosestControlPoint;
while (CurrentControlPoint)
{
int32 i = 0;
for (; i < CurrentControlPoint->ConnectedSegments.Num(); i++)
{
if (OrderedSegments.Num() == 0 || CurrentControlPoint->ConnectedSegments*.Segment != OrderedSegments[0])
{
OrderedSegments.Insert(CurrentControlPoint->ConnectedSegments*.Segment, 0);
check(CurrentControlPoint != CurrentControlPoint->ConnectedSegments*.GetFarConnection().ControlPoint);
CurrentControlPoint = CurrentControlPoint->ConnectedSegments*.GetFarConnection().ControlPoint;
break;
}
}
//We didn't find another segment to link to, we have an error!
if (i == CurrentControlPoint->ConnectedSegments.Num())
{
bTrackHasErrors = true;
break;
}
//Back to the start
if (CurrentControlPoint == ClosestControlPoint)
break;
}
This one to (class APlayerCameraManager has no member bFollowHmdOrientation)
void ARollerCoasterPlayerController::PlayerTick(float DeltaTime)
{
//If we're requesting a stop, do it immediately
if (Stopped)
{
CurrentRollerCoasterVelocity = 0.f;
}
else
{
CurrentRollerCoasterVelocity += AddVelocity;
AddVelocity = 0.f;
}
if (GetPawn() && TrackSplines)
{
DeltaRemaining += DeltaTime;
static float FixedStepTime = 1.f / 150.f;
while (DeltaRemaining >= FixedStepTime)
{
UpdatePlayer(FixedStepTime);
DeltaRemaining -= FixedStepTime;
}
}
PlayerCameraManager->bFollowHmdOrientation = true;
Super::PlayerTick(DeltaTime);
}
And the last one at the CurrentSegment
(ULandscapeSplineSegment8 CurrentSegment pointer to incomplete class type is not allowed)
// Calculate the roll values
float NewRotationRoll = 0.f;
if (CurrentSegment->Connections[0].ControlPoint && CurrentSegment->Connections[1].ControlPoint)
{
FVector StartLocation; FRotator StartRotation;
CurrentSegment->Connections[0].ControlPoint->GetConnectionLocationAndRotation(CurrentSegment->Connections[0].SocketName, StartLocation, StartRotation);
FVector EndLocation; FRotator EndRotation;
CurrentSegment->Connections[1].ControlPoint->GetConnectionLocationAndRotation(CurrentSegment->Connections[1].SocketName, EndLocation, EndRotation);
NewRotationRoll = FMath::Lerp(-StartRotation.Roll, -EndRotation.Roll, NewKeyTime);
}
NewRotation.Roll = NewRotationRoll;
Lot problemas I know but some one can help-me?