The below works wonderfully, but I'm getting a compiler warning.

tables.c:42: warning: missing braces around initializer
tables.c:42: warning: (near initialization for `clan_table[0].division')

/* for clans */
const struct clan_type clan_table[MAX_CLAN] = {
    /*  name,  who entry,  division 1 name, division 2 name, DT room,
independent */
    {"", "",  "", "", ROOM_VNUM_ALTAR, TRUE},      (Line 42)
    {"loner", "[ Loner ]", "", "", ROOM_VNUM_ALTAR, TRUE},
    {"admin", "[ADMIN]", "Architect", "Administrator", ROOM_VNUM_ALTAR, FALSE},
....
};

Do I need to make them look like:
    {"", "",  ["", ""], ROOM_VNUM_ALTAR, TRUE}, (Line 42)?

It only gives that one warning about line 42 and no others.


> #define NUMBER_OF_DIVISIONS 2
> struct clan_type
> {
>     ...
>     char        *division[NUMBER_OF_DIVISIONS];
>     ...
> };
>
> The clan table would be initialized exactly the same way as before,
> when you had multiple char * variables in the structure.  The only
> difference is the naming of those variables.
>
> You could then refer to it as:
> clan_table[ch->clan].division[ch->clandivision]
>
> And since arrays are 0-based, you'd want to start your division numbers
> at 0, and pick another number such as -1 to indicate no division.


Reply via email to