startAgain. c++ functions, search

This commit is contained in:
2023-11-15 19:27:20 +05:00
commit 4aca15f778
303 changed files with 28702 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
public class GraffModule : ModuleRules
{
public GraffModule(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
PrivateDependencyModuleNames.AddRange(new string[] { });
// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
// Uncomment if you are using online features
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
}
}
+6
View File
@@ -0,0 +1,6 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "GraffModule.h"
#include "Modules/ModuleManager.h"
IMPLEMENT_GAME_MODULE( FDefaultGameModuleImpl, GraffModule );
+6
View File
@@ -0,0 +1,6 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
@@ -0,0 +1,325 @@
// Fill outLvl your copyright notice in the Description page of Project Settings.
#include "cppFuncLibrary.h"
#include "Kismet/KismetStringLibrary.h"
#include "Kismet/KismetmathLibrary.h"
TArray<FString> UcppFuncLibrary::cppUniversalParser(FString string, TArray<FString> keys, FString delimiter, bool caseSensitive)
{
TArray<FString> arr;
TArray<FString> out;
out.SetNum(keys.Num());
string.ParseIntoArray(arr, *delimiter, false);
for (const auto& str : arr) {
int n = 0;
for (const auto& str1 : keys) {
if (str1.IsEmpty()) continue;
FString left_;
FString right_;
if (str.Split(str1, &left_, &right_, caseSensitive ? ESearchCase::CaseSensitive : ESearchCase::IgnoreCase)) {
if (out[n].IsEmpty()) out[n] = right_;
}
n++;
}
}
return out;
}
FString UcppFuncLibrary::cppIntToStrPad(int32 int_, int32 minDigits)
{
FString temp = FString::FromInt(int_);
for (int32 i = temp.Len(); i < minDigits; i++) {
temp = L"0" + temp;
}
return temp;
}
TSoftObjectPtr<UTexture2D> UcppFuncLibrary::castSoftTex2D(TSoftObjectPtr<UObject> ptr)
{
return TSoftObjectPtr<UTexture2D>(ptr.ToSoftObjectPath());//somewhy cant construct from another <T> and cant cast
}
double UcppFuncLibrary::NegateF(double in)
{
return in * -1;
}
int32 UcppFuncLibrary::NegateI(int32 in)
{
return in * -1;
}
double UcppFuncLibrary::OneMinus(double in)
{
return 1 - in;
}
double UcppFuncLibrary::AddRefF(UPARAM(ref) double& A, double B)
{
A += B;
return A;
}
int32 UcppFuncLibrary::AddRefI(UPARAM(ref) int32& A, int32 B)
{
A += B;
return A;
}
double UcppFuncLibrary::SubRefF(UPARAM(ref) double& A, double B)
{
A -= B;
return A;
}
int32 UcppFuncLibrary::SubRefI(UPARAM(ref) int32& A, int32 B)
{
A -= B;
return A;
}
double UcppFuncLibrary::saturate(double in)
{
return in < 0 ? 0 : (in > 1 ? 1 : in);
}
int32 UcppFuncLibrary::clamp0(int32 in)
{
return (in < 0) ? 0 : in;
}
void UcppFuncLibrary::cppssw(int32 int_, FString trueInts, bool& true_, bool& false_)
{
FJsonSerializableArray arr;
trueInts.ParseIntoArray(arr, L",");
for (auto& obj : arr) {
FString lft;
FString* lftp = &lft;
FString rht;
FString* rhtp = &rht;
if (obj.Split(L"-", &lft, &rht)) {
if ((int_ >= UKismetStringLibrary::Conv_StringToInt(lft)) && (int_ <= UKismetStringLibrary::Conv_StringToInt(rht))) {
true_ = true;
false_ = false;
return;
}
}
else {
if (int_ == UKismetStringLibrary::Conv_StringToInt(obj)) {
true_ = true;
false_ = false;
return;
}
}
}
true_ = false;
false_ = true;
return;
}
FString UcppFuncLibrary::stringAdd(UPARAM(ref)FString& str, FString add)
{
return str.Append(add);
}
void UcppFuncLibrary::parseOptions(FString SourceString, FString key, FString Delimiter, FString& value, bool& found)
{
FJsonSerializableArray arr;
SourceString.ParseIntoArray(arr, *Delimiter);
for (auto& ar : arr) {
FString lft;
FString rht;
if (ar.Split(L"=", &lft, &rht)) {
if (lft == key) {
value = rht;
found = true;
return;
}
}
}
value = FString();
found = false;
return;
}
int32 UcppFuncLibrary::customStringToInt(FString string)
{
return (string.IsEmpty() || !string.IsNumeric()) ? -1 : UKismetStringLibrary::Conv_StringToInt(string);
}
void UcppFuncLibrary::multiContains(FString source, UPARAM(ref)TArray<FString>& substrings, bool bAnd, bool bUseCase, bool& bTrue, bool& bFalse)
{
TArray<bool> temp;
for (auto& st : substrings) {
bool temp1 = source.Contains(st, bUseCase ? ESearchCase::CaseSensitive : ESearchCase::IgnoreCase);
temp.Add(temp1);
if (temp1) {
if (!bAnd) {
bTrue = true;
bFalse = false;
return;
}
}
}
bTrue = !temp.Contains(false);
bFalse = !bTrue;
return;
}
void UcppFuncLibrary::containStringSwitch(FString string, UPARAM(ref)TArray<FString>& keys, bool bUseCase, int32& bInt, TArray<bool>& bools)
{
bools.Empty();
bInt = -1;
bool lock = false;
for (auto& key : keys) {
bool temp2 = string.Contains(key, bUseCase ? ESearchCase::CaseSensitive : ESearchCase::IgnoreCase);
bools.Add(temp2);
if (temp2 && !lock) {
lock = true;
bInt = bools.Num() - 1;
}
}
}
FString UcppFuncLibrary::multiRemove(FString source, UPARAM(ref)TArray<FString>& substrings, bool bUseCase)
{
for (auto& ss : substrings) source.ReplaceInline(*ss, L"", bUseCase ? ESearchCase::CaseSensitive : ESearchCase::IgnoreCase);
return source;
}
FString UcppFuncLibrary::quoteString(FString string)
{
return FString("""").Append(string).Append("""");
}
void UcppFuncLibrary::getRange(double value, double minMult, double maxMult, double& bMin, double& bValue, double& bMax)
{
bMin = value * minMult;
bMax = value * maxMult;
bValue = value;
}
void UcppFuncLibrary::updateFilterList(TArray<FcppflatStruct> flats, int floorMin, int floorMax, float sqMin, float sqMax, int priceMin, int priceMax, TArray<bool> houses, TArray<bool> sections, TArray<bool> rooms, int sortType, TArray<FcppflatStruct>& filtered)
{
TArray<int> tempfloor, tempprice;
TArray<float> tempsq;
for (auto& flat : flats) {
if (inRange(flat.Floor, floorMin, floorMax)
&& inRange(flat.Price, priceMin, priceMax)
&& inRange(flat.Square, sqMin, sqMax)
&& boolGet(houses, flat.House)
&& boolGet(sections, flat.Section)
&& boolGet(rooms, flat.Rooms)) {
filtered.Add(flat);
tempfloor.Add(flat.Floor);
tempprice.Add(flat.Price);
tempsq.Add(flat.Square);
}
}
if (tempfloor.Num() > 1) {
switch (sortType) {
case 0:
case 1:
for (int i = 0; i <= (tempprice.Num() - 1) / 2; i++) {
int minid, maxid;
minmaxInRange(tempprice, i, tempprice.Num() - 1 - i, minid, maxid);
tempprice.Swap(sortType == 0 ? minid : maxid, i);
filtered.Swap(sortType == 0 ? minid : maxid, i);
minmaxInRange(tempprice, i, tempprice.Num() - 1 - i, minid, maxid);
tempprice.Swap(sortType == 1 ? minid : maxid, tempprice.Num() - 1 - i);
filtered.Swap(sortType == 1 ? minid : maxid, tempprice.Num() - 1 - i);
}
break;
case 2:
case 3:
for (int i = 0; i <= (tempsq.Num() - 1) / 2; i++) {
int minid, maxid;
minmaxInRange(tempsq, i, tempsq.Num() - 1 - i, minid, maxid);
tempsq.Swap(sortType == 2 ? minid : maxid, i);
filtered.Swap(sortType == 2 ? minid : maxid, i);
minmaxInRange(tempsq, i, tempsq.Num() - 1 - i, minid, maxid);
tempsq.Swap(sortType == 3 ? minid : maxid, tempsq.Num() - 1 - i);
filtered.Swap(sortType == 3 ? minid : maxid, tempsq.Num() - 1 - i);
}
break;
case 4:
case 5:
for (int i = 0; i <= (tempfloor.Num() - 1) / 2; i++) {
int minid, maxid;
minmaxInRange(tempfloor, i, tempfloor.Num() - 1 - i, minid, maxid);
tempfloor.Swap(sortType == 4 ? minid : maxid, i);
filtered.Swap(sortType == 4 ? minid : maxid, i);
minmaxInRange(tempfloor, i, tempfloor.Num() - 1 - i, minid, maxid);
tempfloor.Swap(sortType == 5 ? minid : maxid, tempfloor.Num() - 1 - i);
filtered.Swap(sortType == 5 ? minid : maxid, tempfloor.Num() - 1 - i);
}
break;
default:
break;
}
}
}
bool UcppFuncLibrary::inRange(float in, float min, float max)
{
return (in >= min) && (in <= max);
}
bool UcppFuncLibrary::inRange(int in, int min, int max)
{
return (in >= min) && (in <= max);
}
bool UcppFuncLibrary::boolGet(TArray<bool> arr, int index)
{
if (arr.Contains(true)) {
if (arr.IsValidIndex(index))return arr[index];
return false;
}
return true;
}
void UcppFuncLibrary::minmaxInRange(TArray<int> arr, int min, int max, int& minid, int& maxid)
{
int temp;
max = (max > (arr.Num() - 1)) ? arr.Num() - 1 : (max < 0 ? 0 : max);
min = (min > (arr.Num() - 1)) ? arr.Num() - 1 : (min < 0 ? 0 : min);
arr.SetNum(max + 1); //delete overmax ids
for (int i = 0; i < min; i++)arr.RemoveAt(0);// delete belowmin ids
UKismetMathLibrary::MinOfIntArray(arr, minid, temp);
minid += min; //return original order
UKismetMathLibrary::MaxOfIntArray(arr, maxid, temp);
maxid += min;
}
void UcppFuncLibrary::minmaxInRange(TArray<float> arr, int min, int max, int& minid, int& maxid)
{
float temp;
max = (max > (arr.Num() - 1)) ? arr.Num() - 1 : (max < 0 ? 0 : max);
min = (min > (arr.Num() - 1)) ? arr.Num() - 1 : (min < 0 ? 0 : min);
arr.SetNum(max + 1); //delete overmax ids
for (int i = 0; i < min; i++)arr.RemoveAt(0);// delete belowmin ids
UKismetMathLibrary::MinOfFloatArray(arr, minid, temp);
minid += min; //return original order
UKismetMathLibrary::MaxOfFloatArray(arr, maxid, temp);
maxid += min;
}
+127
View File
@@ -0,0 +1,127 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "cppGI.h"
#include "Kismet/GameplayStatics.h"
#include "Misc/paths.h"
#include "Engine/levelstreamingdynamic.h"
#include "cppFuncLibrary.h"
/*for working tarray::Contains*/
bool operator==(const Fcppcoords& c1, const Fcppcoords& c2) {
return c1.flat == c2.flat &&
c1.floor == c2.floor &&
c1.house == c2.house &&
c1.section == c2.section &&
c1.type == c2.type &&
c1.zone == c2.zone;
}
/*for working tarray::Contains*/
bool operator==(const FcppLevelStruct& c1, const FcppLevelStruct& c2) {
return c1.anotherLvl == c2.anotherLvl &&
c1.coords == c2.coords &&
c1.dontUnload == c2.dontUnload &&
c1.path == c2.path &&
c1.uniqName == c2.uniqName &&
c1.Z == c2.Z;
}
TArray<ULevelStreaming*> UcppGI::cppLvlManage(UObject* WorldContextObject, Fcppcoords currentCoords, uint8 currentState)
{
TArray<ULevelStreaming*> outStruct;
bool loadthis;
auto temp = Fcppcoords();
temp.house = -2;
temp.section = -2;
temp.floor = 1;
cppLoadList.AddUnique(currentCoords);
cppLoadList.AddUnique(temp);
for (const auto& lvl : cppLevels)
{
loadthis = 0;
if (cppBlackList.Contains(lvl));
else if (cppWhiteList.Contains(lvl)) loadthis = true;
else {
bool ceq[7];
for (const auto& crd : cppLoadList) // here is filter code
{
cppCoordsEq(crd, lvl.coords, true, false, ceq[0], ceq[1], ceq[2], ceq[3], ceq[4], ceq[5], ceq[6]);
if (ceq[3] && ceq[4] && ceq[5] && !lvl.uniqName.ToString().EndsWith(L"refl")) loadthis = true; //reflections setup separately, load all on floor
if (ceq[6] && lvl.uniqName.ToString().EndsWith(L"refl")) loadthis = true;
//if (ceq[6]) loadthis = true; //classic load with parallax
}
}
if (loadthis) {
if (cppCreatedList.Contains(lvl.uniqName)) { /*if already created level*/
ULevelStreaming* outlvl_ = nullptr;
if ((outlvl_ = UGameplayStatics::GetStreamingLevel(WorldContextObject, lvl.uniqName)) != nullptr) {
outlvl_->SetShouldBeLoaded(true);
outlvl_->SetShouldBeVisible(true);
cpploadedList.Add(lvl.uniqName);
outStruct.Add(outlvl_);
}
}
else { /*load new level instance*/
bool b;
if (ULevelStreamingDynamic* newlvl = ULevelStreamingDynamic::LoadLevelInstance(WorldContextObject, lvl.path, FVector(0, 0, lvl.Z), FRotator(), b, lvl.uniqName.ToString())) {
newlvl->SetPriority(lvl.coords.flat == -1 ? 1 : 0);
newlvl->bShouldBlockOnLoad = lvl.dontUnload;
cpploadedList.Add(lvl.uniqName);
outStruct.Add(newlvl);
}
}
}
else if (cppCreatedList.Contains(lvl.uniqName)) {
ULevelStreaming* outlvl_ = nullptr;
if ((outlvl_ = UGameplayStatics::GetStreamingLevel(WorldContextObject, lvl.uniqName)) != nullptr) {
//if (lvl.path.EndsWith("refl")) outlvl_->bShouldBlockOnUnload = true;
outlvl_->SetShouldBeLoaded(lvl.dontUnload);
outlvl_->SetShouldBeVisible(false);
cpploadedList.Remove(lvl.uniqName);
outStruct.Add(outlvl_);
}
}
}
cppWhiteList.Empty();
cppBlackList.Empty();
cppLoadList.Empty();
return outStruct;
}
void UcppGI::cppCoordsEq(Fcppcoords coords, Fcppcoords coords1, bool relevantMinus2, bool fastEq, bool& flat_, bool& type_, bool& zone_, bool& house_, bool& section_, bool& floor_, bool& fullEq)
{
bool* outLvl[6] = { &flat_, &type_, &zone_, &house_, &section_, &floor_ };
int32 c1[6] = { coords.flat,coords.type, coords.zone, coords.house, coords.section, coords.floor };
int32 c2[6] = { coords1.flat,coords1.type, coords1.zone, coords1.house, coords1.section, coords1.floor };
int32 mins[6] = { 0,0,1,1,1,0 };
if (fastEq) {
for (int8 i = 0; i < 6; i++)
{
*outLvl[i] = (c1[i] == c2[i]);
}
}
else {
for (int8 i = 0; i < 6; i++) {
*outLvl[i] = ((c1[i] < mins[i]) && (c2[i] < mins[i])) || (c1[i] == c2[i]) || ((c1[i] == -2) && relevantMinus2) || ((c2[i] == -2) && relevantMinus2);
}
}
fullEq = true;
for (const auto var : outLvl)
{
if (!*var)fullEq = false;
}
}
+175
View File
@@ -0,0 +1,175 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "cppFuncLibrary.generated.h"
/**
*
*/
USTRUCT(BlueprintType)
struct FcppflatStruct
{
GENERATED_BODY()
public:
/** Please add a variable description */
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "FlatId", MakeStructureDefaultValue = "-1"))
int32 FlatId;
/** Please add a variable description */
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "flatType", MakeStructureDefaultValue = "0"))
int32 flatType;
/** Please add a variable description */
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Flat#", MakeStructureDefaultValue = "-1"))
int32 FlatN;
/** Please add a variable description */
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Zone", MakeStructureDefaultValue = "-1"))
int32 Zone;
/** Please add a variable description */
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "House", MakeStructureDefaultValue = "-1"))
int32 House;
/** Please add a variable description */
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Section", MakeStructureDefaultValue = "-1"))
int32 Section;
/** Please add a variable description */
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Floor", MakeStructureDefaultValue = "-1"))
int32 Floor;
/** Please add a variable description */
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Rooms", MakeStructureDefaultValue = "-1"))
int32 Rooms;
/** Please add a variable description */
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Square", MakeStructureDefaultValue = "0.000000"))
double Square;
/** Please add a variable description */
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Price", MakeStructureDefaultValue = "0"))
int32 Price;
/** Please add a variable description */
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "price-meter", MakeStructureDefaultValue = "0"))
int32 price_meter;
/** Please add a variable description */
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "available", MakeStructureDefaultValue = "True"))
bool available;
/** Please add a variable description */
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "tags"))
TArray<bool> tags;
/** Please add a variable description */
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "comment"))
FString comment;
};
UCLASS()
class GRAFFMODULE_API UcppFuncLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
UFUNCTION(blueprintcallable)
static TArray<FString> cppUniversalParser(FString string, TArray<FString> keys, FString delimiter, bool caseSensitive);
UFUNCTION(blueprintcallable)
static FString cppIntToStrPad(int32 int_, int32 minDigits);
UFUNCTION(blueprintcallable, BlueprintPure)
static TSoftObjectPtr<UTexture2D> castSoftTex2D(TSoftObjectPtr<UObject> ptr);
UFUNCTION(blueprintcallable, BlueprintPure, category = "Math|Float", meta = (CompactNodeTitle = "*-1"))
static double NegateF(double in);
UFUNCTION(blueprintcallable, BlueprintPure, category = "Math|Integer", meta = (CompactNodeTitle = "*-1"))
static int32 NegateI(int32 in);
UFUNCTION(blueprintcallable, BlueprintPure, category = "Math|Float", meta = (CompactNodeTitle = "1-x"))
static double OneMinus(double in);
UFUNCTION(BlueprintCallable, category = "Math|Float", meta = (CompactNodeTitle = "A+=B"))
static double AddRefF(UPARAM(ref) double& A, double B);
UFUNCTION(BlueprintCallable, category = "Math|Integer", meta = (CompactNodeTitle = "A+=B"))
static int32 AddRefI(UPARAM(ref) int32& A, int32 B);
UFUNCTION(BlueprintCallable, category = "Math|Float", meta = (CompactNodeTitle = "A-=B"))
static double SubRefF(UPARAM(ref) double& A, double B);
UFUNCTION(BlueprintCallable, category = "Math|Integer", meta = (CompactNodeTitle = "A-=B"))
static int32 SubRefI(UPARAM(ref) int32& A, int32 B);
/** clamp int from 0 */
UFUNCTION(blueprintcallable, BlueprintPure, category = "Math|Float", meta = (CompactNodeTitle = "0+"))
static int32 clamp0(int32 in);
/** clamp float 0 to 1 */
UFUNCTION(blueprintcallable, BlueprintPure, category = "Math|Float", meta = (CompactNodeTitle = "sat"))
static double saturate(double in);
/** return true if int is in trueInts. Format: 2,3,4-6 */
UFUNCTION(BlueprintCallable, Category = "Strings", meta = (Keywords = "stringSwitch"))
static void cppssw(int32 int_, FString trueInts, bool& true_, bool& false_);
UFUNCTION(BlueprintCallable, Category = "Strings")
static FString stringAdd(UPARAM(ref) FString& str, FString add);
/** find key=value line by line */
UFUNCTION(blueprintcallable, BlueprintPure, Category = "Strings")
static void parseOptions(FString SourceString, FString key, FString Delimiter, FString& value, bool& found);
/** empty string eq -1 */
UFUNCTION(blueprintcallable, BlueprintPure, Category = "Strings", meta = (CompactNodeTitle = "strInt"))
static int32 customStringToInt(FString string);
/** by default rule is OR */
UFUNCTION(blueprintcallable, BlueprintPure, Category = "Strings")
static void multiContains(FString source, UPARAM(ref) TArray<FString>& substrings, bool bAnd, bool bUseCase, bool& bTrue, bool& bFalse);
/** return first index of found key and bool arr */
UFUNCTION(BlueprintCallable, Category = "Strings")
static void containStringSwitch(FString string, UPARAM(ref) TArray<FString>& keys, bool bUseCase, int32& bInt, TArray<bool>& bools);
/** remove substrings from string (replace to "") */
UFUNCTION(blueprintcallable, BlueprintPure, Category = "Strings")
static FString multiRemove(FString source, UPARAM(ref) TArray<FString>& substrings, bool bUseCase);
/** string->"string" */
UFUNCTION(blueprintcallable, BlueprintPure, Category = "Strings", meta = (CompactNodeTitle = "\"str\""))
static FString quoteString(FString string);
/** return value*minmult and value*maxmult */
UFUNCTION(blueprintcallable, BlueprintPure, category = "Math|Float", meta = (Keywords = "minmax"))
static void getRange(double value, double minMult, double maxMult, double& bMin, double& bValue, double& bMax);
/*sortType: 0.price min-to-max 1. max-to-min 2.square min-to-max 3. max-to-min 4.floor min-to-max 5. max-to-min*/
UFUNCTION(blueprintcallable, category = "Widget|Search")
static void updateFilterList(TArray<FcppflatStruct> flats, int floorMin, int floorMax, float sqMin, float sqMax, int priceMin, int priceMax, TArray<bool> houses, TArray<bool> sections, TArray<bool> rooms, int sortType, TArray<FcppflatStruct>& filtered);
private:
static bool inRange(float in, float min, float max);
static bool inRange(int in, int min, int max);
/*return true if no true in array*/
static bool boolGet(TArray<bool> arr, int index);
static void minmaxInRange(TArray<int>arr, int min, int max, int& minid, int& maxid);
static void minmaxInRange(TArray<float>arr, int min, int max, int& minid, int& maxid);
};
+86
View File
@@ -0,0 +1,86 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Engine/GameInstance.h"
#include "cppGI.generated.h"
/**
*
*/
USTRUCT(BlueprintType)
struct Fcppcoords
{
GENERATED_BODY()
UPROPERTY(BlueprintReadWrite, category = "default")
int32 flat = -1;
UPROPERTY(BlueprintReadWrite, category = "default")
int32 type = 0;
UPROPERTY(BlueprintReadWrite, category = "default")
int32 zone = 1;
UPROPERTY(BlueprintReadWrite, category = "default")
int32 house = -1;
UPROPERTY(BlueprintReadWrite, category = "default")
int32 section = -1;
UPROPERTY(BlueprintReadWrite, category = "default")
int32 floor = -1;
};
USTRUCT(BlueprintType)
struct FcppLevelStruct
{
GENERATED_BODY()
UPROPERTY(BlueprintReadWrite)
Fcppcoords coords;
UPROPERTY(BlueprintReadWrite)
bool dontUnload = false;
UPROPERTY(BlueprintReadWrite)
FString path;
UPROPERTY(BlueprintReadWrite)
float Z = 0;
UPROPERTY(BlueprintReadWrite)
int32 anotherLvl = -1;
UPROPERTY(BlueprintReadWrite)
FName uniqName;
};
UCLASS()
class GRAFFMODULE_API UcppGI : public UGameInstance
{
GENERATED_BODY()
public:
UFUNCTION(blueprintcallable, category = "cppFuncLib")
static void cppCoordsEq(Fcppcoords coords, Fcppcoords coords1, bool relevantMinus2, bool fastEq, bool& flat_, bool& type_, bool& zone_, bool& house_, bool& section_, bool& floor_, bool& fullEq);
/*returns array of levels for binding*/
UFUNCTION(blueprintcallable, Category = "LevelLoading", meta = (WorldContext = "WorldContextObject"))
TArray<ULevelStreaming*> cppLvlManage(UObject* WorldContextObject, Fcppcoords currentCoords, uint8 currentState);
/*list of lvls for anyway loading*/
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "levelLoading")
TArray<FcppLevelStruct> cppWhiteList;
/*list of lvls for anyway not loading*/
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "levelLoading")
TArray<FcppLevelStruct> cppBlackList;
/*list of coords for regular loading*/
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "LevelLoading")
TArray<Fcppcoords> cppLoadList;
/*list of created level names*/
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "LevelLoading")
TArray<FName> cppCreatedList;
/*list of loaded/loading right now level names*/
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "LevelLoading")
TArray<FName> cpploadedList;
/*list of lvls struct created by levelloader*/
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "levelLoading")
TArray<FcppLevelStruct> cppLevels;
};