CODE/HELP: Adding a new Zone Command

From: Brian Menges (menges@niesten.arc.nasa.gov)
Date: 07/06/96


Well, for some strange reason my pervious mail got cut in half. :(  Here is the
complete mail (hopefully).

I am trying to add a new zone command but I am a little confused with the way
the current zone commands work.  I have added mounts into my MUD and I want to
make it so you can mount one mobile onto a another.  The format I set up is
very similiar to the format for putting an object in another.  It looks like
this

N <if_flag> <mob_rider> <max_existing> <mount>

So, you have to load the <mount> before you call the mount command in the zone
file.

Here is what I have so far:

In db.c

    case 'M':			/* read a mobile */
      if (mob_index[ZCMD.arg1].number < ZCMD.arg2) {
	mob = read_mobile(ZCMD.arg1, REAL);
	char_to_room(mob, ZCMD.arg3);
	last_cmd = 1;
      } else
	last_cmd = 0;
      break;

    case 'N':			/* mobile on mount */
      if (mob_index[ZCMD.arg1].number < ZCMD.arg2)      <--- What does this do?
      {
	mob = read_mobile(ZCMD.arg1, REAL);
	if (!(mount = read_mobile(ZCMD.arg3,REAL)))
	{
	  ZONE_ERROR("target mount not found");
	  break;
	}
	if(GET_CLASS(mount) != CLASS_MOUNT)
	{
	  ZONE_ERROR("attempt to mount on a NON-mount mob");
	  break;
	}
	mob_to_mount(mob, mount);
	last_cmd = 1;
      }
      else
	last_cmd = 0;
      break;

    case 'O':			/* read an object */
      if (obj_index[ZCMD.arg1].number < ZCMD.arg2) {
	if (ZCMD.arg3 >= 0) {
	  obj = read_object(ZCMD.arg1, REAL);



It never gets past :

    if (mob_index[ZCMD.arg1].number < ZCMD.arg2)

I'm not sure exactly what this line does.

Here is the mob_to_mount function in handler.c I wrote:


/* put a mobile on a mount (quaint)  */
void mob_to_mount(struct char_data * mob, struct char_data * mount)
{
  int in_room;

  if (!mob || !mount || mob == mount)
  {
    log("SYSERR: NULL mobile or same source and target mount passed to
mob_to_mount");
    return;
  }

  if(MOUNTED(mount) != 0)
  {
    log("SYSERR: Mount not free.  Attempting to mount a mobile on a non-free
mount.");
    return;
  }

  char_to_room(mob, mount->in_room);
  MOUNTED(mount) = mob;
  MOUNTED(mob) = mount;

  GET_POS(mob) = POS_MOUNTED;

}


I have been banging my head against the wall on this one.  I don't reall
understand the code for zone files too well.  Any help on this would be greatly
appreciated.












-- 
"Take my advice and go back to the time	| Brian Menges
you came from.  The future isn't what 	| NASA Ames Research Center
it used to be."--G'kar, "The Long Dark" | Mail Stop: N262-2
	          0__0			| Phone: (415) 604-0069
=============ooO==(__)==Ooo=============| menges@eos.arc.nasa.gov



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