Re: [CODE] Deleting a room

From: George (greerga@circlemud.org)
Date: 01/06/99


On Wed, 6 Jan 1999, 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:

This is one case where there are so many possibilities that could go
subtly wrong that you probably want to refer to 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.

It'd be '<= top_of_world' really, not '< num_of_rooms', but that's details.
You wouldn't want to decrement 'num_of_rooms' first either, since then
you'll never copy the top room.

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

Ok, but don't blame me when your world is screwed up because you didn't
adjust other dependent variables. ;)

--
George Greer
greerga@circlemud.org
http://www.circlemud.org/~greerga/


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