Hi all!

Ok, this had me confused for a while. I have figured it out but I don't know why it works this way, since the manual states otherwise.

Here is the thing: I have defined the following struct.

Code:

typedef struct
{
PANEL* p;
var row;
var col;
} Card;



When I know try to access the panel pointer, I have to do it in a special way. In the next example "card" is an array of card pointers:

Code:

(card[i])->p = pan_create("bmap = card_base", 1); // works fine
((card[i])->p).pos_x = 25; // does NOT work, instead it overwrites (card[i])->p
((card[i])->p)->pos_x = 25; // works as intended



So it seems in this case I have to use the -> and not the . to access the structure. However, the manual states:

Quote:


In standard C / C++, members of structs are accessed by a dot '.' and members of struct pointers are accessed by an arrow '->'. In lite-C or C-Script the compiler automatically detects whether it's a struct or a struct pointer, and the dot '.' can be used for both.





So, is this a bug? Or was I doing something wrong? Anyway, I am glad this works now, it had me confused for a while. By the way, if I declare a global panel pointer "test" and use this one with test.pos_x etc. everything works.

Gnometech


Download our playable Movement & Interaction Tutorial for 3DGS here:
http://www.puppenheim.org/MITutorial.zip