Re: [CODE] Deleting a room

From: Invincibill (bill@longboys.net)
Date: 01/06/99


however wierd, the code looks like it should work fine.
maybe you have problems elsewhere.

here is a quick function i wrote that works just dandy.
(notice it does the same thing yours does, but in a different way

PCOMM(do_test) {
ROOM *room;
extern ROOM *world;
extern int top_of_world;
int x,y;

CREATE(room, ROOM, top_of_world);

for(x=0,y=0;x<10;x++) {
  if(world[x].number == 5) {
    printf("%d room name is %s\n\r", x, world[x].name);
    continue;
  }
  room[y]=world[x];
  y++
}

for(x=0;x<10;x++)
  printf("%d ROOM NAME IS %s\n\r", x, room[x].name);

}
here is my output...

test
0 room name is Zone Zero
1 room name is Dont use this Room
2 room name is Room with an aquarium
3 room name is Den's Study
4 room name is Flints House
5 room name is The Iguana Room
6 room name is Terrarium
---->snip
0 ROOM NAME IS Zone Zero
1 ROOM NAME IS Dont use this Room
2 ROOM NAME IS Room with an aquarium
3 ROOM NAME IS Den's Study
4 ROOM NAME IS Flints House
5 ROOM NAME IS Terrarium    (note, this one used to be The Iguana Room)
----->snip

i'm sure if i used your code it would be the same. you problem is
elsewhere
Andrew wrote:
>
> >http://www.circlemud.org/~greerga/oasis2.pre.tar.gz
> >
> >        genwld.c: delete_room()
> >
> >Have to remove the save list line though.
>
> Thanks all the same, but I'm not going to get anywhere fast just by copying
> your code and putting into the source of my mud. I have narrowed down the
> problem however. If you delete a room, that room is deleted, but so are all
> the ones above it. Eg, if you delete room #5, room 5,6,7,8 etc. are deleted,
> whioch is not what I want. So I assume the problem is copying over the world
> struct to the temp struct... here's the code:
>
> num_of_rooms--;
>
> CREATE(temp, struct room_data, num_of_rooms);
>
> for(i = 0, y = 0; i < num_of_rooms; )
> {
>         if (world[i].number != room) {
>                 temp[y] = world[i];
>                 i++;
>                 y++;
>         }
>         else {
>                 i++;
>                 continue;
>         }
> }
>
> Does this look to be the source of the problem? Once again, any help would
> be appreciated.
>
> George: I've looked at your delete_room code, and it's very good I'm sure,
> but I like to do things my own way. Hope you understand. Thanks for your
> help anyhow.
>
> Cheers,
>
> ----
> Andrew Ritchie,
> object@alphalink.com.au
>
>      +------------------------------------------------------------+
>      | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>      |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
>      +------------------------------------------------------------+

--
reply to bill<@>longboys.net(remove the<>)
      ...spam avoidance policy in effect.
check out www.giftsgalore.com, lots 'o neat stuff there.
Happy New Year


     +------------------------------------------------------------+
     | 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