1 cc9bbf61 2020-04-01 op #ifndef ADVENTURE_H
2 cc9bbf61 2020-04-01 op #define ADVENTURE_H
4 cc9bbf61 2020-04-01 op #include <stddef.h>
6 cc9bbf61 2020-04-01 op enum distance {
9 cc9bbf61 2020-04-01 op dist_held_contained,
10 cc9bbf61 2020-04-01 op dist_location,
12 cc9bbf61 2020-04-01 op dist_here_contained,
13 cc9bbf61 2020-04-01 op dist_overthere,
14 cc9bbf61 2020-04-01 op dist_not_here,
15 cc9bbf61 2020-04-01 op dist_unknown_obj,
16 cc9bbf61 2020-04-01 op dist_no_obj_specified,
19 cc9bbf61 2020-04-01 op /* object.c */
20 cc9bbf61 2020-04-01 op #include "object.h"
23 cc9bbf61 2020-04-01 op #define MAX_PARAMS 26
24 cc9bbf61 2020-04-01 op struct param {
25 cc9bbf61 2020-04-01 op const char *tag;
26 cc9bbf61 2020-04-01 op struct object *object;
27 cc9bbf61 2020-04-01 op enum distance distance;
30 cc9bbf61 2020-04-01 op extern struct param params[MAX_PARAMS];
31 cc9bbf61 2020-04-01 op #define param_by_letter(l) (params + (l) - 'A')
32 cc9bbf61 2020-04-01 op int match_command(const char*, const char*);
34 cc9bbf61 2020-04-01 op /* parseexec.h */
35 cc9bbf61 2020-04-01 op struct command {
36 cc9bbf61 2020-04-01 op int (*fn)(void);
37 cc9bbf61 2020-04-01 op const char *pattern;
39 cc9bbf61 2020-04-01 op int exec_look_around(void);
40 cc9bbf61 2020-04-01 op int parseexec(const char*);
43 cc9bbf61 2020-04-01 op size_t list_objs_at_loc(struct object*);
44 cc9bbf61 2020-04-01 op struct object *person_here(void);
45 cc9bbf61 2020-04-01 op struct object *get_passage_to(struct object*);
46 cc9bbf61 2020-04-01 op enum distance distance_to(struct object*);
47 cc9bbf61 2020-04-01 op void move_player(struct object*);
48 cc9bbf61 2020-04-01 op int weight_of_contents(struct object*);
49 cc9bbf61 2020-04-01 op int object_within_reach(const char*, struct param*);
52 cc9bbf61 2020-04-01 op extern char *line;
53 cc9bbf61 2020-04-01 op int getinput();
55 cc9bbf61 2020-04-01 op /* inventory.c */
56 cc9bbf61 2020-04-01 op int move_object(struct param*, struct object *from, struct object *to);
58 cc9bbf61 2020-04-01 op /* toggle.c */
59 cc9bbf61 2020-04-01 op const char *cannot_be_opened(struct object*);
60 cc9bbf61 2020-04-01 op const char *cannot_be_closed(struct object*);
61 cc9bbf61 2020-04-01 op const char *cannot_be_locked(struct object*);
62 cc9bbf61 2020-04-01 op const char *cannot_be_unlocked(struct object*);
64 cc9bbf61 2020-04-01 op const char *is_already_open(struct object*);
65 cc9bbf61 2020-04-01 op const char *is_already_closed(struct object*);
66 cc9bbf61 2020-04-01 op const char *is_already_locked(struct object*);
67 cc9bbf61 2020-04-01 op const char *is_already_unlocked(struct object*);
69 cc9bbf61 2020-04-01 op const char *is_still_open(struct object*);
70 cc9bbf61 2020-04-01 op const char *is_still_locked(struct object*);
72 cc9bbf61 2020-04-01 op const char *toggle_backdoor(struct object*);
73 cc9bbf61 2020-04-01 op const char *toggle_box(struct object*);
74 cc9bbf61 2020-04-01 op const char *toggle_box_lock(struct object*);