Opened 11 years ago

Closed 11 years ago

Last modified 5 years ago

#2030 closed enhancement (fixed)

[PATCH] "Save As" Function

Reported by: Laurens Bosman Owned by: Crynux
Priority: Should Have Milestone: Alpha 14
Component: UI & Simulation Keywords: simple patch
Cc: Patch:

Description

Hello Wildfire

The game should have a "Save As" function added to the game. As of right now this function is missing. You are only able to save the game as a "Quick Save" which gives the saved file a name according to the date and time of the save and the map played on. So if you have multiple games on the same map it is hard to find the game you want to resume.

Hopefully this will be implemented soon.

Thanks L. Bosman

Attachments (3)

saveAs.patch (7.2 KB ) - added by Crynux 11 years ago.
patch file
saveAsv2.patch (12.1 KB ) - added by Crynux 11 years ago.
updated patch
saveAsv3.patch (13.3 KB ) - added by Crynux 11 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 by leper, 11 years ago

Component: Core engineUI & Simulation
Keywords: simple added; Save as removed
Milestone: Alpha 14Backlog
Priority: Must HaveShould Have

comment:2 by leper, 11 years ago

Owner: Laurens Bosman removed

by Crynux, 11 years ago

Attachment: saveAs.patch added

patch file

comment:3 by Crynux, 11 years ago

Keywords: review patch added
Milestone: BacklogAlpha 14
Owner: set to Crynux
Status: newassigned
Summary: "Save As" Function[PATCH] "Save As" Function

Hello,

I've created a patch for this ticket. It add a "Save As" option below the existing "Save" menu option. It allows you to name the save file, instead of them all having the prefix "quicksave".

Additionally, the load menu will now show the prefix of the file, which allows users to determine whether the save was a quicksave, or a save they had given a name using "Save As".

Thanks!

comment:4 by historic_bruno, 11 years ago

What we probably want is to replace the current save option with the "save as" UI, and allow the user to type in a description when they save the game (independent of the file name). The description, rather than the file name, will be visible when loading the saved game. We could also display the list of previously saved games to allow them to overwrite one (defaulting to the last saved game of the session, if any)

comment:5 by Crynux, 11 years ago

I've made some changes to the patch.

  1. Removed the "Save As" option.
  2. Modified the save ui to be similar to the Load interface.
  3. Added the description to the savegame list; under the existing [date] mapname format.
  4. Widened both the Load menu and Save menu to account for wider descriptions.
  5. When saving, if you do not select a savegame from the list, clicking save will save the game as a new save; with the description provided. Additionally, when you click a existing savegame within the save menu, it's description will auto-fill in the description box, so you can modify it. When clicking save with a existing savegame selected, it will overwrite the selected savegame with the modified description.

I wasn't sure how to go about overwriting the last save without preventing the user from creating a new save.

Let me know what you think. I intend to clean up the code, once everything is finished.

Thanks!

EDIT: If you try to load a game that hasn't been saved using the patch, it may have "undefined" as the description. This is because I store the description as metadata within the save file.

Last edited 11 years ago by Crynux (previous) (diff)

by Crynux, 11 years ago

Attachment: saveAsv2.patch added

updated patch

comment:6 by historic_bruno, 11 years ago

Nice job, it works well in my brief testing and handles older saved games too :) The only addition I would suggest is a confirmation dialog before overwriting old saved games (like the confirmation when deleting them). It works intuitively, so I don't see any major changes needed.

Functions shared by loading and saving (e.g. sortDecreasingDate) should be moved to a utility script in gui/common.

comment:7 by Crynux, 11 years ago

Thank you! :)

I've added the confirmation dialog as suggested, and moved some of the functions to a new utility script. Additionally, created a save.js for some of the save functions just to keep things separate.

Please let me know if the attached patch works. It's my first time using a patch to add/remove files.

Thanks!

by Crynux, 11 years ago

Attachment: saveAsv3.patch added

comment:8 by ben, 11 years ago

Resolution: fixed
Status: assignedclosed

In 13579:

Adds saved game descriptions and in-game save dialog, based on patch by Crynux, fixes #2030

comment:9 by historic_bruno, 11 years ago

Keywords: review removed

I made a few changes to the patch, like separating the engine SaveGame functions into prefix and filename versions, to avoid obscuring the meaning with a bool :) (I've been guilty of this before and am trying to fight the urge to add a new parameter for everything)

I also moved the save game dialog onto its own GUI page, which makes interactions with the session UI a bit nicer (no accidental orders or clicking GUI objects) and makes the code more reusable in future.

comment:10 by elexis, 5 years ago

In 22922:

Happy savegame hack removal following rP13579, refs #2030.

Simply pass the JS value to the Save functions instead of letting those obtain the data later from the topmost GUI page.
The JS hack incidence appears to be unused since rP14496.

Differential Revision: https://code.wildfiregames.com/D2302
Tested on: clang 8.0.1, Jenkins

comment:11 by elexis, 5 years ago

In 22923:

Unify loadgame and savegame dialog following rP13579, refs #2030.

This way the save dialog gains the sortable list and details section feature from rP19351 / D246 by removing a folder of code, refs #4413.
Fixes a style warning about the old dialog using a style for an 'olist' type for a 'list' type, refs rP22792 / D2232.

Subsequently move the gui/common/ helper file to the page code, meaning it's not loaded for every GUI page needlessly anymore.
Fix map preview aspect ratio.
Use object-oriented code for the moved savegame code, refs #5387, but conserve the rest of the code to limit the changes for auditability.

Differential Revision: https://code.wildfiregames.com/D2290
Tested on: Jenkins

Note: See TracTickets for help on using tickets.