So, finally i was able to test it and it is working now.
But not for long
.
My Struct also contains a pointer to another Struct(array):
typedef struct
{
[...]
var harpoint_counter; // Max number of weapons for the turret
var* vertex_numbers; // Array for the vertex of the model
[...]
WEAPON* t_guns;
[...]
} TURRET;
I use this part of code to allocate enough memory for all WEAPON Pointers
for(i=0;i< Basisturret.harpoint_counter;i++)
{
(Basisturret.t_guns)[i] = setup_template_weapon(Basiswaffe);
}
"setup_template_weapon" creates a new WEAPON struct and uses memcpy to copy the stats of Basiswaffe and finally returns the pointer of the new created struct.
This for loop should create one independant copy of "Basiswaffe" for each hardpoint and copy its pointer to the Structarray "(Basisturret.t_guns)[i]".
I use this line to allocate enough memory for the structpointerarry:
Basisturret.t_guns = (WEAPON*)sys_malloc(Basisturret.t_gun_amount*sizeof(WEAPON));
But now i get the Error Message "Can not convert 'Pointer' to 'struct Weapon'" for the line within the for loop.
(Basisturret.t_guns)[i] = setup_template_weapon(Basiswaffe);
I think I'm making a "simple" mistake here but i cant figure out what.
Thank you