updates
This commit is contained in:
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.
@@ -145,15 +145,15 @@ TArray<FcppflatStruct> UcppGI::getFlatArr_(Fcppcoords coords, int& len)
|
||||
auto output = TArray<FcppflatStruct>();
|
||||
for (auto& flat : flatArray) {
|
||||
auto flatcoords = Fcppcoords();
|
||||
flatcoords.flat = coords.floor < 0 ? -2 : flat.FlatId; //ignore flat
|
||||
flatcoords.floor =coords.floor<0?-2: flat.Floor;
|
||||
flatcoords.flat = coords.flat < 0 ? -2 : flat.FlatId; //ignore flat
|
||||
flatcoords.floor = coords.floor < 0 ? -2 : flat.Floor;
|
||||
flatcoords.house = coords.house < 1 ? -2 : flat.House;
|
||||
flatcoords.section = coords.section < 1 ? -2 : flat.Section;
|
||||
flatcoords.type = coords.type < 0 ? -2 : flat.flatType;
|
||||
flatcoords.zone = coords.zone < 1 ? -2 : flat.Zone;
|
||||
bool dummy[6];
|
||||
|
||||
bool eq;
|
||||
cppCoordsEq(coords, flatcoords, true, false, dummy[0], dummy[1], dummy[2], dummy[3], dummy[4], dummy[5], eq);
|
||||
cppCoordsEq(coords, flatcoords, true, false, boolDummy, boolDummy, boolDummy, boolDummy, boolDummy, boolDummy, eq);
|
||||
if (eq) output.Add(flat);
|
||||
}
|
||||
len = output.Num();
|
||||
@@ -166,21 +166,27 @@ FcppflatStruct UcppGI::findFlatByCoords_(Fcppcoords coords, bool& success)
|
||||
if (coords.flat < 0) return FcppflatStruct();
|
||||
int len;
|
||||
auto tt = getFlatArr_(coords, len);
|
||||
if (len>1) UE_LOG(LogCore, Warning, TEXT("UcppGI::findFlatByCoords: found more than one flat"));
|
||||
if (len==0) return FcppflatStruct();
|
||||
if (len > 1) UE_LOG(LogCore, Warning, TEXT("UcppGI::findFlatByCoords: found more than one flat"));
|
||||
if (len == 0) return FcppflatStruct();
|
||||
success = true;
|
||||
return tt[0];
|
||||
}
|
||||
|
||||
TArray<FcppflatStruct> UcppGI::findFlatsByN_(int num, bool& success)
|
||||
FcppflatStruct UcppGI::findFlatByN_(Fcppcoords filter, int num, bool& success)
|
||||
{
|
||||
success = false;
|
||||
auto output = TArray<FcppflatStruct>();
|
||||
for (auto& flat : flatArray) {
|
||||
if (flat.FlatN == num) output.Add(flat);
|
||||
filter.flat = -2;
|
||||
auto output = FcppflatStruct();
|
||||
|
||||
auto arr = getFlatArr_(filter, intDummy);
|
||||
for (auto& flat : arr) {
|
||||
if (flat.FlatN == num) {
|
||||
if (!success) output = flat;
|
||||
else UE_LOG(LogCore, Warning, TEXT("UcppGI::findFlatByN_: found more than one flat"));
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
|
||||
success = !output.IsEmpty();
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -189,7 +195,7 @@ void UcppGI::countFreeApartments(Fcppcoords coords, int& free, int& all, float&
|
||||
int len;
|
||||
free = 0;
|
||||
minPrice = 0;
|
||||
bool temp=false;
|
||||
bool temp = false;
|
||||
for (auto& flat : getFlatArr_(coords, len)) {
|
||||
if (flat.available) {
|
||||
if (!temp) {
|
||||
@@ -205,3 +211,30 @@ void UcppGI::countFreeApartments(Fcppcoords coords, int& free, int& all, float&
|
||||
return;
|
||||
}
|
||||
|
||||
void UcppGI::cppFlatTocppCoords(FcppflatStruct flat, Fcppcoords& coords)
|
||||
{
|
||||
coords.flat = flat.FlatId;
|
||||
coords.floor = flat.Floor;
|
||||
coords.house = flat.House;
|
||||
coords.section = flat.Section;
|
||||
coords.type = flat.flatType;
|
||||
coords.zone = flat.Zone;
|
||||
}
|
||||
|
||||
void UcppGI::cppCoordsToCppFlat(UObject* WorldContextObject, Fcppcoords coords, FcppflatStruct& flat, bool onlyCoords)
|
||||
{
|
||||
if (onlyCoords) {
|
||||
flat.FlatId = coords.flat;
|
||||
flat.Floor = coords.floor;
|
||||
flat.House = coords.house;
|
||||
flat.Section = coords.section;
|
||||
flat.flatType = coords.type;
|
||||
flat.Zone = coords.zone;
|
||||
return;
|
||||
}
|
||||
bool dum;
|
||||
|
||||
flat = StaticCastPtr<UcppGI,UGameInstance>(UGameplayStatics::GetGameInstance(WorldContextObject))->findFlatByCoords_(coords, dum);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -17,64 +17,64 @@ struct FcppflatStruct
|
||||
public:
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "FlatId", MakeStructureDefaultValue = "-1"))
|
||||
int32 FlatId;
|
||||
int32 FlatId=-1;
|
||||
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "flatType", MakeStructureDefaultValue = "0"))
|
||||
int32 flatType;
|
||||
int32 flatType=0;
|
||||
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Flat#", MakeStructureDefaultValue = "-1"))
|
||||
int32 FlatN;
|
||||
int32 FlatN=-1;
|
||||
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Zone", MakeStructureDefaultValue = "-1"))
|
||||
int32 Zone;
|
||||
int32 Zone=-1;
|
||||
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "House", MakeStructureDefaultValue = "-1"))
|
||||
int32 House;
|
||||
int32 House=-1;
|
||||
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Section", MakeStructureDefaultValue = "-1"))
|
||||
int32 Section;
|
||||
int32 Section = -1;
|
||||
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Floor", MakeStructureDefaultValue = "-1"))
|
||||
int32 Floor;
|
||||
int32 Floor = -1;
|
||||
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Rooms", MakeStructureDefaultValue = "-1"))
|
||||
int32 Rooms;
|
||||
int32 Rooms = -1;
|
||||
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Square", MakeStructureDefaultValue = "0.000000"))
|
||||
double Square;
|
||||
double Square = 0;
|
||||
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "Price", MakeStructureDefaultValue = "0"))
|
||||
int32 Price;
|
||||
int32 Price=0;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "whitePrice", MakeStructureDefaultValue = "0"))
|
||||
int32 whitePrice;
|
||||
int32 whitePrice=0;
|
||||
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "price-meter", MakeStructureDefaultValue = "0"))
|
||||
int32 price_meter;
|
||||
int32 price_meter=0;
|
||||
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "available", MakeStructureDefaultValue = "True"))
|
||||
bool available;
|
||||
bool available=false;
|
||||
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "tags"))
|
||||
TArray<bool> tags;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "deadline"))
|
||||
FIntPoint deadline;
|
||||
FIntPoint deadline=FIntPoint(0);
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (DisplayName = "comment"))
|
||||
FString comment;
|
||||
FString comment="";
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "cppGI.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
@@ -15,18 +15,18 @@ struct Fcppcoords
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, category = "default")
|
||||
int32 flat = -1;
|
||||
UPROPERTY(BlueprintReadWrite, category = "default")
|
||||
int32 type = 0;
|
||||
int32 flat = -1;
|
||||
UPROPERTY(BlueprintReadWrite, category = "default")
|
||||
int32 zone = 1;
|
||||
int32 type = 0;
|
||||
UPROPERTY(BlueprintReadWrite, category = "default")
|
||||
int32 house = -1;
|
||||
int32 zone = 1;
|
||||
UPROPERTY(BlueprintReadWrite, category = "default")
|
||||
int32 section = -1;
|
||||
int32 house = -1;
|
||||
UPROPERTY(BlueprintReadWrite, category = "default")
|
||||
int32 floor = -1;
|
||||
int32 section = -1;
|
||||
UPROPERTY(BlueprintReadWrite, category = "default")
|
||||
int32 floor = -1;
|
||||
};
|
||||
|
||||
|
||||
@@ -35,18 +35,18 @@ struct FcppLevelStruct
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
Fcppcoords coords;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
bool dontUnload = false;
|
||||
Fcppcoords coords;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FString path;
|
||||
bool dontUnload = false;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
float Z = 0;
|
||||
FString path;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int32 anotherLvl = -1;
|
||||
float Z = 0;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FName uniqName;
|
||||
int32 anotherLvl = -1;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FName uniqName;
|
||||
};
|
||||
|
||||
UCLASS()
|
||||
@@ -54,53 +54,61 @@ 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);
|
||||
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*/
|
||||
|
||||
/*returns array of levels for binding*/
|
||||
UFUNCTION(blueprintcallable, Category = "LevelLoading", meta = (WorldContext = "WorldContextObject"))
|
||||
TArray<ULevelStreaming*> cppLvlManage(UObject* WorldContextObject, Fcppcoords currentCoords, uint8 currentState);
|
||||
|
||||
/*return array filtered by coords, coord<0 for floor and <1 for other is ignore the one*/
|
||||
UFUNCTION(blueprintcallable, category = "Data")
|
||||
TArray<FcppflatStruct> getFlatArr_(Fcppcoords coords, int& len);
|
||||
TArray<ULevelStreaming*> cppLvlManage(UObject* WorldContextObject, Fcppcoords currentCoords, uint8 currentState);
|
||||
|
||||
|
||||
UFUNCTION(blueprintcallable, category = "Data")
|
||||
FcppflatStruct findFlatByCoords_(Fcppcoords coords, bool& success);
|
||||
/*return array filtered by coords, coord<0 for (floor,flat,type) and <1 for other is ignore the one*/
|
||||
UFUNCTION(blueprintcallable, category = "Data")
|
||||
TArray<FcppflatStruct> getFlatArr_(Fcppcoords coords, int& len);
|
||||
|
||||
/*return array with flats with specified number
|
||||
(may be from different houses if not sequetnal numeration)*/
|
||||
UFUNCTION(blueprintcallable, category = "Data")
|
||||
TArray<FcppflatStruct> findFlatsByN_(int num, bool& success);
|
||||
|
||||
/*coord=-2 is ignore the one, price is millions*/
|
||||
UFUNCTION(blueprintcallable, category = "Data")
|
||||
void countFreeApartments(Fcppcoords coords,int& free,int& all,float& minPrice);
|
||||
UFUNCTION(blueprintcallable, category = "Data")
|
||||
FcppflatStruct findFlatByCoords_(Fcppcoords coords, bool& success);
|
||||
|
||||
/*flatId is ignoring, filter is optional*/
|
||||
UFUNCTION(blueprintcallable, category = "Data")
|
||||
FcppflatStruct findFlatByN_(Fcppcoords filter, int num, bool& success);
|
||||
|
||||
/*coord<0 for (floor,flat,type) and <1 for other is ignore the one, price is millions*/
|
||||
UFUNCTION(blueprintcallable, category = "Data")
|
||||
void countFreeApartments(Fcppcoords coords, int& free, int& all, float& minPrice);
|
||||
|
||||
UFUNCTION(blueprintcallable,blueprintPure, category = "Data",meta=( BlueprintAutocast))
|
||||
static void cppFlatTocppCoords(FcppflatStruct flat, Fcppcoords& coords);
|
||||
|
||||
/*if onlyCoords false then same as find flat by coords*/
|
||||
UFUNCTION(blueprintcallable, blueprintPure, category = "Data", meta = (WorldContext = "WorldContextObject", BlueprintAutocast))
|
||||
static void cppCoordsToCppFlat(UObject* WorldContextObject,Fcppcoords coords,FcppflatStruct& flat,bool onlyCoords=true );
|
||||
|
||||
/*list of lvls for anyway loading*/
|
||||
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "levelLoading")
|
||||
TArray<FcppLevelStruct> cppWhiteList;
|
||||
TArray<FcppLevelStruct> cppWhiteList;
|
||||
/*list of lvls for anyway not loading*/
|
||||
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "levelLoading")
|
||||
TArray<FcppLevelStruct> cppBlackList;
|
||||
TArray<FcppLevelStruct> cppBlackList;
|
||||
/*list of coords for regular loading*/
|
||||
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "LevelLoading")
|
||||
TArray<Fcppcoords> cppLoadList;
|
||||
TArray<Fcppcoords> cppLoadList;
|
||||
/*list of created level names*/
|
||||
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "LevelLoading")
|
||||
TArray<FName> cppCreatedList;
|
||||
TArray<FName> cppCreatedList;
|
||||
/*list of loaded/loading right now level names*/
|
||||
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "LevelLoading")
|
||||
TArray<FName> cpploadedList;
|
||||
TArray<FName> cpploadedList;
|
||||
/*list of lvls struct created by levelloader*/
|
||||
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "levelLoading")
|
||||
TArray<FcppLevelStruct> cppLevels;
|
||||
/*list of all flats in project*/
|
||||
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "Data")
|
||||
TArray<FcppflatStruct> flatArray;
|
||||
TArray<FcppLevelStruct> cppLevels;
|
||||
/*list of all flats in project*/
|
||||
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "Data")
|
||||
TArray<FcppflatStruct> flatArray;
|
||||
|
||||
|
||||
private:
|
||||
bool boolDummy;
|
||||
int intDummy;
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user