02 Feb, 2010, boblinski wrote in the 1st comment:
Votes: 0
Anyone care to try explain this piece of code from db.c in rom2.4 in the function load_rooms()

else if (letter == 'D')
{
EXIT_DATA *pexit;
int locks;

door = fread_number (fp);
if (door < 0 || door > 5)
{
bug ("Fread_rooms: vnum %d has bad door number.", vnum);
exit (1);
}

pexit = alloc_perm (sizeof (*pexit));
pexit->description = fread_string (fp);
pexit->keyword = fread_string (fp);
pexit->exit_info = 0;
pexit->rs_flags = 0; /* OLC */
locks = fread_number (fp);
pexit->key = fread_number (fp);
pexit->u1.vnum = fread_number (fp);
pexit->orig_door = door; /* OLC */

switch (locks)
{
case 1:
pexit->exit_info = EX_ISDOOR;
pexit->rs_flags = EX_ISDOOR;
break;
case 2:
pexit->exit_info = EX_ISDOOR | EX_PICKPROOF;
pexit->rs_flags = EX_ISDOOR | EX_PICKPROOF;
break;
case 3:
pexit->exit_info = EX_ISDOOR | EX_NOPASS;
pexit->rs_flags = EX_ISDOOR | EX_NOPASS;
break;
case 4:
pexit->exit_info =
EX_ISDOOR | EX_NOPASS | EX_PICKPROOF;
pexit->rs_flags =
EX_ISDOOR | EX_NOPASS | EX_PICKPROOF;
break;
}

pRoomIndex->exit[door] = pexit;
top_exit++;
}
02 Feb, 2010, Kline wrote in the 2nd comment:
Votes: 0
What are you having problems understanding, specifically? This reads door data from an area file that (presumably, I'm just going by the code provided) would look similar to this, in an area:

Quote
D 0
A description.~
Special keywords~
0 0 0
02 Feb, 2010, boblinski wrote in the 3rd comment:
Votes: 0
Well I'm wanting to add a new exit_flag… EX_SEALED for a magical seal that passdoor will be blocked..

I'm just wondering where in this I need to add the new EX_SEALED flag.. or do I not need to add it?
02 Feb, 2010, chaoticus wrote in the 4th comment:
Votes: 0
I think

case 3:
pexit->exit_info = EX_ISDOOR | EX_NOPASS;
pexit->rs_flags = EX_ISDOOR | EX_NOPASS;
break;


takes care of pass door.
02 Feb, 2010, quixadhal wrote in the 5th comment:
Votes: 0
Look at your case statement:

0 isn't accounted for
1 is EX_ISDOOR
2 is DOOR + PICKPROOF
3 is DOOR + NOPASS
4 is DOOR + PICKPROOF + NOPASS

Presumably you'd add cases for whatever combinations you wanted to add on.
If you didn't care about backwyrd compactability, you could change them to use actual bit values to make things simpler, but if you're using ROM you probably do care.
02 Feb, 2010, Scandum wrote in the 6th comment:
Votes: 0
Could change the door flags to use bit 4 to 32. (8, 16, 32, etc) That way old area files will still load, and new files will be expected to use the bit value.

All you'd have to add:
default:
pexit->exit_info = locks;
pexit->rs_flags = locks;
break;
0.0/6