Manual:DIL Manual/zhead()
Jump to navigation
Jump to search
Contents
zhead()
Function (zoneptr). The first zone in the game.
zhead()
Returns the first of the game's zones, sorted by zone name. Each zone's next field is the zone after it, and null after the last one, so a loop from zhead() visits every zone. Zone fields such as name, title and notes can then be read.
Returns
Zoneptr: the zone whose name comes first in alphabetical order.
Notes
zone_head()is another name for the same function.- The order is by name (byte order; zone names are lower case), not the order of
vme/etc/zonelist. z.nexton a null zoneptr fails; test the pointer in the loop:while (z)orwhile (z != null).- A field can't be read straight off the call:
zhead().nextis a syntax error. Put the zone in a variable first. - To get one zone by name,
findzone()is simpler.
Example
dilbegin zoneptr zone_of(rm : unitptr);
var
z : zoneptr;
code
{
z := zhead();
while ((z != null) and (z.name != rm.zoneidx))
z := z.next;
return (z);
}
dilend
Finds the zone a room belongs to, as helpzon.zon does for help area.