centralize calls to make_zzword()
make_zzword() now called in set_seed(), because the only times it was called in the entire application is after every invocation of set_seed().
This commit is contained in:
parent
be115e9567
commit
85f8334e17
4 changed files with 5 additions and 9 deletions
3
init.c
3
init.c
|
@ -92,8 +92,5 @@ long initialise(void)
|
||||||
}
|
}
|
||||||
game.conds = setbit(11);
|
game.conds = setbit(11);
|
||||||
|
|
||||||
/* Start-up, dwarf stuff */
|
|
||||||
make_zzword(game.zzword);
|
|
||||||
|
|
||||||
return seedval;
|
return seedval;
|
||||||
}
|
}
|
||||||
|
|
2
main.c
2
main.c
|
@ -141,8 +141,6 @@ static bool fallback_handler(char *buf)
|
||||||
printf("Seed set to %ld\n", sv);
|
printf("Seed set to %ld\n", sv);
|
||||||
// autogenerated, so don't charge user time for it.
|
// autogenerated, so don't charge user time for it.
|
||||||
--game.turns;
|
--game.turns;
|
||||||
// here we reconfigure any global game state that uses random numbers
|
|
||||||
make_zzword(game.zzword);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
7
misc.c
7
misc.c
|
@ -633,8 +633,8 @@ long atdwrf(long where)
|
||||||
return (at);
|
return (at);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Utility routines (SETBIT, TSTBIT, set_seed, get_next_lcg_value,
|
/* Utility routines (setbit, tstbit, set_seed, get_next_lcg_value,
|
||||||
* randrange, RNDVOC) */
|
* randrange) */
|
||||||
|
|
||||||
long setbit(long bit)
|
long setbit(long bit)
|
||||||
/* Returns 2**bit for use in constructing bit-masks. */
|
/* Returns 2**bit for use in constructing bit-masks. */
|
||||||
|
@ -652,6 +652,9 @@ void set_seed(long seedval)
|
||||||
/* Set the LCG seed */
|
/* Set the LCG seed */
|
||||||
{
|
{
|
||||||
game.lcg_x = (unsigned long) seedval % game.lcg_m;
|
game.lcg_x = (unsigned long) seedval % game.lcg_m;
|
||||||
|
|
||||||
|
// once seed is set, we need to generate the Z`ZZZ word
|
||||||
|
make_zzword(game.zzword);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long get_next_lcg_value(void)
|
unsigned long get_next_lcg_value(void)
|
||||||
|
|
|
@ -122,8 +122,6 @@ int restore(FILE* fp)
|
||||||
rspeak(VERSION_SKEW, save.version / 10, MOD(save.version, 10), VRSION / 10, MOD(VRSION, 10));
|
rspeak(VERSION_SKEW, save.version / 10, MOD(save.version, 10), VRSION / 10, MOD(VRSION, 10));
|
||||||
} else {
|
} else {
|
||||||
memcpy(&game, &save.game, sizeof(struct game_t));
|
memcpy(&game, &save.game, sizeof(struct game_t));
|
||||||
//game.zzword = rndvoc(3, game.zzword);
|
|
||||||
make_zzword(game.zzword);
|
|
||||||
}
|
}
|
||||||
return GO_TOP;
|
return GO_TOP;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue