Blame


1 cc9bbf61 2020-04-01 op #ifndef ADVENTURE_H
2 cc9bbf61 2020-04-01 op #define ADVENTURE_H
3 cc9bbf61 2020-04-01 op
4 cc9bbf61 2020-04-01 op #include <stddef.h>
5 cc9bbf61 2020-04-01 op
6 cc9bbf61 2020-04-01 op enum distance {
7 cc9bbf61 2020-04-01 op dist_player,
8 cc9bbf61 2020-04-01 op dist_held,
9 cc9bbf61 2020-04-01 op dist_held_contained,
10 cc9bbf61 2020-04-01 op dist_location,
11 cc9bbf61 2020-04-01 op dist_here,
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,
17 cc9bbf61 2020-04-01 op };
18 cc9bbf61 2020-04-01 op
19 cc9bbf61 2020-04-01 op /* object.c */
20 cc9bbf61 2020-04-01 op #include "object.h"
21 cc9bbf61 2020-04-01 op
22 cc9bbf61 2020-04-01 op /* match.c */
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;
28 cc9bbf61 2020-04-01 op size_t count;
29 cc9bbf61 2020-04-01 op };
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*);
33 cc9bbf61 2020-04-01 op
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;
38 cc9bbf61 2020-04-01 op };
39 cc9bbf61 2020-04-01 op int exec_look_around(void);
40 cc9bbf61 2020-04-01 op int parseexec(const char*);
41 cc9bbf61 2020-04-01 op
42 cc9bbf61 2020-04-01 op /* misc.c */
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*);
50 cc9bbf61 2020-04-01 op
51 cc9bbf61 2020-04-01 op /* io.c */
52 cc9bbf61 2020-04-01 op extern char *line;
53 cc9bbf61 2020-04-01 op int getinput();
54 cc9bbf61 2020-04-01 op
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);
57 cc9bbf61 2020-04-01 op
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*);
63 cc9bbf61 2020-04-01 op
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*);
68 cc9bbf61 2020-04-01 op
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*);
71 cc9bbf61 2020-04-01 op
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*);
75 cc9bbf61 2020-04-01 op
76 cc9bbf61 2020-04-01 op #endif