Expand description
Mart / shop interaction state machine — the UI-level counterpart of the
buy / sell money-and-inventory drivers.
MartState owns only the interaction flow of a shop: the
Buy/Sell/Quit top menu, item-list cursors, quantity selection, the
Yes/No confirmation sub-phase, and result display. It knows nothing
about prices, money, or bag capacity — those are supplied by the game
through the MartBackend callback trait, so every game keeps its own
pricing rules, currency semantics, and inventory quirks (per-slot caps,
overflow spill, unsellable key items, …).
MartDriver is a ready-made backend that routes transactions through
the engine’s buy / sell drivers and a
ShopProvider; games with special bag semantics
implement MartBackend directly instead.
Input uses the engine-wide MenuInput; sound cues are reported as
MartSound values the game maps to its own audio ids.
Structs§
- Mart
Driver - Ready-made
MartBackendthat routes transactions through the engine’sbuy/selldrivers and aShopProvider. - Mart
State - Complete mart interaction state machine.
- Mart
Stock - The list of items a shop stocks, in display order.
Enums§
- BuyMenu
State - Phases inside the Buy flow.
- BuyResult
- Outcome of a buy attempt, reported by
MartBackend::commit_buy. - Confirm
Choice - Yes/No choice used inside the confirmation sub-phase.
- Mart
Phase - Actual state machine phase (read via
MartState::phase). - Mart
Sound - Sound cues the mart layer can request.
- Mart
TopChoice - Top-menu cursor position.
- Mart
Update - Returned by
MartState::update_frameto signal the caller. - Sell
Menu State - Phases inside the Sell flow.
- Sell
Result - Outcome of a sell attempt, reported by
MartBackend::commit_sell.
Traits§
- Mart
Backend - Price / capacity / transaction callbacks the game supplies to
MartState. The state machine owns navigation; the backend owns all money and bag semantics.