Tes4Mod:Save File Format/CELL

A CELL Change Record (change record type 48) describes changes to the game's cells (CELL mod file records).  It can contain the following subrecords (with their corresponding byte in the overall Flags), in order of appearance:
Unnamed (26)
Detach Time (27)
Cell Flags (3)
Seen Data (28)
Full Name (4)
Ownership (5)
Pathgrid Modified (24)
Cell Created (1) -- zero-length
Unnamed (2) -- zero-length
The relative positions of the subrecords have all been confirmed; their contents (as far as they are understood) are based on actual save files.

Cell Created
"Cell Created" is true when bit 1 (0x00000002) is set in a CELL record's overall Flags.  No subrecords or data are added to the record when this flag is set.

It is possible that "Cell Created" is associated with bit 2 instead of bit 1 (see notes below).  However, by analogy to other records where bit 1 is used for "Created", it is inferred that bit 1 is the correct assignment.



Unnamed (2)
An unnamed value is true when bit 2 (0x00000004) is set in a CELL record's overall Flags.  No subrecords or data are added to the record when this flag is set.

The name of this parameter is unknown, because the text dump files do not specify its name.  More specifically, in all cases, bits 1 and 2 are set simultaneously.  When bits 1 and 2 are set, the text dump files list only one additional change subrecord: "Cell Created".  It is unknown whether "Cell Created" is associated with bit 1 or bit 2.   However, by analogy to other records where bit 1 is used for "Created" (e.g., ACHR, ACRE and REFR), it is inferred that bit 1 is the correct assignment, leaving bit 2 unnamed.

The text dump files and analyses of the binary save file contents both show that no data is added to CELL records when these flags are set.



Unnamed (26)
This unnamed subrecord is present when bit 26 (0x04000000) is set in the record's overall Flags.  Its length is a constant 4 bytes.  The meaning of the data contained in this subrecord is unknown.

The name of this parameter is unknown, because the text dump files do not specify its name: no additional change subrecords are listed when bit 26 is set.



Detach Time
The Detach Time subrecord is present when bit 27 (0x08000000) is set in a CELL record's overall Flags.  Its length is a constant 4 bytes.  The meaning of the data contained in this subrecord is uncertain, but it might be a measure of the time that has passed since the player left the cell.  Analysis of the CELL records is partially based on this assumption, assuming that "Detach Time" is a ulong value, and its value is normally less than 65000 (e.g., that bytes 3 and 4 of this subrecord are normally 0x00).



Cell Flags
The Cell Flags subrecord is present when bit 3 (0x00000008) is set in a CELL record's overall Flags.  Its length is a constant 1 byte.  The meaning of the data contained in this subrecord is unknown.



Seen Data
The Seen Data subrecord is present when bit 28 (0x10000000) is set in a CELL record's overall Flags.  Its length is variable, and the parameters controlling its length are only partially understood.  The meaning of the data contained in this subrecord is unknown.

The subrecord can be 0, 32, 36, or 36+n*34 bytes in length.  If the subrecord length is at least 36 bytes, then the following structure always describes the data.  However, nothing in the save file appears to be an indicator for when the subrecord is less than 36 bytes.  It is possible that information from the original mod data for the CELL record is necessary to predict the subrecord length.  Otherwise, the correct length can be inferred based on how much data is available within the CELL change record.



Full Name
The Full Name subrecord is present when bit 4 (0x00000010) is set in a CELL record's overall Flags.  It contains a variable-length string, providing the new name of the cell.

Note that NPC_ change records can also contain a "Full Name" subrecord with the same contents, but in NPC_ records, its presence is triggered by bit 7, not bit 4.



Ownership
The Ownership subrecord is present when bit 5 (0x00000020) is set in a CELL record's overall Flags.  Its length is a constant 4 bytes.  Its contents are an iref pointing to the new owner of the cell (for example, after the player has purchased a house).  In analyzed cases, the iref pointed to a NPC_ record, but presumably it could also be a FACT record (by analogy to other ownership subrecords).

Note that REFR and ACRE change records can contain a similar "Owner" subrecord.  However, in REFR and ACRE records, its presence is triggered by bit 7, not bit 5, and the data is provided as a property rather than an independent subrecord.

Earlier documentation listed the contents as a formid, rather than an iref, but recent analyses have only found irefs.



Pathgrid Modified
The Pathgrid Modified subrecord is present when bit 24 (0x01000000) is set a CELL the record's overall Flags.  Its length is variable, but the parameters controlling its length seem to be understood (based on a limited number of samples).  The meaning of the data contained in this subrecord is unknown.

Earlier documentation listed the subrecord's length as constant 4 bytes, but in more recent analyses 2- and 6-byte length subrecords have been seen.  The following structure correctly describes the length of the analyzed subrecords.  However, this subrecord is fairly uncommon (maybe one or two occurrences in a savefile).  Combined with the generally limited understanding of a CELL record's contents, this makes any conclusions about the Pathgrid Modified subrecord very uncertain.