[CODE] do_mobcopy

From: Xual (xual@SATANSPAWN.ML.ORG)
Date: 10/13/98


Hi all,

        I wrote this command, which is supposed to copy one mobile to
another pre-existing prototype.  Everything seems to work okay until I try
to edit the mob, load it and purge it, or vstat it a couple of times.  I
am using bpl14, and the dg_pl5a_with_oasis system.  gdb tells me that
whatever I try to do to the prototype is responsible for the crash, but
I'm positive I just forgot something stupid in the command...

ACMD(do_mobcopy)
{
  extern struct char_data *mob_proto;
  int from, to, t_rnum, f_rnum;
  char arg1[20];
  char arg2[20];

  argument = two_arguments(argument, arg1, arg2);

  if ((!*arg1 || !*arg1) || (!is_number(arg1) || !is_number(arg2))) {
    send_to_char("Useage:  mobcopy <from vnum> <to vnum>\r\n", ch);
    return;
  }

  from = atoi(arg1);
  to = atoi(arg2);
  f_rnum = real_mobile(from);
  t_rnum = real_mobile(to);

  if (from <= 0 || to <=0) {
    send_to_char("No negative numbers please!\r\n", ch);
    return;
  }
  if ((!(mob_proto + t_rnum)) || (!(mob_proto + f_rnum))) {
    send_to_char("There are no mobs with that number\r\n", ch);
    return;
  }
  copy_mobile((mob_proto + t_rnum), (mob_proto + f_rnum));
  mob_index[t_rnum].vnum = to;
  olc_add_to_save_list((to/100), OLC_SAVE_MOB);

  send_to_char("Okay.\r\n", ch);
  return;
}

        There's probably a bunch of stuff I forgot in the way of sanity
checking, I'd just like to get it working before I worry about that.

Thanx in advance

Xual


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



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