Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
Panakotta00 committed Sep 27, 2021
2 parents ec139fb + 2a8d9aa commit 2717946
Show file tree
Hide file tree
Showing 121 changed files with 6,337 additions and 4,974 deletions.
Binary file modified Content/Components/CodeableMerger/CodeableMerger.uasset
Binary file not shown.
Binary file modified Content/Components/CodeableSplitter/CodeableSplitter.uasset
Binary file not shown.
Binary file not shown.
Binary file modified Content/Components/CodeableSplitter/Mesh_CodeableSplitter.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Content/Components/ModularPanel/Modules/Module_RCO.uasset
Binary file not shown.
Binary file modified Content/Computer/Computer.uasset
Binary file not shown.
Binary file modified Content/Computer/UI/Widget_ComputerInteract.uasset
Binary file not shown.
Binary file added Content/Material/MI_REmissiveButton.uasset
Binary file not shown.
Binary file added Content/Material/MI_REmissiveIndicator.uasset
Binary file not shown.
Binary file modified Content/Network/NetworkCable/NetworkCable.uasset
Binary file not shown.
Binary file not shown.
Binary file modified Content/Network/ThinNetworkCable/BD_ThinNetworkCable.uasset
Binary file not shown.
Binary file not shown.
Binary file modified Content/Network/ThinNetworkCable/SM_ThinNetworkCable2.uasset
Binary file not shown.
Binary file modified Content/Network/ThinNetworkCable/ThinNetworkCable.uasset
Binary file not shown.
Binary file modified Content/Schematics/MicroControlPanel.uasset
Binary file not shown.
Binary file modified Content/Schematics/ModularIO.uasset
Binary file not shown.
4 changes: 2 additions & 2 deletions FicsItNetworks.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"FileVersion": 3,
"Version": 0,
"VersionName": "0.3",
"SemVersion": "0.3.2",
"SemVersion": "0.3.3",
"FriendlyName": "FicsIt-Networks",
"Description": "Adds a computer network and programmable computers to the Game.",
"Category": "Modding",
"CreatedBy": "Panakotta00, RosszEmber, Deantendo, Coffeediction, Roze, Raysh, Esper",
"CreatedByURL": "",
"DocsURL": "https://docs.ficsit.app/ficsit-networks/0.0.1/index.html",
"DocsURL": "https://docs.ficsit.app/ficsit-networks/latest/index.html",
"MarketplaceURL": "",
"SupportURL": "https://discord.gg/3VfZ6Da",
"CanContainContent": true,
Expand Down
9 changes: 6 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,12 @@ pipeline {
stage('Setup UE4') {
steps {
dir('ue4') {
withCredentials([string(credentialsId: 'SMR', variable: 'SMR_TOKEN')]) {
bat label: 'Download UE', script: 'aria2c -x 8 -s 8 https://%SMR_TOKEN%@ci.ficsit.app/job/UE-4.25.3-CSS/lastSuccessfulBuild/artifact/UnrealEngine-CSS-Editor-Win64.zip'
}
/*withCredentials([string(credentialsId: 'SMR', variable: 'SMR_TOKEN')]) {
retry(5) {
bat label: 'Download UE', script: 'aria2c -x 8 -s 8 -c https://%SMR_TOKEN%@ci.ficsit.app/job/UE-4.25.3-CSS/lastSuccessfulBuild/artifact/UnrealEngine-CSS-Editor-Win64.zip'
}
}*/
bat label: 'Copy UE', script: 'copy C:\\Jenkins\\UnrealEngine-CSS-Editor-Win64.zip .'
bat label: 'Extract UE', script: '7z x UnrealEngine-CSS-Editor-Win64.zip'
bat label: 'Register UE', script: 'SetupScripts\\Register.bat'
}
Expand Down
16 changes: 8 additions & 8 deletions Source/FicsItNetworks/Components/FINCodeableMerger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ AFINCodeableMerger::AFINCodeableMerger() {
NetworkConnector->SetMobility(EComponentMobility::Static);
NetworkConnector->SetIsReplicated(true);

Output1 = CreateDefaultSubobject<UFGFactoryConnectionComponent>("Output1");
Output1->SetDirection(EFactoryConnectionDirection::FCD_OUTPUT);
Output1->SetupAttachment(RootComponent);
Output1->SetMobility(EComponentMobility::Static);
Input1 = CreateDefaultSubobject<UFGFactoryConnectionComponent>("Input1");
Input1->SetDirection(EFactoryConnectionDirection::FCD_INPUT);
Input1->SetupAttachment(RootComponent);
Input1->SetMobility(EComponentMobility::Static);
Input2 = CreateDefaultSubobject<UFGFactoryConnectionComponent>("Input2");
Input2->SetDirection(EFactoryConnectionDirection::FCD_INPUT);
Input2->SetupAttachment(RootComponent);
Input2->SetMobility(EComponentMobility::Static);
Input1 = CreateDefaultSubobject<UFGFactoryConnectionComponent>("Input1");
Input1->SetDirection(EFactoryConnectionDirection::FCD_INPUT);
Input1->SetupAttachment(RootComponent);
Input1->SetMobility(EComponentMobility::Static);
Input3 = CreateDefaultSubobject<UFGFactoryConnectionComponent>("Input3");
Input3->SetDirection(EFactoryConnectionDirection::FCD_INPUT);
Input3->SetupAttachment(RootComponent);
Input3->SetMobility(EComponentMobility::Static);
Output1 = CreateDefaultSubobject<UFGFactoryConnectionComponent>("Output1");
Output1->SetDirection(EFactoryConnectionDirection::FCD_OUTPUT);
Output1->SetupAttachment(RootComponent);
Output1->SetMobility(EComponentMobility::Static);

mFactoryTickFunction.bCanEverTick = true;
mFactoryTickFunction.bStartWithTickEnabled = true;
Expand Down
16 changes: 8 additions & 8 deletions Source/FicsItNetworks/Components/FINCodeableMerger.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ class AFINCodeableMerger : public AFGBuildableConveyorAttachment, public IFINSig
UFINAdvancedNetworkConnectionComponent* NetworkConnector = nullptr;

UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
UFGFactoryConnectionComponent* Output1 = nullptr;

UFGFactoryConnectionComponent* Input2 = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
UFGFactoryConnectionComponent* Input1 = nullptr;

UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
UFGFactoryConnectionComponent* Input2 = nullptr;


UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
UFGFactoryConnectionComponent* Input3 = nullptr;

UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
UFGFactoryConnectionComponent* Output1 = nullptr;

UPROPERTY(SaveGame)
TArray<FInventoryItem> OutputQueue;
Expand Down Expand Up @@ -83,7 +83,7 @@ class AFINCodeableMerger : public AFGBuildableConveyorAttachment, public IFINSig
Description = FText::FromString("Allows to transfer an item from the given input queue to the output queue if possible.");
ParameterInternalNames.Add("input");
ParameterDisplayNames.Add(FText::FromString("Input"));
ParameterDescriptions.Add(FText::FromString("The index of the input queue you want to transfer the next item to the output queue. (0 = middle, 1 = left, 2 = right)"));
ParameterDescriptions.Add(FText::FromString("The index of the input queue you want to transfer the next item to the output queue. (0 = right, 1 = middle, 2 = left)"));
ParameterInternalNames.Add("transfered");
ParameterDisplayNames.Add(FText::FromString("Transfered"));
ParameterDescriptions.Add(FText::FromString("true if it was able to transfer the item."));
Expand All @@ -102,7 +102,7 @@ class AFINCodeableMerger : public AFGBuildableConveyorAttachment, public IFINSig
Description = FText::FromString("Returns the next item in the given input queue.");
ParameterInternalNames.Add("input");
ParameterDisplayNames.Add(FText::FromString("Input"));
ParameterDescriptions.Add(FText::FromString("The index of the input queue you want to check (0 = middle, 1 = left, 2 = right)"));
ParameterDescriptions.Add(FText::FromString("The index of the input queue you want to check (0 = right, 1 = middle, 2 = left)"));
ParameterInternalNames.Add("item");
ParameterDisplayNames.Add(FText::FromString("Item"));
ParameterDescriptions.Add(FText::FromString("The next item in the input queue."));
Expand Down
39 changes: 8 additions & 31 deletions Source/FicsItNetworks/Components/FINCodeableSplitter.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "FINCodeableSplitter.h"
#include "FicsItNetworks/FicsItNetworksModule.h"
#include "FicsItNetworks/Computer/FINComputerSubsystem.h"

AFINCodeableSplitter::AFINCodeableSplitter() {
Expand All @@ -8,27 +7,22 @@ AFINCodeableSplitter::AFINCodeableSplitter() {
NetworkConnector->SetMobility(EComponentMobility::Movable);
NetworkConnector->SetIsReplicated(true);

Input1 = CreateDefaultSubobject<UFGFactoryConnectionComponent>("Input1");
Input1->SetDirection(EFactoryConnectionDirection::FCD_INPUT);
Input1->SetupAttachment(RootComponent);
Input1->SetMobility(EComponentMobility::Movable);
Output1 = CreateDefaultSubobject<UFGFactoryConnectionComponent>("Output1");
Output1->SetDirection(EFactoryConnectionDirection::FCD_OUTPUT);
Output1->SetupAttachment(RootComponent);
Output1->SetMobility(EComponentMobility::Movable);
Output2 = CreateDefaultSubobject<UFGFactoryConnectionComponent>("Output2");
Output2->SetDirection(EFactoryConnectionDirection::FCD_OUTPUT);
Output2->SetupAttachment(RootComponent);
Output2->SetMobility(EComponentMobility::Movable);
Output1 = CreateDefaultSubobject<UFGFactoryConnectionComponent>("Output1");
Output1->SetDirection(EFactoryConnectionDirection::FCD_OUTPUT);
Output1->SetupAttachment(RootComponent);
Output1->SetMobility(EComponentMobility::Movable);
Output3 = CreateDefaultSubobject<UFGFactoryConnectionComponent>("Output3");
Output3->SetDirection(EFactoryConnectionDirection::FCD_OUTPUT);
Output3->SetupAttachment(RootComponent);
Output3->SetMobility(EComponentMobility::Movable);

InputConnector = CreateDefaultSubobject<UFGFactoryConnectionComponent>("InputConnector");
InputConnector->SetDirection(EFactoryConnectionDirection::FCD_INPUT);
InputConnector->SetupAttachment(RootComponent);
InputConnector->SetMobility(EComponentMobility::Movable);
Input1 = CreateDefaultSubobject<UFGFactoryConnectionComponent>("Input1");
Input1->SetDirection(EFactoryConnectionDirection::FCD_INPUT);
Input1->SetupAttachment(RootComponent);
Input1->SetMobility(EComponentMobility::Movable);

mFactoryTickFunction.bCanEverTick = true;
mFactoryTickFunction.bStartWithTickEnabled = true;
Expand All @@ -46,23 +40,6 @@ void AFINCodeableSplitter::OnConstruction(const FTransform& transform) {

void AFINCodeableSplitter::BeginPlay() {
Super::BeginPlay();
if (HasAuthority() && (InputConnector->GetConnection() || AFINComputerSubsystem::GetComputerSubsystem(this)->Version < EFINCustomVersion::FINCodeableSplitterAttachmentFixes)) {
UE_LOG(LogFicsItNetworks, Log, TEXT("Old Splitter found. Try to apply beginplay update fixes... '%s'"), *this->GetName());
UFGFactoryConnectionComponent* OldConnection = InputConnector->GetConnection();
InputConnector->ClearConnection();
Input1->SetConnection(OldConnection);
/*RootComponent->AddRelativeRotation(FRotator(0,-90.0f,0));
UFGFactoryConnectionComponent* NewOutput2 = Output1->GetConnection();
UFGFactoryConnectionComponent* NewOutput1 = Output2->GetConnection();
Output1->ClearConnection();
Output2->ClearConnection();
if (NewOutput1) Output1->SetConnection(NewOutput1);
if (NewOutput2) Output2->SetConnection(NewOutput2);*/
}
InputConnector->RemoveFromRoot();
InputConnector->UnregisterComponent();
InputConnector->DestroyComponent();
InputConnector = nullptr;
}

void AFINCodeableSplitter::Factory_Tick(float dt) {
Expand Down
11 changes: 4 additions & 7 deletions Source/FicsItNetworks/Components/FINCodeableSplitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,16 @@ class AFINCodeableSplitter : public AFGBuildableConveyorAttachment, public IFINS
UFINAdvancedNetworkConnectionComponent* NetworkConnector = nullptr;

UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
UFGFactoryConnectionComponent* InputConnector = nullptr;

UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
UFGFactoryConnectionComponent* Input1 = nullptr;
UFGFactoryConnectionComponent* Output2 = nullptr;

UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
UFGFactoryConnectionComponent* Output1 = nullptr;

UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
UFGFactoryConnectionComponent* Output2 = nullptr;

UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
UFGFactoryConnectionComponent* Output3 = nullptr;

UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
UFGFactoryConnectionComponent* Input1 = nullptr;

UPROPERTY(SaveGame)
TArray<FInventoryItem> InputQueue;
Expand Down
4 changes: 1 addition & 3 deletions Source/FicsItNetworks/Components/FINScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,7 @@ void AFINScreen::netFunc_getSize(int& w, int& h) {
h = FMath::Abs(ScreenHeight);
}

void AFINScreen::NetMulti_OnGPUUpdate_Implementation() {
bGPUChanged = true;
}
void AFINScreen::NetMulti_OnGPUUpdate_Implementation() {}

void AFINScreen::SpawnComponents(TSubclassOf<UStaticMeshComponent> Class, int ScreenWidth, int ScreenHeight, UStaticMesh* MiddlePartMesh, UStaticMesh* EdgePartMesh, UStaticMesh* CornerPartMesh, AActor* Parent, USceneComponent* Attach, TArray<UStaticMeshComponent*>& OutParts) {
int xf = ScreenWidth/FMath::Abs(ScreenWidth);
Expand Down
24 changes: 16 additions & 8 deletions Source/FicsItNetworks/Components/FINScreenHolo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ void AFINScreenHolo::OnConstruction(const FTransform& Transform) {
Parts.Empty();

// Create Components
UStaticMesh* MiddlePartMesh = Cast<AFINScreen>(mBuildClass->GetDefaultObject())->ScreenMiddle;
UStaticMesh* EdgePartMesh = Cast<AFINScreen>(mBuildClass->GetDefaultObject())->ScreenEdge;
UStaticMesh* CornerPartMesh = Cast<AFINScreen>(mBuildClass->GetDefaultObject())->ScreenCorner;
AFINScreen::SpawnComponents(UStaticMeshComponent::StaticClass(), ScreenWidth, ScreenHeight, MiddlePartMesh, EdgePartMesh, CornerPartMesh, this, RootComponent, Parts);
RootComponent->SetMobility(EComponentMobility::Movable);
for (UStaticMeshComponent* Part : Parts) {
Part->SetMobility(EComponentMobility::Movable);
Part->SetCollisionEnabled(ECollisionEnabled::NoCollision);
if (mBuildClass) {
UStaticMesh* MiddlePartMesh = Cast<AFINScreen>(mBuildClass->GetDefaultObject())->ScreenMiddle;
UStaticMesh* EdgePartMesh = Cast<AFINScreen>(mBuildClass->GetDefaultObject())->ScreenEdge;
UStaticMesh* CornerPartMesh = Cast<AFINScreen>(mBuildClass->GetDefaultObject())->ScreenCorner;
AFINScreen::SpawnComponents(UStaticMeshComponent::StaticClass(), ScreenWidth, ScreenHeight, MiddlePartMesh, EdgePartMesh, CornerPartMesh, this, RootComponent, Parts);
RootComponent->SetMobility(EComponentMobility::Movable);
for (UStaticMeshComponent* Part : Parts) {
Part->SetMobility(EComponentMobility::Movable);
Part->SetCollisionEnabled(ECollisionEnabled::NoCollision);
}
}
}

Expand All @@ -44,6 +46,12 @@ void AFINScreenHolo::Tick(float DeltaSeconds) {
}
}

void AFINScreenHolo::BeginPlay() {
Super::BeginPlay();

RerunConstructionScripts();
}

void AFINScreenHolo::EndPlay(const EEndPlayReason::Type EndPlayReason) {
Super::EndPlay(EndPlayReason);

Expand Down
1 change: 1 addition & 0 deletions Source/FicsItNetworks/Components/FINScreenHolo.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class AFINScreenHolo : public AFGBuildableHologram {
// Begin AActor
virtual void OnConstruction(const FTransform& Transform) override;
virtual void Tick(float DeltaSeconds) override;
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
// End AActor

Expand Down
5 changes: 5 additions & 0 deletions Source/FicsItNetworks/Components/FINSizeablePanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "FINScreen.h"
#include "FicsItNetworks/FicsItNetworksModule.h"
#include "FicsItNetworks/Network/FINMCPAdvConnector.h"
#include "FicsItNetworks/Network/FINNetworkCable.h"

AFINSizeablePanel::AFINSizeablePanel() {
ModularPanel = CreateDefaultSubobject<UFINModuleSystemPanel>("Panel");
Expand Down Expand Up @@ -41,6 +42,10 @@ void AFINSizeablePanel::BeginPlay() {
ModularPanel->PanelHeight = abs(PanelHeight);
RerunConstructionScripts();
Super::BeginPlay();

for (AFINNetworkCable* Cable : Connector->GetConnectedCables()) {
Cable->RerunConstructionScripts();
}
}

void AFINSizeablePanel::Tick(float DeltaSeconds) {
Expand Down
18 changes: 15 additions & 3 deletions Source/FicsItNetworks/Computer/FINComputerCase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,22 @@ AFINComputerCase::AFINComputerCase() {
Panel->OnModuleChanged.AddDynamic(this, &AFINComputerCase::OnModuleChanged);

DataStorage = CreateDefaultSubobject<UFGInventoryComponent>("DataStorage");
DataStorage->SetDefaultSize(2);
DataStorage->Resize(2);
DataStorage->OnItemRemovedDelegate.AddDynamic(this, &AFINComputerCase::OnEEPROMChanged);
DataStorage->OnItemAddedDelegate.AddDynamic(this, &AFINComputerCase::OnEEPROMChanged);
DataStorage->SetAllowedItemOnIndex(0, UFINComputerEEPROMDesc::StaticClass());
DataStorage->SetAllowedItemOnIndex(1, UFINComputerFloppyDesc::StaticClass());
DataStorage->mItemFilter.BindLambda([](TSubclassOf<UObject> Item, int32 Index) {
switch (Index) {
case -1:
return Item->IsChildOf(UFINComputerEEPROMDesc::StaticClass()) || Item->IsChildOf(UFINComputerFloppyDesc::StaticClass());
case 0:
return Item->IsChildOf(UFINComputerEEPROMDesc::StaticClass());
case 1:
return Item->IsChildOf(UFINComputerFloppyDesc::StaticClass());
default:
return false;
}
});
DataStorage->SetIsReplicated(true);

Speaker = CreateDefaultSubobject<UAudioComponent>("Speaker");
Expand Down Expand Up @@ -290,7 +302,7 @@ void AFINComputerCase::OnModuleChanged(UObject* module, bool added) {
}

void AFINComputerCase::OnEEPROMChanged(TSubclassOf<UFGItemDescriptor> Item, int32 Num) {
if (HasAuthority()) {
if (HasAuthority() && Kernel) {
if (Item->IsChildOf<UFINComputerEEPROMDesc>()) {
UFINKernelProcessor* Processor = Kernel->GetProcessor();
AFINStateEEPROM* EEPROM = UFINComputerEEPROMDesc::GetEEPROM(DataStorage, 0);
Expand Down
4 changes: 2 additions & 2 deletions Source/FicsItNetworks/Computer/FINInternetCard.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ class AFINInternetCard : public AFINComputerModule, public IFINPciDeviceInterfac
UFUNCTION()
FFINInternetCardHttpRequestFuture netFunc_request(const FString& InURL, const FString& InMethod, const FString& InData, TArray<FFINAnyNetworkValue> varargs);
UFUNCTION()
void netFuncMeta_send(FString& InternalName, FText& DisplayName, FText& Description, TArray<FString>& ParameterInternalNames, TArray<FText>& ParameterDisplayNames, TArray<FText>& ParameterDescriptions, int32& Runtime) {
void netFuncMeta_request(FString& InternalName, FText& DisplayName, FText& Description, TArray<FString>& ParameterInternalNames, TArray<FText>& ParameterDisplayNames, TArray<FText>& ParameterDescriptions, int32& Runtime) {
InternalName = "request";
DisplayName = FText::FromString("Request");
Description = FText::FromString("Does an HTTP-Request. If a payload is given, the Content-Type header has to be set. All additional parameters have to be strings and in pairs of to for defining the http headers and values.");
Description = FText::FromString("Does an HTTP-Request. If a payload is given, the Content-Type header has to be set. All additional parameters have to be strings and in pairs of two for defining the http headers and values.");
ParameterInternalNames.Add("url");
ParameterDisplayNames.Add(FText::FromString("URL"));
ParameterDescriptions.Add(FText::FromString("The URL for which you want to make an HTTP Request."));
Expand Down
14 changes: 12 additions & 2 deletions Source/FicsItNetworks/FicsItKernel/FicsItFS/Library/Path.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ namespace CodersFileSystem {
if (0 != match.position()) {
std::string node = str.substr(0, match.position());
append(node);
} else {
path = "/";
}
str = match.suffix();
}
append(str);
if (str.length() < 1 && path.size() > 0 && path[path.size()-1] != '/') path += "/";
else append(str);
}

Path& append(std::string node) {
Expand All @@ -39,6 +42,8 @@ namespace CodersFileSystem {
} else if (node == "..") {
if (pos != path.size()-1) path.append("/");
path.append(node);
} else if (node == "/") {
path.append(node);
} else if (isNode(node)) {
if (pos != path.size()-1) path.append("/");
path.append(node);
Expand Down Expand Up @@ -68,6 +73,10 @@ namespace CodersFileSystem {
bool isRoot() const {
return path == "/";
}

bool isDir() const {
return path[path.size()-1] == '/';
}

bool startsWith(const Path& other) const {
Path o = isAbsolute() ? other.absolute() : other.relative();
Expand All @@ -93,7 +102,8 @@ namespace CodersFileSystem {
std::string fileExtension() const {
std::string name = fileName();
size_t pos = name.find_last_of(".");
return name.substr(pos < 1 ? std::string::npos : pos);
if (pos == std::string::npos || pos == 0) return "";
return name.substr(pos);
}

std::string fileStem() const {
Expand Down
10 changes: 10 additions & 0 deletions Source/FicsItNetworks/FicsItKernel/FicsItFS/Library/Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ void CodersFileSystem::Tests::TestPath() {
Path root_relative_back = "/..";
Path relative_back_file = "../test";
Path root_relative_back_file = "/folder/../test";
Path folder_ref = "/test/";

check(empty.isEmpty());
check(!empty.isAbsolute());
Expand Down Expand Up @@ -72,4 +73,13 @@ void CodersFileSystem::Tests::TestPath() {
check(mountPoint2.isRoot());
check(mountPoint2 / ".." == "/");
check(mountPoint2.fileName() == "");

check(folder_ref.isDir());
Path rootOverride = "/test//meep";
check(!rootOverride.isEmpty());
check(rootOverride.isAbsolute());
check(rootOverride.isSingle());
check(!rootOverride.isRoot());
check(rootOverride.fileName() == "meep");
check(!rootOverride.isDir());
}
2 changes: 1 addition & 1 deletion Source/FicsItNetworks/FicsItKernel/FicsItKernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class FICSITNETWORKS_API UFINKernelSystem : public UObject, public IFGSaveInterf
UPROPERTY(SaveGame)
TEnumAsByte<EFINKernelState> State = FIN_KERNEL_SHUTOFF;
UPROPERTY(SaveGame)
uint64 SystemResetTimePoint = 0;
int64 SystemResetTimePoint = 0;
UPROPERTY(SaveGame)
FString DevDeviceMountPoint;
TSharedPtr<FFINKernelCrash> KernelCrash;
Expand Down
Loading

0 comments on commit 2717946

Please sign in to comment.