-#include "main.h"
-
-#include "misc.h"
-
-long ABB[186], ATAB[331], ATLOC[186], BLKLIN = true, DFLAG,
- DLOC[7], FIXED[101], HOLDNG,
- KTAB[331], *LINES, LINK[201], LNLENG, LNPOSN,
- PARMS[26], PLACE[101], PTEXT[101], RTEXT[278],
- SETUP = 0, TABSIZ = 330;
-signed char INLINE[LINESIZE+1], MAP1[129], MAP2[129];
-
-long ABBNUM, ACTSPK[36], AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, BONUS,
- BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
- CLAM, CLOCK1, CLOCK2, CLOSED, CLOSNG, CLSHNT, CLSMAX = 12, CLSSES,
- COINS, COND[186], CONDS, CTEXT[13], CVAL[13], DALTLC, DETAIL,
- DKILL, DOOR, DPRSSN, DRAGON, DSEEN[7], DTOTAL, DWARF, EGGS,
- EMRALD, ENTER, ENTRNC, FIND, FISSUR, FIXD[101], FOOBAR, FOOD,
- GRATE, HINT, HINTED[21], HINTLC[21], HINTS[21][5], HNTMAX,
- HNTSIZ = 20, I, INVENT, IGO, IWEST, J, JADE, K, K2, KEY[186], KEYS, KK,
- KNFLOC, KNIFE, KQ, L, LAMP, LIMIT, LINSIZ = 12500, LINUSE, LL,
- LMWARN, LOC, LOCK, LOCSIZ = 185, LOCSND[186], LOOK, LTEXT[186],
- MAGZIN, MAXDIE, MAXTRS, MESH = 123456789,
+#include <getopt.h>
+#include <signal.h>
+#include <time.h>
+#include "advent.h"
+#include "database.h"
+
+struct game_t game;
+
+long ABB[186], ATLOC[186], BLKLIN = true, DFLAG,
+ FIXED[NOBJECTS+1], HOLDNG,
+ LINK[NOBJECTS*2 + 1], LNLENG, LNPOSN,
+ PARMS[26], PLACE[NOBJECTS+1],
+ SETUP = 0;
+char rawbuf[LINESIZE], INLINE[LINESIZE+1], MAP1[129], MAP2[129];
+
+long ABBNUM, AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, BONUS,
+ BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
+ CLAM, CLOSED, CLOSNG, CLSHNT, COINS, CONDS, DALTLC, DETAIL,
+ DKILL, DOOR, DPRSSN, DRAGON, DTOTAL, DWARF, EGGS,
+ EMRALD, ENTER, ENTRNC, FIND, FISSUR, FOOBAR, FOOD,
+ GRATE, HINT, HINTED[21], HINTLC[21],
+ I, INVENT, IGO, IWEST, J, JADE, K, K2, KEYS, KK,
+ KNFLOC, KNIFE, KQ, L, LAMP, LIMIT, LL,
+ LMWARN, LOC, LOCK, LOOK,
+ MAGZIN, MAXDIE, MAXTRS,