Extract MessageLine, Player pack ops, and Level list management
Refactor step 6. MessageLine (was MsgLine) owns the msg/addmsg/endmsg machinery, wired to its screen, pre---More-- redraw, and input via attach(); RogueGame keeps one-line msg/addmsgf/endmsg shorthands so the ~400 call sites are unchanged. Player gains nextPackChar and removeFromPack (the state half of pack.c leave_pack); leavePack keeps only the LastPick repeat-command tracking. Level gains ObjectAt (misc.c find_obj) and AddObject/RemoveObject/AddMonster/RemoveMonster, replacing direct attach/detach calls on the level lists. Inventory and pickup UI flows stay on RogueGame: display and orchestration, not state surgery. Behavior and RNG order unchanged; suite green.
This commit is contained in:
41
TODO.md
41
TODO.md
@@ -29,14 +29,25 @@ Refactor ground rules:
|
||||
|
||||
# Next Step
|
||||
|
||||
Refactor step 6: extract types from the god object — MessageLine
|
||||
owns the msg/addmsg/endmsg machinery; pack/inventory operations move
|
||||
onto *Player; monster/object list management and map queries
|
||||
consolidate onto *Level; RogueGame keeps turn orchestration and
|
||||
cross-system effects only.
|
||||
Refactor step 7: effects dispatch — the giant quaff/readScroll/doZap
|
||||
switches become per-kind handler tables of small named methods,
|
||||
keeping effect order and RNG call sequence identical. This step also
|
||||
clears the outstanding cyclop/gocognit/nestif lint findings.
|
||||
|
||||
# Completed Steps
|
||||
|
||||
- 2026-07-07 Refactor step 6 (refactor/god-object-extraction):
|
||||
MessageLine (was MsgLine) owns the msg/addmsg/endmsg machinery,
|
||||
wired to its screen/look/input needs via attach(); RogueGame keeps
|
||||
one-line msg/addmsgf/endmsg shorthands so call sites are unchanged.
|
||||
Player owns pack bookkeeping (nextPackChar, removeFromPack — the
|
||||
state half of leave_pack; leavePack keeps only LastPick tracking).
|
||||
Level owns object/monster list management and lookup (ObjectAt
|
||||
replaces findObj; AddObject/RemoveObject/AddMonster/RemoveMonster
|
||||
replace direct attachObj/detachObj/attachMon/detachMon on level
|
||||
lists). Inventory/pickup UI flows stay on RogueGame deliberately:
|
||||
they are display and turn orchestration, not state surgery.
|
||||
|
||||
- 2026-07-07 Refactor step 5 (refactor/item-combat-ui-renames, three
|
||||
commits, one subsystem each): items — getItem→promptPackItem now
|
||||
returning (obj, ok), invName→inventoryName, doPot→applyPotionFuse;
|
||||
@@ -117,31 +128,27 @@ cross-system effects only.
|
||||
|
||||
# Future Steps
|
||||
|
||||
1. Refactor step 7: effects dispatch — the giant quaff/readScroll/doZap
|
||||
switches become per-kind handler tables of small named methods,
|
||||
keeping effect order and RNG call sequence identical. This step also
|
||||
clears the outstanding cyclop/gocognit/nestif lint findings.
|
||||
2. Refactor step 8: constructor and style pass per the house
|
||||
1. Refactor step 8: constructor and style pass per the house
|
||||
styleguide — game.New(game.Params{...}) replacing NewGame(Config);
|
||||
replace the gameEnd panic unwind with error-based turn results where
|
||||
feasible; 77-column wrap sweep.
|
||||
3. Docs refresh: update ARCHITECTURE.md Part 2 and README.md for the
|
||||
2. Docs refresh: update ARCHITECTURE.md Part 2 and README.md for the
|
||||
post-refactor names; add the C name → Go name rename table.
|
||||
4. Playtest hardening pass: play several full games with the tcell
|
||||
3. Playtest hardening pass: play several full games with the tcell
|
||||
binary and extend run_test.go to script a deeper multi-level
|
||||
playthrough (descend past level 5, use potions, scrolls, zapping,
|
||||
save/restore). Fix any panics, message mismatches, or divergences
|
||||
from the C behavior that this uncovers, with regression tests.
|
||||
5. Verify the seed-compatibility claim against the C reference on
|
||||
4. Verify the seed-compatibility claim against the C reference on
|
||||
c-master: same seed, same dungeon, same item tables, for several
|
||||
seeds.
|
||||
6. Broaden unit test coverage where playtesting finds thin spots
|
||||
5. Broaden unit test coverage where playtesting finds thin spots
|
||||
(rings, sticks, wizard commands).
|
||||
7. Tag a release once a full game (Amulet retrieval and score entry)
|
||||
6. Tag a release once a full game (Amulet retrieval and score entry)
|
||||
completes without defects.
|
||||
8. Full-terminal-size support (deferred by explicit decision
|
||||
7. Full-terminal-size support (deferred by explicit decision
|
||||
2026-07-06): per-game dungeon dimensions instead of the 80x24
|
||||
constants; open design questions are resize policy, gameplay
|
||||
tuning at larger sizes, and a --classic 80x24 mode.
|
||||
9. Note: this repo is exempt from the standard policy scaffold. Do not
|
||||
8. Note: this repo is exempt from the standard policy scaffold. Do not
|
||||
add Makefile, Dockerfile, or REPO_POLICIES.md.
|
||||
|
||||
Reference in New Issue
Block a user