13 struct settings_t settings = {
19 struct game_t game = {
20 .dloc[1] = LOC_KINGHALL,
21 .dloc[2] = LOC_WESTBANK,
23 .dloc[4] = LOC_ALIKE3,
24 .dloc[5] = LOC_COMPLEX,
26 /* Sixth dwarf is special (the pirate). He always starts at his
27 * chest's eventual location inside the maze. This loc is saved
28 * in chloc for ref. The dead end in the other maze has its
29 * loc stored in chloc2. */
30 .dloc[6] = LOC_DEADEND12,
31 .chloc = LOC_DEADEND12,
32 .chloc2 = LOC_DEADEND13,
40 /* Initialize our LCG PRNG with parameters tested against
41 * Knuth vol. 2. by the original authors */
49 if (settings.oldstyle)
50 printf("Initialising...\n");
53 long seedval = (long)rand();
56 for (int i = 1; i <= NOBJECTS; i++) {
57 game.place[i] = LOC_NOWHERE;
60 for (int i = 1; i <= NLOCATIONS; i++) {
61 if (!(locations[i].description.big == 0 ||
64 if (T_TERMINATE(travel[k]))
65 conditions[i] |= (1 << COND_FORCED);
69 /* Set up the game.atloc and game.link arrays.
70 * We'll use the DROP subroutine, which prefaces new objects on the
71 * lists. Since we want things in the other order, we'll run the
72 * loop backwards. If the object is in two locs, we drop it twice.
73 * Also, since two-placed objects are typically best described
74 * last, we'll drop them first. */
75 for (int i = NOBJECTS; i >= 1; i--) {
76 if (objects[i].fixd > 0) {
77 drop(i + NOBJECTS, objects[i].fixd);
78 drop(i, objects[i].plac);
82 for (int i = 1; i <= NOBJECTS; i++) {
83 int k = NOBJECTS + 1 - i;
84 game.fixed[k] = objects[k].fixd;
85 if (objects[k].plac != 0 && objects[k].fixd <= 0)
86 drop(k, objects[k].plac);
89 /* Treasure props are initially -1, and are set to 0 the first time
90 * they are described. game.tally keeps track of how many are
91 * not yet found, so we know when to close the cave. */
92 for (int treasure = 1; treasure <= NOBJECTS; treasure++) {
93 if (objects[treasure].is_treasure) {
94 if (objects[treasure].inventory != 0)
95 game.prop[treasure] = STATE_NOTFOUND;
96 game.tally = game.tally - game.prop[treasure];
99 game.conds = setbit(11);