Blob


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