add some foundational work for uplifts

Be able to carry out uplifts during minor release
lifetimes.

Document a way to be able to uplift struct content
without incrementing EDITLEVEL and breaking existing savefiles.
Use the mechanics outlined to uplift the contents instead, where
it is feasible to do so. The uplift is currently one-way only. An
uplifted savefile cannot be used with an earlier build of NetHack
, one built with a lower SAVEFILE_REVISION_LEVEL, than the one which
wrote the savefile.

The final byte (byte 79) of the 80 critical bytes in the savefile,
of which 10 are reserved for future expansion and not currently
used, will now be used for holding the savefile revision level
(SAVEFILE_REVISION_LEVEL in include/patchlevel.h) at the time
the savefile was written.

That leaves 9 of the bytes available for future use.
This commit is contained in:
nhmall
2026-05-27 16:14:20 -04:00
parent e352048612
commit ce31feb231
21 changed files with 526 additions and 117 deletions
+12 -11
View File
@@ -157,12 +157,12 @@ HACKCSRC = allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.c \
monmove.c monst.c mplayer.c mthrowu.c muse.c music.c o_init.c \
objects.c objnam.c options.c pager.c pickup.c pline.c polyself.c \
potion.c pray.c priest.c quest.c questpgr.c read.c rect.c \
region.c report.c restore.c rip.c rnd.c role.c rumors.c save.c \
selvar.c sfstruct.c shk.c shknam.c sit.c sounds.c sp_lev.c \
spell.c stairs.c steal.c steed.c strutil.c sys.c teleport.c \
timeout.c topten.c track.c trap.c u_init.c uhitm.c vault.c \
version.c vision.c weapon.c were.c wield.c windows.c wizard.c \
wizcmds.c worm.c worn.c write.c zap.c
region.c report.c restore.c revision.c rip.c rnd.c role.c \
rumors.c save.c selvar.c sfstruct.c shk.c shknam.c sit.c sounds.c \
sp_lev.c spell.c stairs.c steal.c steed.c strutil.c sys.c \
teleport.c timeout.c topten.c track.c trap.c u_init.c uhitm.c \
vault.c version.c vision.c weapon.c were.c wield.c windows.c \
wizard.c wizcmds.c worm.c worn.c write.c zap.c
#-# generated source files (vis_tab.c is gone; tile.c is handled separately
#-# via WINxxxSRC)
@@ -180,11 +180,11 @@ HACKINCL = align.h artifact.h artilist.h attrib.h botl.h \
fnamesiz.h func_tab.h global.h warnings.h hack.h lint.h mextra.h \
micro.h mkroom.h monattk.h mondata.h monflag.h monst.h monsters.h \
mfndpos.h nhmd4.h obj.h objects.h objclass.h optlist.h patchlevel.h \
pcconf.h permonst.h prop.h rect.h region.h savefile.h selvar.h sym.h \
rm.h sp_lev.h spell.h sndprocs.h seffects.h stairs.h sys.h \
tcap.h timeout.h tradstdc.h trap.h unixconf.h vision.h vmsconf.h \
wintty.h wincurs.h winX.h winprocs.h wintype.h you.h youprop.h \
weight.h
pcconf.h permonst.h prop.h rect.h region.h revision.h savefile.h \
selvar.h sym.h rm.h sp_lev.h spell.h sndprocs.h seffects.h \
stairs.h sys.h tcap.h timeout.h tradstdc.h trap.h unixconf.h \
vision.h vmsconf.h wintty.h wincurs.h winX.h winprocs.h wintype.h \
you.h youprop.h weight.h
#HSOURCES = $(HACKINCL) date.h onames.h pm.h
@@ -575,6 +575,7 @@ read.obj : read.c $(HACK_H)
rect.obj : rect.c $(HACK_H)
region.obj : region.c $(HACK_H)
restore.obj : restore.c $(HACK_H) $(INC)tcap.h
revision.obj : revision.c $(HACK_H)
rip.obj : rip.c $(HACK_H)
rnd.obj : rnd.c $(HACK_H)
role.obj : role.c $(HACK_H)
+2 -1
View File
@@ -102,7 +102,7 @@ CONFIGBASEH := color config config1 patchlevel tradstdc hacklib integer \
HACKBASEH := hack lint align dungeon wintype sym defsym \
mkroom artilist objclass objects youprop \
prop permonst monattk monflag monsters \
mondata context rm botl rect region trap \
mondata context rm botl rect region revision trap \
display vision seffects selvar sndprocs stairs decl \
quest spell obj engrave you attrib monst \
mextra skills timeout flag winprocs sys
@@ -800,6 +800,7 @@ $(TARGETPFX)rect.obj: rect.c $(HACK_H)
$(TARGETPFX)region.obj: region.c $(HACK_H)
$(TARGETPFX)report.obj: report.c $(HACK_H)
$(TARGETPFX)restore.obj: restore.c $(HACK_H) $(INCL)tcap.h
$(TARGETPFX)revision.obj: revision.c $(HACK_H)
$(TARGETPFX)rip.obj: rip.c $(HACK_H)
$(TARGETPFX)rnd.obj: rnd.c $(HACK_H) $(INCL)isaac64.h
$(TARGETPFX)role.obj: role.c $(HACK_H)