summaryrefslogtreecommitdiff
path: root/games/adventure
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2014-12-08 21:56:29 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2014-12-08 21:56:29 +0000
commitd98fdfe46793569057c86d781400222a9c0b23fe (patch)
treeaed801ec7f9bff5887d23276292602ef7efccb2b /games/adventure
parent5482618595acf6e20d70cfe9d0228731eb472567 (diff)
For now, these games still contain deterministic randomization (for
save / replay modes of operation that have not yet been cleaned up). OK, I've let the cat out of the bag, now some of you know you can cheat at them.. ok millert guenther tedu
Diffstat (limited to 'games/adventure')
-rw-r--r--games/adventure/hdr.h4
-rw-r--r--games/adventure/init.c3
-rw-r--r--games/adventure/io.c3
-rw-r--r--games/adventure/save.c6
-rw-r--r--games/adventure/setup.c4
5 files changed, 7 insertions, 13 deletions
diff --git a/games/adventure/hdr.h b/games/adventure/hdr.h
index bb5c72c50eb..4c286b45df2 100644
--- a/games/adventure/hdr.h
+++ b/games/adventure/hdr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hdr.h,v 1.13 2014/07/13 19:40:57 tedu Exp $ */
+/* $OpenBSD: hdr.h,v 1.14 2014/12/08 21:56:27 deraadt Exp $ */
/* $NetBSD: hdr.h,v 1.2 1995/03/21 12:05:02 cgd Exp $ */
/*-
@@ -83,8 +83,6 @@ struct hashtab { /* hash table for vocabulary */
char *atab; /* pointer to actual string */
} voc[HTSIZE];
-#define SEED 1815622 /* "obfuscation" seed */
-
struct text {
#ifdef OLDSTUFF
int seekadr; /* DATFILE must be < 2**16 */
diff --git a/games/adventure/init.c b/games/adventure/init.c
index 9c60994258c..6de5b774b9d 100644
--- a/games/adventure/init.c
+++ b/games/adventure/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.11 2009/10/27 23:59:23 deraadt Exp $ */
+/* $OpenBSD: init.c,v 1.12 2014/12/08 21:56:27 deraadt Exp $ */
/* $NetBSD: init.c,v 1.4 1996/05/21 21:53:05 mrg Exp $ */
/*-
@@ -213,7 +213,6 @@ void
startup(void)
{
demo = Start();
- srandomdev();
hinted[3] = yes(65, 1, 0);
newloc = 1;
delhit = 0;
diff --git a/games/adventure/io.c b/games/adventure/io.c
index bcf49254567..4c02ccb096e 100644
--- a/games/adventure/io.c
+++ b/games/adventure/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.18 2014/07/13 19:40:57 tedu Exp $ */
+/* $OpenBSD: io.c,v 1.19 2014/12/08 21:56:27 deraadt Exp $ */
/* $NetBSD: io.c,v 1.3 1995/04/24 12:21:37 cgd Exp $ */
/*-
@@ -201,7 +201,6 @@ rdata(void) /* "read" data from virtual file */
char ch;
inptr = data_file; /* Pointer to virtual data file */
- srandom(SEED); /* which is slightly obfuscated.*/
clsses = 1;
for (;;) { /* read data sections */
diff --git a/games/adventure/save.c b/games/adventure/save.c
index 483dd8a309b..2b0fe806234 100644
--- a/games/adventure/save.c
+++ b/games/adventure/save.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: save.c,v 1.9 2014/07/13 19:40:57 tedu Exp $ */
+/* $OpenBSD: save.c,v 1.10 2014/12/08 21:56:27 deraadt Exp $ */
/* $NetBSD: save.c,v 1.2 1995/03/21 12:05:08 cgd Exp $ */
/*-
@@ -127,7 +127,7 @@ save(const char *outfile)
crc_start();
for (p = save_array; p->address != NULL; p++)
sum = crc(p->address, p->width);
- srandom((int) sum);
+ srandom_deterministic((int) sum);
if ((out = fopen(outfile, "wb")) == NULL) {
fprintf(stderr,
@@ -163,7 +163,7 @@ restore(const char *infile)
}
fread(&sum, sizeof(sum), 1, in); /* Get the seed */
- srandom((unsigned int) sum);
+ srandom_deterministic((unsigned int) sum);
for (p = save_array; p->address != NULL; p++) {
fread(p->address, p->width, 1, in);
for (s = p->address, i = 0; i < p->width; i++, s++)
diff --git a/games/adventure/setup.c b/games/adventure/setup.c
index 9db2d1c5a90..0446a365bee 100644
--- a/games/adventure/setup.c
+++ b/games/adventure/setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setup.c,v 1.10 2014/07/13 19:40:57 tedu Exp $ */
+/* $OpenBSD: setup.c,v 1.11 2014/12/08 21:56:27 deraadt Exp $ */
/* $NetBSD: setup.c,v 1.2 1995/03/21 12:05:10 cgd Exp $ */
/*-
@@ -49,7 +49,6 @@
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
-#include "hdr.h" /* SEED lives in there; keep them coordinated. */
#define USAGE "Usage: setup file > data.c (file is typically glorkz)\n"
@@ -76,7 +75,6 @@ main(int argc, char *argv[])
puts(SIG2);
puts(" */");
printf("\n\nchar data_file[] =\n{");
- srandom(SEED);
count = 0;
linestart = YES;