02 Oct, 2008, Sandi wrote in the 1st comment:
file db.c, line 1187:
`if ( (!pArea->empty && (pArea->nplayer == 0 || pArea->age >= 15))	||    pArea->age >= 31)`

Please, can anyone explain the intent of this, and how it works?
02 Oct, 2008, Zeno wrote in the 2nd comment:
If the ([area is not empty and has no players] or the area age is greater than 15) or the area age is greater than 31, do something.

I assume age is how long it's been since the last reset, but I can't be sure offhand.
02 Oct, 2008, David Haley wrote in the 3rd comment:
Yes, it looks like an attempt to control frequency of resets. Actually, if you distribute the conjunction over the disjunction, the conditions are the following:

if:
(a) the area is not empty and nplayer == 0
or
(b) the area is not empty and age >= 15
or
© the age is >= 31

I don't know what the point of condition (a) is, because it seems impossible to satisfy. When is pArea->empty true?

Condition © is saying that do something no matter what whenever age >= 31. I'm guessing that (b) is supposed to say that you reset when age >= 15 only when the area is empty.

I'd need to know what pArea->empty means to be more precise though.
02 Oct, 2008, Skol wrote in the 4th comment:
In merc.h
`#define PULSE_PER_SECOND            4#define PULSE_AREA                (120 * PULSE_PER_SECOND)`

Then in update.c we decrement pulse_area until it's 0 (or less hehe)
`if ( –pulse_area     <= 0 )    {	pulse_area      = PULSE_AREA;	area_update     ( );    }`

Once that hit's it fires off area_update()
`/* * Repopulate areas periodically. */void area_update( void ){    AREA_DATA *pArea;    char buf[MAX_STRING_LENGTH];    for ( pArea = area_first; pArea != NULL; pArea = pArea->next )    {	if ( ++pArea->age < 3 )	    continue;	/*	 * Check age and reset.	 * Note: Mud School resets every 3 minutes (not 15).	 */	if ( (!pArea->empty && (pArea->nplayer == 0 || pArea->age >= 15))	||    pArea->age >= 31) // Meaning - Empty, repop in 5 minutes, player found repop in 15	{	    ROOM_INDEX_DATA *pRoomIndex;	    reset_area( pArea );	    sprintf(buf,"%s has just been reset.",pArea->name);	    wiznet(buf,NULL,NULL,WIZ_RESETS,0,0);	    pArea->age = number_range( 0, 3 ); //Restart it 'roughly' at 0, with variation	    pRoomIndex = get_room_index( ROOM_VNUM_SCHOOL );	    if ( pRoomIndex != NULL && pArea == pRoomIndex->area )		pArea->age = 15 - 2;// Unless it's the school, then we start a shorter countdown	    else if (pArea->nplayer == 0)		pArea->empty = TRUE;	}    }    return;}`

Make sense? Basically it's just an integer that counts down to reset the area.
If you wanted a certain area to take longer or shorter, that'd be where you adjusted it (in update_area()). Like maybe a really cool quest area updates every hour instead, or a heavily used one gets it every few minutes like school area.
02 Oct, 2008, Skol wrote in the 5th comment:
Ps. Sorry, it kind of chopped off my comments in the code. (er ran them off the edge heh)
02 Oct, 2008, quixadhal wrote in the 6th comment:
I'd hazard a guess that an "empty" area probably has no mobs, so if the area is not empty (IE: there's something to reset) and there are no players around to see, do the update. If it's not empty and it's been 15 ticks, do it anyways. If it's been 31 ticks, do it empty or not.
02 Oct, 2008, David Haley wrote in the 7th comment:
I was thinking something like that, until I saw this:
`else if (pArea->nplayer == 0)   pArea->empty = TRUE;`

So it really does seem like it becomes true when nplayer is 0…
02 Oct, 2008, Fizban wrote in the 8th comment:
In which case:

`if ( (!pArea->empty && (pArea->nplayer == 0 || pArea->age >= 15)) ||    pArea->age >= 31)`

is the same as:
`if ((!pArea->empty && pArea->age >= 15) || pArea->age >= 31)`

The latter is definitely clearer in my book.
02 Oct, 2008, David Haley wrote in the 9th comment:
If empty truly only tracks nplayer == 0, then yes, that's what I said above. But I'm suspicious of things that are that simple…

In this case, it seems that the intention is that you reset if it's not empty at old enough, or if it's even older. But that doesn't really make sense to me: I would have said that you reset if it IS empty and old, but not old enough – and then you do a reset no matter what once you get to a certain point.
02 Oct, 2008, Sandi wrote in the 10th comment:
ROTFL! I should have known, I should have known….

Thanks for the guesses, guys. As David suspects, there's something deeper going on. For one thing, when you enter a room, the area it's in is set 'empty = FALSE; age = 0'. The areas are loaded with 'empty = TRUE; age = 15'.

Tradition has it, if you clean out an area you should leave so it will repop faster. Apparently, this is not the case with ROM.
02 Oct, 2008, Skol wrote in the 11th comment: