Skip to main content
Verticopolis engineGitHub

Module catalog

Module catalog 

Source
Expand description

The catalog: engine-authored data a frontend draws menus, prices and placement ghosts from, resolved for one mode so the frontend never applies simulation rules itself.

catalog returns a Catalog: world geometry, economy constants, pooled caps and one FacilityEntry per facility kind. It serializes to JSON with camelCase keys, the same JSON the JavaScript package returns.

use verticopolis_engine::catalog::{catalog, CATALOG_VERSION};
use verticopolis_engine::clock::GameMode;
use verticopolis_engine::facilities::Kind;

let classic = catalog(GameMode::Classic);
assert_eq!(classic.version, CATALOG_VERSION);
let office = classic.facilities.iter().find(|f| f.key == Kind::Office.as_str()).unwrap();
println!("{} costs ${} and opens at {} star", office.name, office.cost, office.min_star);

The conformance suite pins each mode’s catalog by hash, so a change to a price or a rule shows up as a deliberate change to the lock.

Structs§

CalendarEntry
One calendar a tower can run and how it scales the quoted figures.
Catalog
Every price, size and build rule of one mode.
Economy
The mode’s economy constants a UI shows, in dollars.
ExterminatorFees
What the exterminator charges, where the mode has one.
FacilityEntry
One facility kind, resolved for the catalog’s mode.
PoolEntry
A cap several kinds share.
Rules
Mode rules a frontend shows the player, each stated from the engine’s own rule method, so a frontend reads them here instead of deciding them from the mode’s name.
Rung
One rung of a price ladder.
World
The tower geometry a placement needs.

Enums§

Rent
How the player prices a kind: a ladder of fixed rungs (Classic) or a continuous band (Modern).

Constants§

CATALOG_VERSION
The version of the catalog’s shape. It moves when a field is added, renamed or removed, so a frontend can refuse a shape it does not know.

Functions§

catalog
The catalog for mode.
catalog_digest
The canonical hash of the catalog for mode, as conformance/catalog-digests.json records it: the lock view, so the exempt footprints do not move it.
catalog_json
The catalog for mode as canonical JSON text: the bytes the lock hashes, and the text the JavaScript package returns.
catalog_value
The catalog for mode as a JSON value.