#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)
Change History (14)
comment:1 by , 11 years ago
Component: | Core engine → UI & Simulation |
---|---|
Keywords: | simple added; Save as removed |
Milestone: | Alpha 14 → Backlog |
Priority: | Must Have → Should Have |
comment:2 by , 11 years ago
Owner: | removed |
---|
by , 11 years ago
Attachment: | saveAs.patch added |
---|
comment:3 by , 11 years ago
Keywords: | review patch added |
---|---|
Milestone: | Backlog → Alpha 14 |
Owner: | set to |
Status: | new → assigned |
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 , 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 , 11 years ago
I've made some changes to the patch.
- Removed the "Save As" option.
- Modified the save ui to be similar to the Load interface.
- Added the description to the savegame list; under the existing [date] mapname format.
- Widened both the Load menu and Save menu to account for wider descriptions.
- 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.
comment:6 by , 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 , 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 , 11 years ago
Attachment: | saveAsv3.patch added |
---|
comment:9 by , 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.
patch file