Abolish VOCWRD().
[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 FILE  *logfp = NULL, *rfp = NULL;
17 bool oldstyle = false;
18 bool editline = true;
19 bool prompt = true;
20
21 int main(int argc, char *argv[])
22 {
23     FILE *fp = NULL;
24
25     game.lcg_a = 1093;
26     game.lcg_c = 221587;
27     game.lcg_m = 1048576;
28     srand(time(NULL));
29     long seedval = (long)rand();
30     set_seed(seedval);
31
32     /*  Initialize game variables */
33     initialise();
34
35     game.zzword = rndvoc(3, 0);
36     game.newloc = LOC_START;
37     game.loc = LOC_START;
38     game.limit = GAMELIMIT;
39     game.numdie = -1000;
40     game.saved = 1;
41     
42     fp = fopen("cheat_numdie.adv", WRITE_MODE);
43     if (fp == NULL)
44     {
45         printf("Can't open file. Exiting.\n");
46         exit(0);
47     }        
48
49     savefile(fp);
50     printf("cheat: tests/cheat_numdie.adv created.\n");
51     return 0;
52 }