Top Mud Sites Forum Return to TopMudSites.com
Go Back   Top Mud Sites Forum > Mud Development and Administration > MUD Coding
Click here to Register

Reply
 
Thread Tools
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
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
Cannot really remember how house work in circle, but it looks like you only ever modify the owner of temp_house, you may need to pass or copy this back into

house_control[WHATEVER INDEX IT SHOULD BE] so it updates the actuall array that gets saved, otherwise your changes get lost as soon as the function goes out of scope

Temp New quote "It doesn't matter how neat and fast your algorithm is if it doesn't WORK!!!" me - to the guy I replaced... pet hate at the moment, I am spending all my time maintaining his code.
karlan is offline   Reply With Quote
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.)
Sitral is offline   Reply With Quote
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
Jaegar is offline   Reply With Quote
Reply


Thread Tools


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -4. The time now is 06:31 PM.


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