Re: [CODE] Rooms moving around...

From: Zeavon (zeavon@kilnar.com)
Date: 04/06/99


Your problem is that you are using vnums where you need rnums.

/* Begin Mailer Code */
  room_num room1 = NOWHERE, room2 = NOWHERE;

  room1 = real_room(766);
  room2 = real_room(2617);
  if (room1 == NOWHERE || room2 == NOWHERE) {
    log("SYSERR: Either room 766 or 2617 does not exist for fortress
spec.");
    return FALSE;
  }

   if (time_info.month > 4 && time_info.month < 8) {
     CREATE(world[room1].dir_option[0], struct room_direction_data, 1);
     world[room1].dir_option[0]->general_description = NULL;
     world[room1].dir_option[0]->keyword = NULL;
     world[room1].dir_option[0]->to_room = room2;
   }
/* End Mailer Code */

Also, you had better check to see if the exit already exists, you had better
remove it first. In addition to this, when you move the exit, you had better
make sure that the old exit is removed from the game as well. Creating exits
on the fly is not quite as simple as one may think. There are all sorts of
opportunities to trash some memory and crash your mud.

Good Luck

--
Zeavon Calatin, Spear of Insanity
spear.kilnar.com:1066
http://www.kilnar.com/spear/


> -----Original Message-----
> From: Circle Discussion List
> [mailto:CIRCLE@post.queensu.ca]On Behalf Of
> Christoffer Lundberg
> Sent: Tuesday, April 06, 1999 10:02 AM
> To: CIRCLE@post.queensu.ca
> Subject:  [CODE] Rooms moving around...
>
>
> Hello!
>
> I have tried to make a flying fortress that changes room 2617's (The
> entrance to the fort)  link south from none to something each season.
> The code look like this and is called every tick in comm.c
>
> void move_fort(void)
> {
>   extern struct time_info_data time_info;
>
>   if (time_info.month > 4 && time_info.month < 8) {
>     CREATE(world[766].dir_option[0], struct room_direction_data, 1);
>     world[766].dir_option[0]->general_description = NULL;
>     world[766].dir_option[0]->keyword = NULL;
>     world[766].dir_option[0]->to_room = 2617;
>
>     CREATE(world[2617].dir_option[2], struct room_direction_data, 1);
>     world[2617].dir_option[2]->general_description = NULL;
>     world[2617].dir_option[2]->keyword = NULL;
>     world[2617].dir_option[2]->to_room = 766;
>
>   } else if (time_info.month > 7 && time_info.month < 12) {
>   ...
>   ..
>   .
>
> But, it won't set the link south. I have logged the whole
> function, and
> all logs go through. What can be wrong?
>
> ()CHRISTOFFER:>......
>
>
>      +------------------------------------------------------------+
>      | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>      |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
>      +------------------------------------------------------------+
>


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



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