#include <stdio.h>
#include <stdbool.h>
#include <getopt.h>
+#include <signal.h>
#include "main.h"
#include "misc.h"
extern void score(long);
extern int action(FILE *, long);
+void sig_handler(int signo)
+{
+ if (signo == SIGINT)
+ if (logfp != NULL)
+ fflush(logfp);
+ exit(0);
+}
+
/*
* MAIN PROGRAM
*/
fprintf(stderr,
"advent: can't open logfile %s for write\n",
optarg);
+ signal(SIGINT, sig_handler);
break;
case 'o':
oldstyle = true;
if (sscanf(buf, "seed %ld", &sv) == 1) {
set_seed(sv);
printf("Seed set to %ld\n", sv);
+ // here we reconfigure any global game state that uses random numbers
+ ZZWORD=RNDVOC(3,0)+MESH*2;
return true;
}
return false;