Hello for some reason I crash when i drop/eat/purge any crafted items and I'm not sure why….been looking at it for hours thought maybe someone here could help me out.
void do_craft (CHAR_DATA *ch, char *argument) { OBJ_DATA *chunk; OBJ_DATA *item; int ore_weight = 0; int typ; int ore; char buf[MSL]; char arg1[MSL]; char arg2[MSL]; bool excess = FALSE; int percent; int chance = number_percent();
struct forge_type { char * name; sh_int type; int wear_loc; sh_int weap_typ; int ore_min; };
sprintf (buf, "You begin to craft the %s.\n\r", forge_table[typ].name); act (buf, ch, NULL, NULL, TO_CHAR ); act ("$n begins to craft something.", ch, NULL, NULL, TO_ROOM);
if (percent < chance - 40) /* Kablooey! */ { send_to_char ("The forge blows up in your face!\n\r", ch); spell_fireball(skill_lookup("fireball"), 200, ch,NULL,TARGET_CHAR); return; }
act ("You continue to hammer away at your creation…", ch, NULL, NULL, TO_CHAR ); act ("$n hammers away.", ch, NULL, NULL, TO_ROOM);
if (percent < chance - 30) /* Not quite… */ { send_to_char ("Your hammer strike splits your piece in two!\n\r", ch); return; }
sprintf (buf, "The %s is now taking shape…", forge_table[typ].name); act (buf, ch, NULL, NULL, TO_CHAR ); act ("$n continues to work.", ch, NULL, NULL, TO_ROOM);
if (percent < chance - 20) /* Oops… */ { sprintf (buf, "The %s appears to be too flimsy to use.", forge_table[typ].name); send_to_char (buf, ch); send_to_char ("Frustratedly, you discard the piece.\n\r", ch); return; }
sprintf (buf, "You put the final touches on the %s…", forge_table[typ].name); act (buf, ch, NULL, NULL, TO_CHAR ); act ("$n continues to work.", ch, NULL, NULL, TO_ROOM);
if (percent < chance - 10) /* No Cigar */ { sprintf (buf, "You slip and damage the %s beyond repair!", forge_table[typ].name); send_to_char (buf, ch); send_to_char ("Frustratedly, you discard the piece.\n\r", ch); return; }
/* Good job! */ sprintf(buf, "%s\n\r", chunk->short_descr); send_to_char (buf, ch);