[circle][code]Cook and Fillet Skills

From: Roger Barlow (roger@the-link.net)
Date: 12/14/96


I'm haveing the strangest problem and i was wondering if perhaps
any of you guys could/would help. I implemented a fillet and a 
cook skill on my mud but evry time i use the cook skill it crashes
the mud. I think its a memory issue because when i run the mud after the
crash it crashes before i even connect. The error GDB gives is:

Program received signal SIGPIPE, Broken pipe.
0x4001aab8 in spell_info ()


If i'm not mistaken it should be pretty much drop-in code except for the
skill assighnments (which i know i have right, ive checked over and over).
Any help is greatly appreciated.

The offending code for the skills is:



ACMD(do_fillet) {
  struct obj_data *obj, *fillet;
  char name[50];

  one_argument(argument, arg);

  if (!*arg)
    send_to_char("fillet what?\r\n", ch);
  else if (!(obj = get_obj_in_list_vis(ch, arg, world[ch->in_room].contents))) {
    sprintf(buf, "I can't seem to find %s %s.\r\n", AN(arg), arg);
    send_to_char(buf, ch);
  } else if (GET_OBJ_TYPE(obj) != ITEM_CONTAINER || GET_OBJ_VAL(obj, 3) != 1) {
    send_to_char("You can't fillet that.\r\n", ch);
  } else {
    if (number(1, 101) > GET_SKILL(ch, SKILL_FILLET)) {
	send_to_char("You can't seem to find the right place to cut.", ch);
    } else {
	fillet = create_obj();
	fillet->item_number = NOTHING;	
	fillet->in_room = NOWHERE;
	fillet->name = str_dup("fillet");
	strcpy(name, "a fillet ");
	strcat(name, strstr(obj->description, "of"));
	fillet->description = str_dup(name);
	strcpy(name, "a fillet ");
	strcat(name, strstr(obj->short_description, "of"));
	fillet->short_description = str_dup(name);
	GET_OBJ_TYPE(fillet) = ITEM_FOOD;
	GET_OBJ_WEAR(fillet) = ITEM_WEAR_TAKE;
	GET_OBJ_EXTRA(fillet) = 0;
	GET_OBJ_VAL(fillet, 0) = 8;
	GET_OBJ_VAL(fillet, 3) = 1;
	GET_OBJ_WEIGHT(fillet) = 1;
	GET_OBJ_TIMER(fillet) = 0;
	GET_OBJ_TIMER(obj) -= 5;
	obj_to_char(fillet, ch);
	act("$n fillets $p.", FALSE, ch, obj, 0, TO_ROOM);
	act("You fillet $p.", FALSE, ch, obj, 0, TO_CHAR);
    }
  }
}

ACMD(do_cook) {
  struct obj_data *obj;

  one_argument(argument, arg);

  if (!*arg)
    send_to_char("Cook what?\r\n", ch);
  else if (!(obj = get_obj_in_list_vis(ch, arg, ch->carrying))) {
    sprintf(buf, "I can't seem to find %s %s.\r\n", AN(arg), arg);
    send_to_char(buf, ch);
  } else if (GET_OBJ_TYPE(obj) != ITEM_FOOD)	{
    send_to_char("You can't cook that.\r\n", ch);
  } else {
    act("$n cooks $p.", FALSE, ch, obj, 0, TO_ROOM);
    act("You cook $p.", FALSE, ch, obj, 0, TO_CHAR);
    if (GET_OBJ_VAL(obj, 2) == 0 && number(1, 101) <= GET_SKILL(ch, SKILL_COOK)) {
	GET_OBJ_VAL(obj, 3) = 0;
	GET_OBJ_VAL(obj, 2) = 1;
	strcat(obj->short_description, " (fully cooked)");
    }
  }
}


+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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