Hey,
i would like to expand dynamically an array of structs with an array of Entitys(or any other)....separated from each other.
How to without memory leaks and Errors?
typedef struct Flare
{
int Count;
ENTITY* Ents[1]; // dynamic
} Flare;
Flare* Flares[1]; // -> dynamic
void AllocateNew()
{
Flares = sys_malloc(sizeof(Flare) * 20);
// Later in Code:
Flares[0].Ents = sys_malloc(sizeof(Flare) + (count * sizeof(ENTITY)));
}
Get an unknown Error, if loop through "Ents".