обновы какие то

This commit is contained in:
2024-07-02 18:54:36 +05:00
parent 87bcdc6242
commit f8cb05c514
175 changed files with 317 additions and 131 deletions
+13 -46
View File
@@ -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.flat < 0 ? -2 : flat.FlatId; //ignore flat
flatcoords.floor = coords.floor < 0 ? -2 : flat.Floor;
flatcoords.flat = coords.floor < 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, boolDummy, boolDummy, boolDummy, boolDummy, boolDummy, boolDummy, eq);
cppCoordsEq(coords, flatcoords, true, false, dummy[0], dummy[1], dummy[2], dummy[3], dummy[4], dummy[5], eq);
if (eq) output.Add(flat);
}
len = output.Num();
@@ -166,27 +166,21 @@ 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: GP%d-S%d-F%d-A%d"),coords.house,coords.section,coords.floor,coords.flat);
if (len==0) return FcppflatStruct();
success = true;
return tt[0];
}
FcppflatStruct UcppGI::findFlatByN_(Fcppcoords filter, int num, bool& success)
TArray<FcppflatStruct> UcppGI::findFlatsByN_(int num, bool& success)
{
success = false;
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;
}
auto output = TArray<FcppflatStruct>();
for (auto& flat : flatArray) {
if (flat.FlatN == num) output.Add(flat);
}
success = !output.IsEmpty();
return output;
}
@@ -195,7 +189,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) {
@@ -211,30 +205,3 @@ 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);
}