sooome
This commit is contained in:
@@ -112,6 +112,8 @@ TArray<ULevelStreaming*> UcppGI::cppLvlManage(UObject* WorldContextObject, Fcppc
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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_, §ion_, &floor_ };
|
||||
@@ -138,3 +140,68 @@ void UcppGI::cppCoordsEq(Fcppcoords coords, Fcppcoords coords1, bool relevantMin
|
||||
}
|
||||
|
||||
|
||||
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.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);
|
||||
if (eq) output.Add(flat);
|
||||
}
|
||||
len = output.Num();
|
||||
return output;
|
||||
}
|
||||
|
||||
FcppflatStruct UcppGI::findFlatByCoords_(Fcppcoords coords, bool& success)
|
||||
{
|
||||
success = false;
|
||||
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();
|
||||
success = true;
|
||||
return tt[0];
|
||||
}
|
||||
|
||||
TArray<FcppflatStruct> UcppGI::findFlatsByN_(int num, bool& success)
|
||||
{
|
||||
success = false;
|
||||
auto output = TArray<FcppflatStruct>();
|
||||
for (auto& flat : flatArray) {
|
||||
if (flat.FlatN == num) output.Add(flat);
|
||||
}
|
||||
|
||||
success = !output.IsEmpty();
|
||||
return output;
|
||||
}
|
||||
|
||||
void UcppGI::countFreeApartments(Fcppcoords coords, int& free, int& all, float& minPrice)
|
||||
{
|
||||
int len;
|
||||
free = 0;
|
||||
minPrice = 0;
|
||||
bool temp=false;
|
||||
for (auto& flat : getFlatArr_(coords, len)) {
|
||||
if (flat.available) {
|
||||
if (!temp) {
|
||||
minPrice = flat.Price;
|
||||
temp = true;
|
||||
}
|
||||
free++;
|
||||
if (flat.Price < minPrice) minPrice = flat.Price;
|
||||
}
|
||||
}
|
||||
minPrice /= 1000000;
|
||||
all = len;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user