On Thu, Jun 13, 2002 at 04:40:21PM -0500, Kyle wrote:
> Ok, this is a weird one.  When I call create_object from the following 
> function, I get a segmentation fault.  Everything compiles fine, no 
> warnings (for that function), but it crashes right when it goes to create 
> the object for "pammo".  I know OBJ_VNUM_AMMO exists, and the index seems 
> to be created successfully.  Any ideas?
> 
> The function:
> 
> OBJ_DATA * create_ammo( OBJ_DATA *obj )
> {
>      OBJ_DATA *pammo;
>      OBJ_INDEX_DATA *pAmmoIndex;
>      int i;
> 
>      printf("create_ammo() engaged...\n");
>      if (obj == NULL)
>      {
>       bug("Bad obj for create_ammo.",0);
>       return NULL;
>      }
> 
>      if (obj->value[2] == 0)
>      {
>       bug("Bad obj for create_ammo.  Obj exists, but has no ammo type.",0);
>       return NULL;
>      }
> 
>      printf("Creating ammo index...\n");
>      pAmmoIndex = get_obj_index(OBJ_VNUM_AMMO);
       if ((pAmmoIndex = get_obj_index(OBJ_VNUM_AMMO))==NULL) {
        char s[MAX_STRING_LENGTH];
        sprintf(s,"Couldn't find OBJ_VNUM_AMMO (vnum #%d)",OBJ_VNUM_AMMO);
        bug(s);
        return NULL;
       }

Does it now abort earlier?

Edwin

-- 
Edwin Groothuis      |           Personal website: http://www.MavEtJu.org
[EMAIL PROTECTED]    |        Interested in MUDs? Visit Fatal Dimensions:
bash$ :(){ :|:&};:   |                    http://www.FatalDimensions.org/

Reply via email to