home *** CD-ROM | disk | FTP | other *** search
/ BURKS 2 / BURKS_AUG97.ISO / BURKS / LANGUAGE / ADA / LOVELACE / rooms.ads < prev    next >
Text File  |  1996-03-01  |  2KB  |  51 lines

  1. --
  2. -- Copyright (C) 1996 Ada Resource Association (ARA), Columbus, Ohio.
  3. -- Author: David A. Wheeler
  4. --
  5.  
  6. with Things, Directions;
  7. use  Things, Directions;
  8.  
  9. package Rooms is
  10.  type Room     is new Thing with private;
  11.  type Room_Access       is access all Room'Class;
  12.  
  13.  procedure Put_View(T : access Room; Agent : access Thing'Class);
  14.  
  15.  procedure Connect(Source : access Room; Dir : in Direction; 
  16.                    Destination : access Thing'Class;
  17.                    Bidirectional : in Boolean := True);
  18.   -- Create a connection from Source to Destination in Direction Dir.
  19.   -- If it's bidirectional, create another connection the reverse way.
  20.  
  21.  procedure Disconnect(Source : access Room; Dir : in Direction; 
  22.                       Bidirectional : in Boolean := True);
  23.  -- Reverse of connect; disconnects an existing connection, if any.
  24.  
  25.  function What_Is(From : access Room; Dir : in Direction) return Thing_Access;
  26.  -- Returns what is at direction "Dir" from "From".
  27.  -- Returns null if nothing connected in that direction.
  28.  
  29. private
  30.  
  31.  type Destination_Array is array(Direction) of Thing_Access;
  32.  
  33.  type Room     is new Thing with
  34.   record
  35.     Destinations : Destination_Array;
  36.   end record;
  37.  
  38. end Rooms;
  39.  
  40. --
  41. -- Permission to use, copy, modify, and distribute this software and its
  42. -- documentation for any purpose and without fee is hereby granted,
  43. -- provided that the above copyright and authorship notice appear in all
  44. -- copies and that both that copyright notice and this permission notice
  45. -- appear in supporting documentation.
  46. -- 
  47. -- The ARA makes no representations about the suitability of this software
  48. -- for any purpose.  It is provided "as is" without express
  49. -- or implied warranty.
  50. -- 
  51.