ENGINES: Do not assume that MessageDialog accept is 1 and cancel is 0

Use the enum everywhere.

A follow-up commit will change the order.

Also reduce the use of kMessageCancel to minimum.
This commit is contained in:
Orgad Shaneh 2021-08-17 22:26:33 +03:00 committed by Eugene Sandulenko
parent bb9b151c19
commit 6a68d8b7e5
7 changed files with 8 additions and 8 deletions

View File

@ -49,7 +49,7 @@ void DrasculaEngine::checkForOldSaveGames() {
"Press OK to convert them now, otherwise you will be asked again the next time you start the game.\n"), _("OK"), _("Cancel"));
int choice = dialog0.runModal();
if (choice == GUI::kMessageCancel)
if (choice != GUI::kMessageOK)
return;
// Convert every save slot we find in the index file to the new format

View File

@ -348,7 +348,7 @@ Common::Error GrimEngine::run() {
GType_MONKEY4 == getGameType() ? "Escape From Monkey Island" : "Grim Fandango"
);
GUI::MessageDialog msg(confirmString, _("Yes"), _("No"));
if (!msg.runModal()) {
if (msg.runModal() != GUI::kMessageOK) {
return Common::kUserCanceled;
}
}

View File

@ -594,7 +594,7 @@ bool EoBCoreEngine::importOriginalSaveFile(int destSlot, const char *sourceFile)
delete fs;
::GUI::MessageDialog dialog(Common::U32String::format(_("The following original saved game file has been found in your game path:\n\n%s %s\n\nDo you wish to use this saved game file with ScummVM?\n\n"), temp.c_str(), dsc.c_str()), _("Yes"), _("No"));
if (dialog.runModal())
if (dialog.runModal() == ::GUI::kMessageOK)
origFiles.push_back(temp);
}
}
@ -627,7 +627,7 @@ bool EoBCoreEngine::importOriginalSaveFile(int destSlot, const char *sourceFile)
if (destSlot != -1) {
if (Common::find(_gui->_saveSlots.begin(), _gui->_saveSlots.end(), destSlot) != _gui->_saveSlots.end()) {
::GUI::MessageDialog dialog(Common::U32String::format(_("A saved game file was found in the specified slot %d. Overwrite?\n\n"), destSlot), _("Yes"), _("No"));
if (!dialog.runModal())
if (dialog.runModal() != ::GUI::kMessageOK)
return false;
}
}

View File

@ -375,7 +375,7 @@ bool Menu::showConfirmationDialog(const Common::U32String &message, const Common
GUI::MessageDialog dialog(message, confirmButton, cancelButton);
return dialog.runModal() !=0;
return dialog.runModal() == GUI::kMessageOK;
}
void Menu::resetButtons() {

View File

@ -394,7 +394,7 @@ bool ASpit::showConfirmationDialog(const Common::U32String &message, const Commo
GUI::MessageDialog dialog(message, confirmButton, cancelButton);
return dialog.runModal() != 0;
return dialog.runModal() == GUI::kMessageOK;
}
void ASpit::xadisablemenureturn(const ArgumentArray &args) {

View File

@ -270,7 +270,7 @@ static bool askRenameOldSavefiles() {
"The old names are no longer supported, so you will not be able to load your games if you don't convert them.\n\n"
"Press OK to convert them now, otherwise you will be asked next time.\n"), _("OK"), _("Cancel"));
return (dialog0.runModal() != 0);
return (dialog0.runModal() == GUI::kMessageOK);
}
void SaveLoad_ns::renameOldSavefiles() {

View File

@ -889,7 +889,7 @@ void Control::checkForOldSaveGames() {
"Press OK to convert them now, otherwise you will be asked again the next time you start the game.\n"), _("OK"), _("Cancel"));
int choice = dialog0.runModal();
if (choice == GUI::kMessageCancel) {
if (choice != GUI::kMessageOK) {
// user pressed cancel
return;
}