Add text UI tick-speed toggle and guard -1 location lookups - #102
Conversation
- handleKeyDownEvent's text UI branch was missing the 'l' key case that the pygame branch already had, so --text-ui players had no way to toggle config.limitTickSpeed despite README documenting the control generically. Added the case, updated TextRenderer.renderControls(), and added a regression test. - Ophidian.getLocation() now guards against a locationID that isn't a real grid location (e.g. an entity's default -1 sentinel from Entity.__init__) instead of letting Grid.getLocation() raise an unhandled KeyError, and movePreviousSnakePart() returns immediately after quitApplication() rather than falling through. Closes #101 Closes #22
|
Self-review: both fixes are narrowly scoped and verified against source. One pre-existing rough edge, not introduced by this PR and left out of scope (outside both linked issues): This comment was drafted during a Gardener session (Stephenson-Software/gardener). |
Summary
handleKeyDownEventwas missing thelkey case present in the pygame branch, so--text-uiplayers had no way to toggleconfig.limitTickSpeedeven though README documents the control generically. Added the case and updatedTextRenderer.renderControls()to mention it.Ophidian.getLocation()now guards against alocationIDthat isn't a real grid location (e.g. an entity's default-1sentinel fromEntity.__init__) instead of lettingGrid.getLocation()raise an unhandledKeyError.movePreviousSnakePart()now returns immediately afterquitApplication()instead of falling through to use a location that was never fetched.Test plan
python -m pytest— 91 passedtest_text_ui_l_key_toggles_tick_speed_limitcovers the text UIlkey handlingCloses #101
Closes #22
This PR description was drafted during a Gardener session (Stephenson-Software/gardener).