/***************************************************************************** ** Headerfile : atsys.h ** Description: Prototypes and datastructures used by the Automated Transport ** system. ** Author : Peter Eussen (Marty) ** Version : 0.1 ** Date : 30 June 1996 ** Notes : See atsys.c for documentation and further information ****************************************************************************/ #ifndef ATSYS_H_ #define ATSYS_H_ #define fAlbn(N) find_AT_loc_by_name(N) #define MAX_PORT 10 /* Not used now. */ #define BOARDING_DELAY 30 /* 30 ticks = 60 seconds */ /* A Automated Transport can be Boarding, Moving or Stranded. Stranded means * there was an error while moving the ferry, or the AT was stopped * intentionally. */ typedef enum { Boarding, Moving, Stranded } at_state; typedef struct at_messages { char *travelmessage; /* Message while traveling */ char *boardmessage; /* Message to say you can board */ char *arivemessage_in; /* Message to announce you have arived */ char *arivemessage_out; /* The port room */ char *departmessage_in; /* Message to say you are leaving */ char *departmessage_out; /* outside the ferry */ char *before_arival_in; /* Message just before arival */ char *before_arival_out; /* Message to the outside world. */ int travelchance; } AT_Messages; struct at_data { /* Public */ int loc; /* Location Number of the AT */ int *ports; /* Pointer to an array of ports */ int exit_of_at; /* Exit direction of the AT */ int exit_on_at; /* Exit direction onto the AT */ int port; /* Index to ports array */ int traveltime; /* Timer Interrupts of travel */ char *ATname; char **portnames; /* Private */ int ticks; /* Timer */ int next_port; struct at_data *next; at_state state; Boolean use_external; AT_Messages *msgs; }; typedef struct at_data AT_REC; /**************************************************************************** ** Global Data ****************************************************************************/ #ifdef ATSYS_C AT_REC *at_list = NULL; /* Global Variable definition */ #else extern AT_REC *at_list; #endif /** Prototypes **/ PUBLIC int find_port_index(int *ports, int port); PUBLIC AT_REC *find_AT(int loc); PUBLIC int remove_AT(AT_REC *p); PUBLIC int register_AT(int loc, int *ports, int exit_off, int exit_on, int start, int ttime, char *ATname, char **portnames, at_state beginstate); PUBLIC int set_AT_messages(int loc, char *travelmessage, char *boardmessage, char *arivemessage_in, char *arivemessage_out, char *departmessage_in, char *departmessage_out, char *before_arival_in, char *before_arival_out, int travelchance ); PUBLIC void free_AT_messages(int loc); PUBLIC void do_AT(AT_REC *p); PUBLIC void do_all_ATs(void); PUBLIC A_COMMAND(showATscom); PUBLIC int replace_ports(int loc, int *ports, char **portnames); PUBLIC int activate_AT(int loc); PUBLIC int stop_AT(int loc); PUBLIC int countATs(void); PUBLIC time_t time_to_port(int port, int loc); PUBLIC int find_AT_loc_by_name(char *name); #endif /* End of ATSYS Include */