Skip to content

Fix TypeError crash in --thorough mode on V1-3 Z-machine games#3

Open
aliciusschroeder wants to merge 1 commit into
avwohl:mainfrom
aliciusschroeder:fix/v3-save-restore-branch-semantics
Open

Fix TypeError crash in --thorough mode on V1-3 Z-machine games#3
aliciusschroeder wants to merge 1 commit into
avwohl:mainfrom
aliciusschroeder:fix/v3-save-restore-branch-semantics

Conversation

@aliciusschroeder
Copy link
Copy Markdown

Summary

Problem

step() unconditionally called set_variable(store_var, ...) for save/restore, but store_var is None on V1-3
games where these opcodes use branch instead of store. Crashed on any V3 game hitting save/restore (triggered by
--thorough vocabulary scan).

Change

zwalker/zmachine.py — save/restore handlers now check store_var is not None before storing, falling back to
_do_branch() for V1-3.

Test

uv run zwalker explore ./games/zcode/zork1.z3 --thorough

Completes without crash (687 commands, 16 rooms found).

save/restore opcodes use branch semantics in V1-3 but store in V4+.
The step() handler unconditionally called set_variable(store_var, ...)
which crashed with None when store_var wasn't set for V3 games.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

explore crashes with --thorough flag on V1-3 games (TypeError in set_variable)

1 participant