#12206 - RaBBi - Mon Nov 03, 2003 10:33 pm
Hi,
Few days ago, I wrote a topic about cut-scenes management (not initially but it changed to it after discussion with Gopher, that I thank ^^, and others).
Then I started to wrote a system.
This needs structs like the following.
One which stores the datas corresponding to the event type.
One which stores the event itself.
The first is used in a union inside the second.
You see it next :
(typedefs.h file)
Then I use a text function (for a dialog event).
So the (*EventFunc) is pointing on it.
(texts.c file)
But when I compile, an error message says :
When I try to use :
for example.
I precise that typedefs.h is included well by the texts.c file.
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^
Few days ago, I wrote a topic about cut-scenes management (not initially but it changed to it after discussion with Gopher, that I thank ^^, and others).
Then I started to wrote a system.
This needs structs like the following.
One which stores the datas corresponding to the event type.
One which stores the event itself.
The first is used in a union inside the second.
You see it next :
(typedefs.h file)
Code: |
typedef union UEventData { struct TEventPrintf { u8 startX, startY, timePause, vitesse; const char *Fmt; } TEventPrintf; // some other structs } UEventData; typedef struct TEvent { // donn?es communes : // liste des events qui doivent etre ? true pour que l'?venement s'enclenche // 5 maxi u8 eventsTrueArray[5]; // 1 indicateur de l'activit? de l'event bool eventActive; // 1 indicateur de la terminaison de l'event // il est mis ? TRUE quand la fonction renvoie TRUE bool eventDone; // 1 union qui contient des structures EventType struct TEventType { // donn?es propres ? l'event : // elles seront transmises/utilis?es par la fonction associ?e UEventData EventData; // un pointeur vers la fonction utilis?e par // cet ?venement // celle-ci doit renvoyer un bool bool (*EventFunc)(UEventData *Data, ...); } TEventType; } TEvent; |
Then I use a text function (for a dialog event).
So the (*EventFunc) is pointing on it.
(texts.c file)
Code: |
bool m_printf_Event(UEventData *Data, ...) |
But when I compile, an error message says :
Code: |
request for member `TEventPrintf' in something not a structure or union |
When I try to use :
Code: |
Data.TEventPrintf.Fmt |
for example.
I precise that typedefs.h is included well by the texts.c file.
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^