Re: Defining a list of structs....

From: George (greerga@CIRCLEMUD.ORG)
Date: 10/22/98

On Thu, 22 Oct 1998, Jourge Fuzz Bush wrote:

>Well I really don't know what this is called but what I did was the
>struct obj_data *bodybagobjs[] =
>{ { "\0" } }
>Well I did have NULL in there but when I put null in there it crashes my
>mud when ever someone dies. (When the bodybag is created given to the
>morgatition and then saved in this struct) But this one give out
>warnings about incompatible types. Anyone got any idea what I can put in

This is a statically allocated structure, it doesn't magically grow when
you try to put things in it.  Try CREATE() and free() instead.

struct obj_data **bodybagobjs;

CREATE(bodybagobjs, sizeof(struct obj_data *), num_of_items);

for (iterator = 0; iterator < num_of_items; iterator++)
  CREATE(bodybagobjs[iterator], sizeof(struct obj_data), 1);

NOTE: You may not need the for(i)/CREATE(i) stuff depending on what you do
with it.

George Greer, | Genius may have its limitations, but   (mostly) | stupidity is not thus handicapped.    |                  -- Elbert Hubbard

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/15/00 PST