Skip to content

load-save: fix for the current title screen interface - #1619

Open
Alistair-Afton wants to merge 2 commits into
DFHack:masterfrom
Alistair-Afton:fix-load-save
Open

Alistair-Afton wants to merge 2 commits into
DFHack:masterfrom
Alistair-Afton:fix-load-save

Conversation

@Alistair-Afton

Copy link
Copy Markdown

Summary

load-save still drove the pre-Steam title screen interface: it wrote sel_menu_line (the field is now selected), fed SELECT, and then looked for a standalone viewscreen_loadgamest save picker that no longer exists. The script was effectively dead.

The current viewscreen_titlest manages the whole continue-game flow through its mode field (main menu -> active world list -> save list) and only responds to mouse input. The script now runs in a gui.script coroutine, clicks list rows at their pixel positions, and follows the mode transitions:

  • mode 0 (main menu): clicks "Continue" to reach the world list
  • mode 2 (world list): enters each world in turn and searches its save list (mode 3), backing out with LEAVESCREEN between misses
  • mode 3 (save list): also handled as a starting point
  • verifies the save being loaded via the load screen's cur_save header instead of trusting the row click, so a missed probe errors out instead of silently loading the wrong save

Related: DFHack/dfhack#978 (enhancement wishlist; this restores basic functionality). This also unblocks the TODO in test.lua's ensure_fortress that wants to load a specified save dir via load-save.

Testing

  • load-save region1 from the main menu: enters world list -> save list -> loads region1, verified via world.cur_savegame.save_dir
  • starting while the world list or save list is already open works as well
  • load-save bogus: reports "Can't find save: bogus" and leaves the screen on the world list
  • running with a fortress already loaded reports "Can't find title or load game screen"

The script still drove the old interface: it wrote sel_menu_line
(renamed to selected) and fed SELECT, then looked for a standalone
viewscreen_loadgamest save picker that no longer exists. The current
title screen manages the whole continue-game flow through its mode
field (main menu, world list, save list) and only responds to mouse
input, so the script now clicks list rows and follows the mode
transitions in a gui.script coroutine.

Also searches every world in the list instead of only the first, and
verifies the save being loaded matches the requested folder name.
Validated on the current title screen interface; also remove the stale
reference to the standalone "load game" screen, which no longer exists.
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.

1 participant