last? role/race/&c option values update
Keep track of how a role|race|gender|alignment option got its value so that role:!Tourist in .nethackrc and role:!Priest in NETHACKOPTIONS yield 'role:!Priest' rather than merging into 'role:!Priest !Tourist'. It also doesn't write the value into new config file for #saveoptions if that value comes from environment or command line (not applicable since the command line arguments for role,&c don't go through options handling). Also, the old config file value takes precedence over the current game's value file so that 'role:random' doesn't become 'role:Healer' or such in a new config after the random value gets picked for play. This only tracks the role, race, gender, and alignment options but the concept could be extended to all options. The data would need to be saved and restored if values set interactively need to be retained in restore sessions (doesn't apply to role,&c since those don't change during play).
This commit is contained in:
12
src/save.c
12
src/save.c
@@ -271,7 +271,7 @@ save_gamelog(NHFILE *nhfp)
|
||||
}
|
||||
|
||||
static void
|
||||
savegamestate(NHFILE* nhfp)
|
||||
savegamestate(NHFILE *nhfp)
|
||||
{
|
||||
unsigned long uid;
|
||||
|
||||
@@ -327,14 +327,17 @@ savegamestate(NHFILE* nhfp)
|
||||
save_oracles(nhfp);
|
||||
if (gu.ustuck_id) {
|
||||
if (nhfp->structlevel)
|
||||
bwrite(nhfp->fd, (genericptr_t) &gu.ustuck_id, sizeof gu.ustuck_id);
|
||||
bwrite(nhfp->fd, (genericptr_t) &gu.ustuck_id,
|
||||
sizeof gu.ustuck_id);
|
||||
}
|
||||
if (gu.usteed_id) {
|
||||
if (nhfp->structlevel)
|
||||
bwrite(nhfp->fd, (genericptr_t) &gu.usteed_id, sizeof gu.usteed_id);
|
||||
bwrite(nhfp->fd, (genericptr_t) &gu.usteed_id,
|
||||
sizeof gu.usteed_id);
|
||||
}
|
||||
if (nhfp->structlevel) {
|
||||
bwrite(nhfp->fd, (genericptr_t) gp.pl_character, sizeof gp.pl_character);
|
||||
bwrite(nhfp->fd, (genericptr_t) gp.pl_character,
|
||||
sizeof gp.pl_character);
|
||||
bwrite(nhfp->fd, (genericptr_t) gp.pl_fruit, sizeof gp.pl_fruit);
|
||||
}
|
||||
savefruitchn(nhfp);
|
||||
@@ -1205,6 +1208,7 @@ freedynamicdata(void)
|
||||
free_dungeons();
|
||||
free_CapMons();
|
||||
free_rect();
|
||||
freeroleoptvals(); /* saveoptvals(&tnhfp) */
|
||||
|
||||
/* some pointers in iflags */
|
||||
if (iflags.wc_font_map)
|
||||
|
||||
Reference in New Issue
Block a user