Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Add a load quicksave hotkey #6582

Open
lL1l1 opened this issue Dec 12, 2024 · 0 comments
Open

[Feature]: Add a load quicksave hotkey #6582

lL1l1 opened this issue Dec 12, 2024 · 0 comments
Labels
area: ui Anything to do with the User Interface of the Game

Comments

@lL1l1
Copy link
Contributor

lL1l1 commented Dec 12, 2024

Describe the Feature

Since there is a quicksave hotkey, there should be a corresponding quickload hotkey to make iterating on your gameplay with quicksaves easier. Additionally, quickload on a key is a typical feature of many games, so it is expected to exist if quicksave exists.

This lua code runs the quick load for a skirmish in the US localization:

local path = GetSpecialFilePath(import("/lua/user/prefs.lua").GetCurrentProfile().Name, "QuickSave", "SaveGame")
LoadSavedGame(path)

I adapted it from the quicksave function:

fa/lua/ui/game/gamemain.lua

Lines 1073 to 1098 in 727125e

function QuickSave(filename)
if SessionIsActive() and
WorldIsPlaying() and
not SessionIsGameOver() and
not SessionIsMultiplayer() and
not SessionIsReplay() and
not IsNISMode() then
local saveType
if import("/lua/ui/campaign/campaignmanager.lua").campaignMode then
saveType = "CampaignSave"
else
saveType = "SaveGame"
end
local path = GetSpecialFilePath(Prefs.GetCurrentProfile().Name, filename, saveType)
local statusStr = "<LOC saveload_0002>Quick Save in progress..."
local status = UIUtil.ShowInfoDialog(GetFrame(0), statusStr)
InternalSaveGame(path, filename, function(worked, errmsg)
status:Destroy()
if not worked then
infoStr = LOC("<LOC uisaveload_0008>Save failed! ") .. errmsg
UIUtil.ShowInfoDialog(GetFrame(0), infoStr, "<LOC _Ok>")
end
end)
end
end

It's worth nothing that "QuickSave" is the localized string "<LOC QuickSave>QuickSave".

Quickload also needs the same conditionals as QuickSave (active session, campaign vs skirmish, not multiplayer or replay, etc.).

Expected Behavior

No response

Screenshots

No response

Additional context

No response

@lL1l1 lL1l1 added the area: ui Anything to do with the User Interface of the Game label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ui Anything to do with the User Interface of the Game
Projects
None yet
Development

No branches or pull requests

1 participant