with Events;
private with Ada.Containers.Indefinite_Vectors;
pragma Elaborate_All( Events );
package Events.Keen is
type Dialog_Desc is new Object with private;
type A_Dialog_Desc is access all Dialog_Desc'Class;
function Create_Dialog_Desc( text : String ) return A_Dialog_Desc;
pragma Postcondition( Create_Dialog_Desc'Result /= null );
procedure Add_Choice( this : not null access Dialog_Desc'Class; text : String );
function Get_Choices( this : not null access Dialog_Desc'Class ) return Natural;
function Get_Choice( this : not null access Dialog_Desc'Class;
choice : Positive ) return String;
function Get_Text( this : not null access Dialog_Desc'Class ) return String;
type Dialog_Event is new Event with private;
type A_Dialog_Event is access all Dialog_Event'Class;
DIALOG_ID : constant Event_Id := To_Event_Id( "Dialog" );
function Get_Desc( this : not null access Dialog_Event'Class ) return A_Dialog_Desc;
pragma Postcondition( Get_Desc'Result /= null );
function Get_Dialog_Id( this : not null access Dialog_Event'Class ) return Integer;
type Dialog_Response_Event is new Event with private;
type A_Dialog_Response_Event is access all Dialog_Response_Event'Class;
DIALOG_RESPONSE_ID : constant Event_Id := To_Event_Id( "Dialog_Response" );
function Get_Choice( this : not null access Dialog_Response_Event'Class ) return Positive;
function Get_Dialog_Id( this : not null access Dialog_Response_Event'Class ) return Integer;
type Give_Ammo_Event is new Event with private;
type A_Give_Ammo_Event is access all Give_Ammo_Event'Class;
GIVE_AMMO_ID : constant Event_Id := To_Event_Id( "Give_Ammo" );
function Get_Amount( this : not null access Give_Ammo_Event'Class ) return Integer;
type Give_Drops_Event is new Event with private;
type A_Give_Drops_Event is access all Give_Drops_Event'Class;
GIVE_DROPS_ID : constant Event_Id := To_Event_Id( "Give_Drops" );
function Get_Amount( this : not null access Give_Drops_Event'Class ) return Integer;
type Give_Points_Event is new Event with private;
type A_Give_Points_Event is access all Give_Points_Event'Class;
GIVE_POINTS_ID : constant Event_Id := To_Event_Id( "Give_Points" );
function Get_Amount( this : not null access Give_Points_Event'Class ) return Integer;
procedure Queue_Dialog( dialogId : Integer;
description : in out A_Dialog_Desc );
pragma Precondition( description /= null );
pragma Postcondition( description = null );
procedure Queue_Dialog_Response( dialogId : Integer; choice : Positive );
procedure Queue_Give_Ammo( amount : Integer );
procedure Queue_Give_Drops( amount : Integer );
procedure Queue_Give_Points( amount : Integer );
private
package String_Vectors is new Ada.Containers.Indefinite_Vectors( Positive, String, "=" );
use String_Vectors;
type Dialog_Desc is new Object with
record
text : Unbounded_String;
choices : String_Vectors.Vector;
end record;
procedure Adjust( this : access Dialog_Desc );
procedure Construct( this : access Dialog_Desc; text : String );
function Copy( src : A_Dialog_Desc ) return A_Dialog_Desc;
pragma Postcondition( Copy'Result /= src or else src = null );
procedure Delete( this : in out A_Dialog_Desc );
pragma Postcondition( this = null );
type Dialog_Event is new Event with
record
dialogId : Integer := 0;
desc : A_Dialog_Desc := null;
end record;
procedure Adjust( this : access Dialog_Event );
procedure Construct( this : access Dialog_Event;
dialogId : Integer;
desc : in out A_Dialog_Desc );
procedure Delete( this : in out Dialog_Event );
type Dialog_Response_Event is new Event with
record
dialogId : Integer := 0;
choice : Positive;
end record;
procedure Construct( this : access Dialog_Response_Event;
dialogId : Integer;
choice : Positive );
type Give_Ammo_Event is new Event with
record
amount : Integer := 0;
end record;
procedure Construct( this : access Give_Ammo_Event; amount : Integer );
type Give_Drops_Event is new Event with
record
amount : Integer := 0;
end record;
procedure Construct( this : access Give_Drops_Event; amount : Integer );
type Give_Points_Event is new Event with
record
amount : Integer := 0;
end record;
procedure Construct( this : access Give_Points_Event; amount : Integer );
end Events.Keen;