with Text_IO, Ada.Strings.Unbounded, Ustrings; use Text_IO, Ada.Strings.Unbounded, Ustrings; with Things, Players, Items, Rooms, Directions; use Things, Players, Items, Rooms, Directions; package body World is The_Player : Player_Access; -- This is the object representing the -- current player. procedure Setup is Starting_Room : Room_Access := new Room; Box : Item_Access := new Item; Knife : Item_Access := new Item; Living_Room : Room_Access := new Room; begin Set_Name(Starting_Room, The, "Hallway"); Set_Description(Starting_Room, "in the hallway. There is a living room " & "to the west"); Set_Name(Box, A, "box"); Set_Description(Box, "a red box"); Place(T => Box, Into => Thing_Access(Starting_Room)); Set_Name(Knife, A, "knife"); Set_Description(Box, "a black knife"); Place(T => Knife, Into => Thing_Access(Starting_Room)); Set_Name(Living_Room, The, "Living Room"); Set_Description(Living_Room, "in the living room. " & "A hallway is to your east"); Connect(Starting_Room, West, Living_Room); -- Setup player. The_Player := new Player; Set_Name(The_Player, None, "Fred"); Set_Description(The_Player, Name(The_Player)); Place(T => Me, Into => Thing_Access(Starting_Room)); Look(Me); end Setup; function Me return Occupant_Access is -- Return access value to current player. begin return Occupant_Access(The_Player); end Me; end World;
You may also see the corresponding specification. The following compilation units are referred to ("with"'ed) by Package body World:
This hypertext format was generated by David A. Wheeler's ada2html