home *** CD-ROM | disk | FTP | other *** search
/ Solo Programadores 22 / SOLO_22.iso / docs / lovelace / rooms.ads < prev    next >
Encoding:
Text File  |  1995-10-24  |  1.1 KB  |  36 lines

  1.  
  2. with Things, Directions;
  3. use  Things, Directions;
  4.  
  5. package Rooms is
  6.  type Room     is new Thing with private;
  7.  type Room_Access       is access all Room'Class;
  8.  
  9.  procedure Put_View(T : access Room; Agent : access Thing'Class);
  10.  
  11.  procedure Connect(Source : access Room; Dir : in Direction; 
  12.                    Destination : access Thing'Class;
  13.                    Bidirectional : in Boolean := True);
  14.   -- Create a connection from Source to Destination in Direction Dir.
  15.   -- If it's bidirectional, create another connection the reverse way.
  16.  
  17.  procedure Disconnect(Source : access Room; Dir : in Direction; 
  18.                       Bidirectional : in Boolean := True);
  19.  -- Reverse of connect; disconnects an existing connection, if any.
  20.  
  21.  function What_Is(From : access Room; Dir : in Direction) return Thing_Access;
  22.  -- Returns what is at direction "Dir" from "From".
  23.  -- Returns null if nothing connected in that direction.
  24.  
  25. private
  26.  
  27.  type Destination_Array is array(Direction) of Thing_Access;
  28.  
  29.  type Room     is new Thing with
  30.   record
  31.     Destinations : Destination_Array;
  32.   end record;
  33.  
  34. end Rooms;
  35.  
  36.