mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
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
This commit is contained in:
parent
5a944dae11
commit
f84032eda8
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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++)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: update.c,v 1.14 2014/07/13 14:01:04 tedu Exp $ */
|
||||
/* $OpenBSD: update.c,v 1.15 2014/12/08 21:56:27 deraadt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@ -48,7 +48,7 @@ void
|
||||
setseed(const char *seed)
|
||||
{
|
||||
seeded = 1;
|
||||
srandom(atol(seed));
|
||||
srandom_deterministic(atol(seed));
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: hack.main.c,v 1.15 2009/10/27 23:59:25 deraadt Exp $ */
|
||||
/* $OpenBSD: hack.main.c,v 1.16 2014/12/08 21:56:27 deraadt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
|
||||
@ -177,7 +177,6 @@ main(int argc, char **argv)
|
||||
gettty();
|
||||
setbuf(stdout,obuf);
|
||||
umask(007);
|
||||
srandomdev();
|
||||
startup();
|
||||
cls();
|
||||
u.uhp = 1; /* prevent RIP on early quits */
|
||||
@ -275,7 +274,7 @@ main(int argc, char **argv)
|
||||
if ((sfoo = getenv("MAGIC")))
|
||||
while(*sfoo) {
|
||||
switch(*sfoo++) {
|
||||
case 'n': (void) srandom(*sfoo++);
|
||||
case 'n': (void) srandom_deterministic(*sfoo++);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: main.c,v 1.12 2009/10/27 23:59:27 deraadt Exp $ */
|
||||
/* $OpenBSD: main.c,v 1.13 2014/12/08 21:56:28 deraadt Exp $ */
|
||||
/* $NetBSD: main.c,v 1.4 1995/04/22 10:59:10 cgd Exp $ */
|
||||
|
||||
/*
|
||||
@ -127,7 +127,6 @@ main(argc, argv)
|
||||
av = argv;
|
||||
ac = argc;
|
||||
av++;
|
||||
srandomdev();
|
||||
|
||||
#ifdef xTRACE
|
||||
Trace = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: setup.c,v 1.9 2013/08/29 14:35:49 naddy Exp $ */
|
||||
/* $OpenBSD: setup.c,v 1.10 2014/12/08 21:56:28 deraadt Exp $ */
|
||||
/* $NetBSD: setup.c,v 1.4 1995/04/24 12:26:06 cgd Exp $ */
|
||||
|
||||
/*
|
||||
@ -105,7 +105,7 @@ setup()
|
||||
d = 0;
|
||||
for (i = 0; Game.passwd[i]; i++)
|
||||
d += Game.passwd[i] << i;
|
||||
srandom(d);
|
||||
srandom_deterministic(d);
|
||||
}
|
||||
Param.bases = Now.bases = ranf(6 - Game.skill) + 2;
|
||||
if (Game.skill == 6)
|
||||
|
Loading…
Reference in New Issue
Block a user