extern int suspend(void);
extern int resume(void);
extern int restore(FILE *);
-extern void initialise(void);
+extern long initialise(void);
extern int action(struct command_t *command);
/* Alas, declaring this static confuses the coverage analyzer */
FILE *fp = NULL;
- game.lcg_a = 1093;
- game.lcg_c = 221587;
- game.lcg_m = 1048576;
- srand(time(NULL));
- long seedval = (long)rand();
- set_seed(seedval);
-
/* Initialize game variables */
initialise();
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
+#include <time.h>
#include "advent.h"
* Initialisation
*/
-void initialise(void)
+long initialise(void)
{
if (oldstyle)
printf("Initialising...\n");
+ /* Initialize our LCG PRNG with parameters tested against
+ * Knuth vol. 2. by the original authors */
+ game.lcg_a = 1093;
+ game.lcg_c = 221587;
+ game.lcg_m = 1048576;
+ srand(time(NULL));
+ long seedval = (long)rand();
+ set_seed(seedval);
+
for (int i = 1; i <= NOBJECTS; i++) {
game.place[i] = LOC_NOWHERE;
}
}
}
game.conds = setbit(11);
+
+ return seedval;
}
#include <stdbool.h>
#include <getopt.h>
#include <signal.h>
-#include <time.h>
#include <string.h>
#include "advent.h"
#include "linenoise/linenoise.h"
linenoiseHistorySetMaxLen(350);
- /* Initialize our LCG PRNG with parameters tested against
- * Knuth vol. 2. by the original authors */
- game.lcg_a = 1093;
- game.lcg_c = 221587;
- game.lcg_m = 1048576;
- srand(time(NULL));
- long seedval = (long)rand();
- set_seed(seedval);
-
/* Initialize game variables */
- initialise();
+ long seedval = initialise();
/* Start-up, dwarf stuff */
make_zzword(game.zzword);