Dynamic array within (unmanaged) struct

Started by wynni2, Mon 21/01/2019 01:27:01

Previous topic - Next topic

wynni2

Hi -

Can regular structs contain dynamic arrays?

I'm trying to make an array of integers inside of each room, with the size of the array proportional to the size of the room. I've tried declaring a struct containing a dynamic array int rsize[], but when I try to initialize the struct the game crashes.

In the manual it states explicitly that managed structs can't contain dynamic arrays, but the documentation on regular structs is a little more vague. I see older technical threads saying that dynamic arrays don't work in regular structs, but I just want to be sure that I'm not missing anything in the newer versions of AGS.

Thanks as always.

Crimson Wizard

Yes, regular structs can contain dynamic arrays, since AGS 3.4.0.

Quote
the size of the array proportional to the size of the room. I've tried declaring a struct containing a dynamic array int rsize[], but when I try to initialize the struct the game crashes.

Please, when it comes to crashes, always give actual error message and post your script if possible.

SMF spam blocked by CleanTalk