fix some bug with remvoing items, add experimental stat saving for gadgets, fix shadow stones scuffy
This commit is contained in:
Milxnor
2023-05-07 22:30:56 -04:00
parent 3405177d20
commit bfe2610a11
18 changed files with 281 additions and 104 deletions

View File

@@ -71,6 +71,20 @@ public:
ArrayMax = v3;
}
int AddUnitialized2(SIZE_T NumBytesPerElement = sizeof(InElementType))
{
const int OldArrayNum = ArrayNum;
ArrayNum = OldArrayNum + 1;
if (ArrayNum > ArrayMax)
{
ResizeArray(ArrayNum, NumBytesPerElement);
}
return OldArrayNum;
}
void CopyFromArray(TArray<InElementType>& OtherArray, SIZE_T NumBytesPerElement = sizeof(InElementType))
{
if (!OtherArray.ArrayNum && !ArrayMax)
@@ -292,6 +306,18 @@ public:
return -1;
}
void FreeGood(SizeType Size = sizeof(InElementType))
{
static void (*FreeOriginal)(void* Original) = decltype(FreeOriginal)(Addresses::Free);
if (FreeOriginal)
FreeOriginal(Data);
Data = nullptr;
ArrayNum = 0;
ArrayMax = 0;
}
void FreeReal(SizeType Size = sizeof(InElementType))
{
if (!IsBadReadPtr(Data, 8) && ArrayNum > 0 && sizeof(InElementType) > 0)