savefile changes - part 1
This is the first of several savefile-related changes to follow later. This one is groundwork for those later changes. Remove internal compression schemes (RLECOMP and ZEROCOMP) and discard the savefile_info struct that was primarily used to convey which internal compression schemes had been in use. Relocate some struct definitions into appropriate header files for use by code to come in later changes. Remove the two struct size-related fields from version_info and from the nmakedefs_s. Instead, include a series of bytes near the beginning of the savefile, representing the size of each struct or base data type that impacts the historical savefile content. Those are referred to as the "critical bytes". (Related note: the "you" struct required two bytes, low and high, due to its size). Compare those critical bytes in a savefile against the NetHack build that is reading the savefile. This allows mismatch detection early in the savefile-reading process, and a clean exit, rather than proceeding to read nonsensical values from the file. Include some feedback on what the first mismatch was when encountering one. For arrays stored in the savefile, use loop-logic in the core to write/read the array elements one at a time, rather than in a single blob. This will be required for changes to follow later. (impacts artiexist[], artidisco[], svd.dungeons[], svl.level_info[], svl.level.locations[][], msrooms[] field of mapseen, svb.bases[], svb.disco[] objects[], svm.mvitals[], svs.spl_book[], svd.doors[], go.oracle_loc[], utrack[], wgrowtime[]) This also adds data model to the long version information. This invalidates existing save and bones files due to the changes in the information at the start of the file.
This commit is contained in:
@@ -188,66 +188,71 @@ struct linfo {
|
||||
|
||||
/* what the player knows about a single dungeon level */
|
||||
/* initialized in mklev() */
|
||||
struct mapseen_feat {
|
||||
/* feature knowledge that must be calculated from levl array */
|
||||
Bitfield(nfount, 2);
|
||||
Bitfield(nsink, 2);
|
||||
Bitfield(naltar, 2);
|
||||
Bitfield(nthrone, 2);
|
||||
|
||||
Bitfield(ngrave, 2);
|
||||
Bitfield(ntree, 2);
|
||||
Bitfield(water, 2);
|
||||
Bitfield(lava, 2);
|
||||
|
||||
Bitfield(ice, 2);
|
||||
/* calculated from rooms array */
|
||||
Bitfield(nshop, 2);
|
||||
Bitfield(ntemple, 2);
|
||||
/* altar alignment; MSA_NONE if there is more than one and
|
||||
they aren't all the same */
|
||||
Bitfield(msalign, 2);
|
||||
|
||||
Bitfield(shoptype, 5);
|
||||
};
|
||||
struct mapseen_flags {
|
||||
Bitfield(notreachable, 1); /* can't get back to this level */
|
||||
Bitfield(forgot, 1); /* player has forgotten about this level */
|
||||
Bitfield(knownbones, 1); /* player aware of bones */
|
||||
Bitfield(oracle, 1);
|
||||
Bitfield(sokosolved, 1);
|
||||
Bitfield(bigroom, 1);
|
||||
Bitfield(castle, 1);
|
||||
Bitfield(castletune, 1); /* add tune hint to castle annotation */
|
||||
|
||||
Bitfield(valley, 1);
|
||||
Bitfield(msanctum, 1);
|
||||
Bitfield(ludios, 1);
|
||||
Bitfield(roguelevel, 1);
|
||||
/* quest annotations: quest_summons is for main dungeon level
|
||||
with entry portal and is reset once quest has been finished;
|
||||
questing is for quest home (level 1) */
|
||||
Bitfield(quest_summons, 1); /* heard summons from leader */
|
||||
Bitfield(questing, 1); /* quest leader has unlocked quest stairs */
|
||||
/* "gateway to sanctum" */
|
||||
Bitfield(vibrating_square, 1); /* found vibrating square 'trap';
|
||||
* flag cleared once the msanctum
|
||||
* annotation has been added (on
|
||||
* the next dungeon level; temple
|
||||
* entered or high altar mapped) */
|
||||
Bitfield(spare1, 1); /* not used */
|
||||
};
|
||||
|
||||
struct mapseen_rooms {
|
||||
Bitfield(seen, 1);
|
||||
Bitfield(untended, 1); /* flag for shop without shk */
|
||||
};
|
||||
|
||||
typedef struct mapseen {
|
||||
struct mapseen *next; /* next map in the chain */
|
||||
branch *br; /* knows about branch via taking it in goto_level */
|
||||
d_level lev; /* corresponding dungeon level */
|
||||
struct mapseen_feat {
|
||||
/* feature knowledge that must be calculated from levl array */
|
||||
Bitfield(nfount, 2);
|
||||
Bitfield(nsink, 2);
|
||||
Bitfield(naltar, 2);
|
||||
Bitfield(nthrone, 2);
|
||||
|
||||
Bitfield(ngrave, 2);
|
||||
Bitfield(ntree, 2);
|
||||
Bitfield(water, 2);
|
||||
Bitfield(lava, 2);
|
||||
|
||||
Bitfield(ice, 2);
|
||||
/* calculated from rooms array */
|
||||
Bitfield(nshop, 2);
|
||||
Bitfield(ntemple, 2);
|
||||
/* altar alignment; MSA_NONE if there is more than one and
|
||||
they aren't all the same */
|
||||
Bitfield(msalign, 2);
|
||||
|
||||
Bitfield(shoptype, 5);
|
||||
} feat;
|
||||
struct mapseen_flags {
|
||||
Bitfield(notreachable, 1); /* can't get back to this level */
|
||||
Bitfield(forgot, 1); /* player has forgotten about this level */
|
||||
Bitfield(knownbones, 1); /* player aware of bones */
|
||||
Bitfield(oracle, 1);
|
||||
Bitfield(sokosolved, 1);
|
||||
Bitfield(bigroom, 1);
|
||||
Bitfield(castle, 1);
|
||||
Bitfield(castletune, 1); /* add tune hint to castle annotation */
|
||||
|
||||
Bitfield(valley, 1);
|
||||
Bitfield(msanctum, 1);
|
||||
Bitfield(ludios, 1);
|
||||
Bitfield(roguelevel, 1);
|
||||
/* quest annotations: quest_summons is for main dungeon level
|
||||
with entry portal and is reset once quest has been finished;
|
||||
questing is for quest home (level 1) */
|
||||
Bitfield(quest_summons, 1); /* heard summons from leader */
|
||||
Bitfield(questing, 1); /* quest leader has unlocked quest stairs */
|
||||
/* "gateway to sanctum" */
|
||||
Bitfield(vibrating_square, 1); /* found vibrating square 'trap';
|
||||
* flag cleared once the msanctum
|
||||
* annotation has been added (on
|
||||
* the next dungeon level; temple
|
||||
* entered or high altar mapped) */
|
||||
Bitfield(spare1, 1); /* not used */
|
||||
} flags;
|
||||
struct mapseen_feat feat;
|
||||
struct mapseen_flags flags;
|
||||
/* custom naming */
|
||||
char *custom;
|
||||
unsigned custom_lth;
|
||||
struct mapseen_rooms {
|
||||
Bitfield(seen, 1);
|
||||
Bitfield(untended, 1); /* flag for shop without shk */
|
||||
} msrooms[(MAXNROFROOMS + 1) * 2]; /* same size as svr.rooms[] */
|
||||
struct mapseen_rooms msrooms[(MAXNROFROOMS + 1) * 2]; /* same size as svr.rooms[] */
|
||||
/* dead heroes; might not have graves or ghosts */
|
||||
struct cemetery *final_resting_place; /* same as level.bonesinfo */
|
||||
} mapseen;
|
||||
|
||||
Reference in New Issue
Block a user