Hello everyone,
I want to build a modified version of the TArray. I know that I only need a maximum of 250 objects per TArray which i have got 1.000 per container. I am accessing them like this:
uint8 index[40][40][40];
TArray<object> data[10][10][10];
object& GetData(int8 x, int8 y, int8 z)
{
int8 ix = floor(x / 4);
int8 iy = floor(y / 4);
int8 iz = floor(z / 4);
return data[ix][iy][iz][index[x][y][z]];
}
- I want my short TArrays to have arrayNum and arrayMax changed to uint8 type (I don’t need 4 bytes per value). This is the easy part. But do I have to pay attention to something else if I do so? Does it affect memory allocation in some way or will the unsigned type cause problems?
- I need a uint8-TArray value in the uint8-TArray, to store indices of “removed” objects or better the indices of objects that can bo overwritten. If I remove them completely out of memory, I would habe to change the indices in the static array which is no fun.
- To prevent an endless loop of uint8-TArrays creating itself again and again I will need one vesion with and one without uint8-TArray in it. The one with contains the one without.
I do not want to know if it makes sense but how it’s done. I am struggling most with line 24 to 262 of array.h. I am not getting quiet through this and wondering if I can remove this in my modified copy and include “array.h” instead.
Thanks for your help