Skip to content

[Feature]: Add a load quicksave hotkey #6582

@lL1l1

Description

@lL1l1

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: uiAnything to do with the User Interface of the Game

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions