Update cheat.c to unbreak the build.
[open-adventure.git] / cheat.c
1 #define DEFINE_GLOBALS_FROM_INCLUDES
2 #include <stdlib.h>
3 #include <stdio.h>
4 #include <stdbool.h>
5 #include <time.h>
6 #include "advent.h"
7 #include "database.h"
8 #include "linenoise/linenoise.h"
9 #include "newdb.h"
10
11 struct game_t game;
12
13 long LNLENG, LNPOSN;
14 char rawbuf[LINESIZE], INLINE[LINESIZE + 1];
15
16 long NUL;
17 long BACK;
18 long LOOK;
19 long CAVE;
20 long FIND;
21 long INVENT;
22 long SAY;
23 long ENTER;
24 long STREAM;
25 long DPRSSN;
26 long ENTRNC;
27 long LOCK;
28 long THROW;
29
30 FILE  *logfp = NULL, *rfp = NULL;
31 bool oldstyle = false;
32 bool editline = true;
33 bool prompt = true;
34
35 int main(int argc, char *argv[])
36 {
37     FILE *fp = NULL;
38
39     game.lcg_a = 1093;
40     game.lcg_c = 221587;
41     game.lcg_m = 1048576;
42     srand(time(NULL));
43     long seedval = (long)rand();
44     set_seed(seedval);
45
46     /*  Initialize game variables */
47     initialise();
48
49     game.zzword = rndvoc(3, 0);
50     game.newloc = LOC_START;
51     game.loc = LOC_START;
52     game.limit = GAMELIMIT;
53     game.numdie = -1000;
54     game.saved = 1;
55     
56     fp = fopen("cheat_numdie.adv", WRITE_MODE);
57     if (fp == NULL)
58     {
59         printf("Can't open file. Exiting.\n");
60         exit(0);
61     }        
62
63     savefile(fp);
64     printf("cheat: tests/cheat_numdie.adv created.\n");
65     return 0;
66 }