Blob


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