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

COMMON: Add error for unsupported manual save slot #3369

Closed
wants to merge 1 commit into from

Conversation

@antoniou79
Copy link
Contributor

@antoniou79 antoniou79 commented Sep 15, 2021

Addresses ticket https://bugs.scummvm.org/ticket/12766

Currently used by SKY engine.

Allow engines to prevent user from manually saving at selected slots, if they do not support them.

@@ -72,6 +72,9 @@ static String errorToString(ErrorCode errorCode) {
case kUserCanceled:
return _s("User canceled");

Copy link
Member

@lotharsm lotharsm Sep 17, 2021

Minor nitpick - maybe go with "Canceled by user" instead?

Copy link
Contributor Author

@antoniou79 antoniou79 Sep 17, 2021

Minor nitpick - maybe go with "Canceled by user" instead?

I agree, it would be better to phrase it that way. However, this message is not part of the changes of this PR.

Copy link
Member

@lotharsm lotharsm Sep 17, 2021

Uh, right, I totally missed that. Sorry for the noise ;)

@bluegr
Copy link
Member

@bluegr bluegr commented Sep 17, 2021

I believe it would be easier to write protect the autosave slot instead.

We already have support for this, e.g. check agi/metaengine.cpp:303:

	SaveStateDescriptor emptySave;
	// Do not allow save slot 0 (used for auto-saving) to be overwritten.
	if (slotNr == 0) {
		emptySave.setAutosave(true);
		emptySave.setWriteProtectedFlag(true);
	} else {
		emptySave.setWriteProtectedFlag(false);
	}
	return emptySave;

@antoniou79
Copy link
Contributor Author

@antoniou79 antoniou79 commented Sep 17, 2021

I believe it would be easier to write protect the autosave slot instead.

We already have support for this, e.g. check agi/metaengine.cpp:303:

	SaveStateDescriptor emptySave;
	// Do not allow save slot 0 (used for auto-saving) to be overwritten.
	if (slotNr == 0) {
		emptySave.setAutosave(true);
		emptySave.setWriteProtectedFlag(true);
	} else {
		emptySave.setWriteProtectedFlag(false);
	}
	return emptySave;

Currently looking into that and have a tentative implementation ready, but I will test a bit more. Also I've discovered another save game related bug (basically save deletion bug) that I intend to fix.

From what I understand, setting the slot as write protected will disable the option to "Save" in it, rename it or "Delete" it. It does not show any message when attempting to do any of these actions, but the buttons get disabled.

I think it's close enough to what I want so I will close this PR in favor of the setWriteProtectedFlag() approach.

@antoniou79
Copy link
Contributor Author

@antoniou79 antoniou79 commented Sep 17, 2021

Closing as superseded by commit:
1712cce

@antoniou79 antoniou79 closed this Sep 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants