summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-12-02 15:03:24 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-12-02 15:03:24 +1300
commitcafdea3a29fe9eeae0bc7908ed2f6934ad699cb0 (patch)
treea61a9f281a776870e9622ad06a2d2b05f03e2bfa
parentMove temporary doors structure into static array (diff)
downloadtexad-cafdea3a29fe9eeae0bc7908ed2f6934ad699cb0.tar.gz
texad-cafdea3a29fe9eeae0bc7908ed2f6934ad699cb0.zip
Rearrange declarations and definitions
-rw-r--r--texad.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/texad.c b/texad.c
index 53cb3be..2373daf 100644
--- a/texad.c
+++ b/texad.c
@@ -74,10 +74,16 @@ struct world *genesis(void)
w = (struct world*) malloc(sizeof(struct world));
p = (struct player*) malloc(sizeof(struct player));
+
r[0] = (struct room*) malloc(sizeof(struct room));
r[1] = (struct room*) malloc(sizeof(struct room));
r[2] = (struct room*) malloc(sizeof(struct room));
+ d[0] = (struct door*) malloc(sizeof(struct door));
+ d[1] = (struct door*) malloc(sizeof(struct door));
+ d[2] = (struct door*) malloc(sizeof(struct door));
+ d[3] = (struct door*) malloc(sizeof(struct door));
+
r[0]->title = "The foo room";
r[0]->description = "You are in the foo room. Sunlight streams from the windows.";
@@ -87,11 +93,6 @@ struct world *genesis(void)
r[2]->title = "The baz room";
r[2]->description = "You are in the baz room. It is richly furnished.";
- d[0] = (struct door*) malloc(sizeof(struct door));
- d[1] = (struct door*) malloc(sizeof(struct door));
- d[2] = (struct door*) malloc(sizeof(struct door));
- d[3] = (struct door*) malloc(sizeof(struct door));
-
d[0]->direction = EAST;
d[0]->src = r[0];
d[0]->dst = r[1];