[CODE] obuild.07 enhanced function

From: James \ (thomajam@ucs.orst.edu)
Date: 02/11/97


The following is a command written by me for use with obuild. The 
builders really seem to enjoy it, as it makes life easier for them.

The command is rspan and it works like this:

	rspan <beginning room> <ending room>

	It will copy the room flags and the sector type of the beginning 
	to all rooms within the range of beg room to end room. If those
	rooms happen to not exist, the code will skip over them and will
	not copy the flags.

	It is kind of spammy though, mostly just for warning.

If you would like to use this, go right ahead! I hope you get as much use 
out of it as I and my builders do.

I also, if anyone wants them, rewrote the copy function into three 
different commands, rcopy, mcopy, ocopy, just to make it easier for 
builders. E-mail me if you want them.

Thanks Sammy for writing obuild!

In interpreter.c, with all the ACMD defines, put this:

ACMD(do_rspan);		/* reditmod */

Then in act.build.c, after the rset function, add the following, and 
that's all you'll need to do!

---------------------- ADD WHAT'S BELOW ------------------------------
ACMD(do_rspan)
{
  int rnum, vnum, rnum1, vnum1, i;

  skip_spaces(&argument);
  half_chop(argument, buf1, buf2);

  if (!*buf1 || !*buf2)
  {
    send_to_char("Usage: rspan <copy from> <copy to>\r\n", ch);
    send_to_char("=================================================\r\n",  ch);
    send_to_char("Use this command to copy a range of rooms flags,\r\n", ch);
    send_to_char("and sector types, the copy from room being the\r\n", ch);
    send_to_char("first argument, and the last room being the last\r\n", ch);
    send_to_char("room copied to.\r\n", ch);
    send_to_char("--------------------------------------------------\r\n", ch);
    send_to_char("[RSPAN] by Rasdan, February 10, 1997\r\n", ch);
    return;
  }

  if(ROOM_BUF(ch) < 0) 
  {
    send_to_char("[RSPAN] You are not editing any rooms.\r\n", ch);
    return;
  }

  if (!is_number(buf1) || !is_number(buf2))
  {
    send_to_char("[RSPAN][ERROR] Values must be numbers!\r\n", ch);
    return;
  }

  if (((vnum = atoi(buf1)) < 0) || ((vnum1 = atoi(buf2)) < 0))
  {
    send_to_char("[RSPAN] No negative vnums\r\n", ch);
    return;
  }

  if (vnum > vnum1)
  {
    send_to_char("[RSPAN] The first argument must be smaller than the", ch);
    send_to_char("second\r\n", ch);
    return;
  }

  if(get_zon_num(vnum) != ROOM_BUF(ch) || get_zon_num(vnum1) !=  ROOM_BUF(ch)) 
  {
    send_to_char("[RSPAN] Cannot copy to rooms not in your zone.\r\n", ch);
    return;
  }

  if((rnum = real_room(vnum)) < 0) {
    send_to_char("[RSPAN] ERROR! The first room does not exist!\r\n", ch);
    return;
    }

  for ((i = vnum + 1);i < (vnum1 + 1);i++)
  {
    if ((rnum1 = real_room(i)) < 0)
    {
       sprintf(buf, "Error, Room #%d does not exist skipping to next!\r\n",
                i);
       send_to_char(buf, ch);
     }
    else
     {
       copy_flags(rnum, real_room(i));
       sprintf(buf, "Copying Room #%d flags to Room #%d!\r\n", vnum, i);
       send_to_char(buf, ch);
     }
   }
}

int copy_flags(int src, int dest)
{
  if (src < 0 || dest < 0)
  {
    log("SYSERR:  copy_flags: source or dest. room does not exist!");
    return 1;
  }

  world[dest].room_flags = world[src].room_flags;
  world[dest].sector_type = world[src].sector_type;

  return 0;
}

+-----------------------------------------------------------+
| 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