Skip to main content

Module twoda_cache

Module twoda_cache 

Source
Expand description

Resolver-backed lazy 2DA table cache for decoders. Resolver-backed lazy cache of parsed 2DA tables.

Decoders that map raw engine integers (UTI property kinds, UTC class ids, TPC palette refs, …) to typed semantics need repeated read access to the same handful of 2DA tables: itempropdef.2da, baseitems.2da, iprp_*.2da, etc. Re-resolving and re-parsing those tables on every property read is wasteful, and pushing the cache into each format consumer fragments the duplication.

TwoDaCache is the shared primitive: borrow a Resolver, call TwoDaCache::twoda with a bare table name (no extension), get back a borrowed [TwoDa]. The first call resolves, parses, and caches the table; subsequent calls hand back the cached parse. A single instance can serve a whole batch decode pass across multiple format decoders.

Modules§

tables
Compile-time-validated TwoDaName constants for the vanilla K1 2DA tables the workspace currently consumes.

Structs§

TwoDaCache
Resolver-backed cache of parsed 2DA tables.
TwoDaName
A validated 2DA table name (e.g. racialtypes, appearance).

Enums§

TwoDaCacheError
Errors produced by TwoDaCache operations.