summaryrefslogtreecommitdiff
path: root/texad.c
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-11-12 23:05:11 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-11-12 23:06:34 +1300
commitecb9d88b492e13fb2ea3ce5e3af37ea03fc92443 (patch)
treefd73d5020eb6c89d5cd835eec17a0e189211d7ee /texad.c
parentRephrase a loop (diff)
downloadtexad-ecb9d88b492e13fb2ea3ce5e3af37ea03fc92443.tar.gz
texad-ecb9d88b492e13fb2ea3ce5e3af37ea03fc92443.zip
Create header file
Diffstat (limited to 'texad.c')
-rw-r--r--texad.c63
1 files changed, 1 insertions, 62 deletions
diff --git a/texad.c b/texad.c
index d44e10e..6b18318 100644
--- a/texad.c
+++ b/texad.c
@@ -2,68 +2,7 @@
#include <stdlib.h>
#include <string.h>
-#define INPUT_LIMIT 256
-#define PROMPT "> "
-
-enum action {
- UNKNOWN,
- LOOK,
- GO_NORTH,
- GO_SOUTH,
- GO_EAST,
- GO_WEST,
- QUIT
-};
-
-enum direction {
- NORTH,
- SOUTH,
- EAST,
- WEST
-};
-
-struct room {
- char *title;
- char *description;
- struct door **doors;
-};
-
-struct door {
- enum direction direction;
- struct room *src;
- struct room *dst;
-};
-
-struct world {
- struct player *player;
-};
-
-struct player {
- char *name;
- struct room *room;
-};
-
-struct command {
- enum action action;
- char *string;
-};
-
-struct world *genesis(void);
-void apocalypse(struct world *);
-enum action parse(char *);
-void move(struct player *, enum direction);
-void look(struct room *);
-int loop(struct world *);
-
-static struct command commands[] = {
- {LOOK , "l" },
- {GO_NORTH , "n" },
- {GO_SOUTH , "s" },
- {GO_EAST , "e" },
- {GO_WEST , "w" },
- {QUIT , "q" },
- {UNKNOWN , NULL}
-};
+#include "texad.h"
struct world *genesis(void)
{