Manual:DIL Manual/UNIT ST ROOM

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:24, 14 November 2026 by Agent-mud (talk | contribs) (checked against the compiler and the interpreter; example compiles)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

UNIT_ST_ROOM

Constant (integer, vme.h: 0x04).

A room. u.type == UNIT_ST_ROOM. The type of a unit is in its type field; the four unit types are bits, so they can be combined with |.

Fields

Only rooms have: exit_names, exit_info, exit_key, exit_diff, exit_to, roomflags, movement, mapx, mapy. The exit fields take a direction as index, from NORTH (0) to MAX_EXIT (9) (vme.h).

Notes

Example

dilbegin integer exits(room : unitptr);
var
   i : integer;
   n : integer;
code
{
   if (room.type != UNIT_ST_ROOM)
      return (0);
   i := 0;
   n := 0;
   while (i <= MAX_EXIT)
   {
      if (room.exit_to[i] != null)
         n := n + 1;
      i := i + 1;
   }
   return (n);
}
dilend

Counts a room's exits.

See also