View Single Post
Old 11-15-2003, 01:54 AM   #1
Jaegar
New Member
 
Join Date: Apr 2002
Posts: 14
Jaegar is on a distinguished road
Lightbulb

I have been working with the Circle3.1 code and have been trying to create a function which will enable the ownership of a house to be transferred.  I have created the function and it compiles cleanly, the function seems to work properly except for the portion that actually changes the owner.

Here is a copy of the function:

void hcontrol_transfer_house(struct char_data *ch, char *arg)
{
  char arg1[MAX_INPUT_LENGTH];
  struct house_control_rec temp_house;
  room_vnum virt_house;
  room_rnum real_house;
  long owner;

  /*  first arg: house vnum */
  arg = one_argument(arg, arg1);
  if (!*arg1)
  {
     send_to_char(ch, "%s", HCONTROL_FORMAT);
     return;
  }

  virt_house = atoi(arg1);
  if ((real_house = real_room(virt_house)) == NOWHERE)
  {
     send_to_char(ch, "No such room exists.\r\n");
     return;
  }
  if ((find_house(virt_house)) == NOWHERE)
  {
     send_to_char(ch, "House doesn't exists.\r\n");
     return;
  }

  /* second arg: new owners name */
  arg = one_argument(arg, arg1);
  if (!*arg1)
  {
     send_to_char(ch, "%s", HCONTROL_FORMAT);
     return;
  }

  if ((owner = get_id_by_name(arg1)) < 0)
  {
     send_to_char(ch, "Unknown player '%s'.\r\n", arg1);
     return;
  }

  temp_house.vnum = virt_house;
  temp_house.owner = owner;
  temp_house.num_of_guests = 0;

  send_to_char(ch, "House '%d' ownership transfered to '%s'.\r\n", virt_house, arg1);
  House_save_control();
}


When using the command to transfer the ownership it will read the vnum of the house and even search for the name of the new owner, it just will not replace the old owner with the new one.  Any help would be greatly appreciated.

Thanks in advance,

Jaegar
Jaegar is offline   Reply With Quote