Merge branch 'NetHack-3.6.2'
This commit is contained in:
14
src/pray.c
14
src/pray.c
@@ -2090,15 +2090,13 @@ aligntyp alignment;
|
||||
if (!Hallucination)
|
||||
return align_gname(alignment);
|
||||
|
||||
/* Count the roles, so that we can pick one at random. */
|
||||
int rolecount = 0;
|
||||
while (roles[rolecount].filecode)
|
||||
rolecount++;
|
||||
|
||||
/* The priest may not have initialized god names. If this is the
|
||||
case, and we roll priest, we need to try again. */
|
||||
/* Some roles (Priest) don't have a pantheon unless we're playing as
|
||||
that role, so keep trying until we get a role which does have one.
|
||||
[If playing a Priest, the current pantheon will be twice as likely
|
||||
to get picked as any of the others. That's not significant enough
|
||||
to bother dealing with.] */
|
||||
do
|
||||
which = rn2_on_display_rng(rolecount);
|
||||
which = randrole(TRUE);
|
||||
while (!roles[which].lgod);
|
||||
|
||||
switch (rn2_on_display_rng(9)) {
|
||||
|
||||
22
src/rnd.c
22
src/rnd.c
@@ -17,16 +17,16 @@ struct rnglist_t {
|
||||
isaac64_ctx rng_state;
|
||||
};
|
||||
|
||||
enum {CORE = 0, DISP};
|
||||
enum { CORE = 0, DISP = 1 };
|
||||
|
||||
static struct rnglist_t rnglist[] = {
|
||||
{rn2, FALSE, {0}}, /* CORE */
|
||||
{rn2_on_display_rng, FALSE, {0}}, /* DISP */
|
||||
{ rn2, FALSE, { 0 } }, /* CORE */
|
||||
{ rn2_on_display_rng, FALSE, { 0 } }, /* DISP */
|
||||
};
|
||||
|
||||
int
|
||||
whichrng(fn)
|
||||
int (*fn)(int);
|
||||
int FDECL((*fn), (int));
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -39,19 +39,21 @@ int (*fn)(int);
|
||||
void
|
||||
init_isaac64(seed, fn)
|
||||
unsigned long seed;
|
||||
int FDECL((*fn),(int));
|
||||
int FDECL((*fn), (int));
|
||||
{
|
||||
unsigned char new_rng_state[sizeof(seed)];
|
||||
int i, rngindx = whichrng(fn);
|
||||
unsigned char new_rng_state[sizeof seed];
|
||||
unsigned i;
|
||||
int rngindx = whichrng(fn);
|
||||
|
||||
if (rngindx < 0)
|
||||
panic("Bad rng function passed to init_isaac64().");
|
||||
|
||||
for (i=0; i<sizeof(seed); i++) {
|
||||
new_rng_state[i]= (unsigned char)(seed & 0xFF);
|
||||
for (i = 0; i < sizeof seed; i++) {
|
||||
new_rng_state[i] = (unsigned char) (seed & 0xFF);
|
||||
seed >>= 8;
|
||||
}
|
||||
isaac64_init(&rnglist[rngindx].rng_state, new_rng_state, sizeof(seed));
|
||||
isaac64_init(&rnglist[rngindx].rng_state, new_rng_state,
|
||||
(int) sizeof seed);
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
15
src/role.c
15
src/role.c
@@ -728,9 +728,16 @@ int rolenum;
|
||||
}
|
||||
|
||||
int
|
||||
randrole()
|
||||
randrole(for_display)
|
||||
boolean for_display;
|
||||
{
|
||||
return rn2(SIZE(roles) - 1);
|
||||
int res = SIZE(roles) - 1;
|
||||
|
||||
if (for_display)
|
||||
res = rn2_on_display_rng(res);
|
||||
else
|
||||
res = rn2(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
STATIC_OVL int
|
||||
@@ -746,7 +753,7 @@ randrole_filtered()
|
||||
&& ok_gend(i, ROLE_NONE, ROLE_RANDOM, ROLE_NONE)
|
||||
&& ok_align(i, ROLE_NONE, ROLE_NONE, ROLE_RANDOM))
|
||||
set[n++] = i;
|
||||
return n ? set[rn2(n)] : randrole();
|
||||
return n ? set[rn2(n)] : randrole(FALSE);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -2021,7 +2028,7 @@ role_init()
|
||||
if (flags.pantheon == -1) { /* new game */
|
||||
flags.pantheon = flags.initrole; /* use own gods */
|
||||
while (!roles[flags.pantheon].lgod) /* unless they're missing */
|
||||
flags.pantheon = randrole();
|
||||
flags.pantheon = randrole(FALSE);
|
||||
}
|
||||
if (!g.urole.lgod) {
|
||||
g.urole.lgod = roles[flags.pantheon].lgod;
|
||||
|
||||
Reference in New Issue
Block a user