Added a few more comments. Changed rt_hash to return an enum record_type rather than an enum record_type_hash. Modified rfs and rfs_refr to suit.

This commit is contained in:
2022-09-07 10:09:25 +10:00
parent 86d2c1a002
commit de1a27e337
4 changed files with 140 additions and 102 deletions

View File

@@ -10,11 +10,32 @@
typedef struct meta_node MetaNode;
/* Meta Nodes are used for constructing a more flexible tree structure
* on top of
* on top of the natural structure of ESP/ESM files.
*
* Meta Nodes do not create a pure tree structure, rather they have pointers to
* their parent and first child, and children have pointers backwards and
* forward through a linked list of all of the children of the parent node.
*
* There is no root node as such, rather there is a root linked list for which
* all of the Meta Nodes have no parents.
*
* While the ESP/ESM buffer can be modified in-place, any modification that
* changes the size of the stored data cannot be directly written to the buffer
* without first shifting all of the data after the point of modification.
*
* Modifications that change data size are:
* - Adding or deleting a group or record
* - Adding or deleting a field in a record
* - Changing a variable length field with data of different length
*
* With a Meta Node you can instead allocate new, arbitrarily sized memory for
* the node data. The Meta Node tree can then be walked to reconstruct a
* contiguous view of discontiguous memory.
*/
struct meta_node {
Node n;
MetaNode *parent;
MetaNode *child;
MetaNode *prev;
MetaNode *next;
};