--- Jeremy Hill <[EMAIL PROTECTED]> wrote:
[SNIP]
> I decided to move the actions into a table that looks like (structure and
> table):
> struct event_action_type
> {
>     char *name;
>     sh_int *pea; //Pointer-to-Event-Action [number]
> };
> 
> const struct event_action_type event_action_table[] =
> {
>     {"print", &ea_print},
>     {"wait", &ea_wait},
>     {"act", &ea_act},
>     {"function", &ea_function},
>     {"kill_menu", &ea_killmenu},
>     {"NULL", NULL}
> };


Looks good so far....


[SNIP]

> 
> In the meantime, I have run into a serious problem.  In event_update, a
> switch statement is used
> to see what the ev->action is.  My cases are ea_print, ea_wait, etc, but I
> cannot use them as
> case labels.  Eg.:
> 
> switch (ev->action)
>     case ea_print:
> 
> This obviously won't work.
[SNIP]

Hrm.. Just curious, but what do you need this switch statement for?? I
shouldn't think you need it, as you already have a function pointer for what
you want the event to do, so just call the event's function and move on to the
next one..

If you can show what you're trying to do in this switch, I may be able to
suggest a better design..

~Kender

=====
-----BEGIN GEEK CODE BLOCK-----
Version 3.1
GCS/L/C/O d-(+) s++: a-- C+++$>++++ UBLS++++$ 
P+++(--)$ L+++>++++ E--- W+>++$ N !o K? w(--) !O 
M- !V PS+ PE(++) Y+ PGP->+ t+ 5 X+() R(+) tv+@ 
b++(+++) !DI+++ D G(-) e>+++$ h---() r+++ y+++
------END GEEK CODE BLOCK------

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Reply via email to