Top Mud Sites Forum Return to TopMudSites.com
  Top Mud Sites Forum > Mud Development and Administration > MUD Coding
Read-only archive
The Top Mud Sites forum is closed.
Posting, registration and logins are disabled.

 
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
 
Old 11-15-2003, 05:25 AM   #2
karlan
Member
 
Join Date: Apr 2002
Location: Brisbane Australia
Posts: 74
karlan is on a distinguished road
 
Old 11-15-2003, 05:39 AM   #3
Sitral
New Member
 
Join Date: Apr 2002
Posts: 11
Sitral is on a distinguished road
I've got no experience with Circle, but your temp_house struct isn't doing anything. You've filled it up with information, but didn't tell the program what to do with it or where to put it, and it just gets scrapped at the end of the function.

After a quick look, try this:
[code]
struct house_control rec temp_house; // Replace this
int target; // with this.

if((find_house(virt_house)) == NOWHERE) // Replace this
if( (target=find_house(virt_house)) == NOWHERE ) // with this.

temp_house.vnum = virt_house; /*
temp_house.owner = owner; Replace these
temp_house.num_of_guests = 0; */
house_control[target].vnum = virt_house; /*
house_control[target].owner = owner; with these.
house_control[target].num_of_guests = 0; */
[/quote]

No promises (no experience). If it doesn't work, remember to put temp_house somewhere after you've given it all the relevant information (House_save_control() doesn't do this.)
 
Old 11-15-2003, 10:24 AM   #4
Jaegar
New Member
 
Join Date: Apr 2002
Posts: 14
Jaegar is on a distinguished road
Thank you very much. It is working properly now.

Thanks again,

Jaegar
 



Transfering Ownership of Houses - Similar Threads
Thread Thread Starter Forum Replies Last Post
Builders Desired for a Mud under New Ownership Satori Advertising for Staff 1 05-26-2004 03:14 PM
Mud ownership AxL Legal Issues 3 02-22-2003 09:38 PM


All times are GMT -4.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Style based on a design by Essilor
Copyright Top Mud Sites.com 2022