GUI: Rename SaveLoadChooser::runModal to runModalWithPluginAndTarget

This avoids hiding an overloaded virtual method, which in turn can
cause weird bugs (see also the next commit).

svn-id: r55815
This commit is contained in:
Max Horn 2011-02-07 22:58:22 +00:00
parent 85aabef6fe
commit 41121be4d6
12 changed files with 18 additions and 18 deletions

View file

@ -218,7 +218,7 @@ static void handleSaveLoad(bool saveFlag) {
dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"));
dialog->setSaveMode(saveFlag);
int slot = dialog->runModal(plugin, ConfMan.getActiveDomainName());
int slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
if (slot >= 0) {
if (!saveFlag)

View file

@ -224,7 +224,7 @@ void MainMenuDialog::save() {
const EnginePlugin *plugin = 0;
EngineMan.findGame(gameId, &plugin);
int slot = _saveDialog->runModal(plugin, ConfMan.getActiveDomainName());
int slot = _saveDialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
if (slot >= 0) {
Common::String result(_saveDialog->getResultString());
@ -247,7 +247,7 @@ void MainMenuDialog::load() {
const EnginePlugin *plugin = 0;
EngineMan.findGame(gameId, &plugin);
int slot = _loadDialog->runModal(plugin, ConfMan.getActiveDomainName());
int slot = _loadDialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
if (slot >= 0) {
// FIXME: For now we just ignore the return

View file

@ -308,7 +308,7 @@ bool FileManager::saveGame(const int16 slot, const Common::String descrip) {
if (slot == -1) {
GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save");
dialog->setSaveMode(true);
savegameId = dialog->runModal(plugin, ConfMan.getActiveDomainName());
savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
savegameDescription = dialog->getResultString();
delete dialog;
} else {
@ -422,7 +422,7 @@ bool FileManager::restoreGame(const int16 slot) {
if (slot == -1) {
GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore");
dialog->setSaveMode(false);
savegameId = dialog->runModal(plugin, ConfMan.getActiveDomainName());
savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
delete dialog;
} else {
savegameId = slot;

View file

@ -1114,11 +1114,11 @@ void HugoEngine::endGame() {
_status.viewState = kViewExit;
}
bool HugoEngine::canLoadGameStateCurrently() const {
bool HugoEngine::canLoadGameStateCurrently() {
return true;
}
bool HugoEngine::canSaveGameStateCurrently() const {
bool HugoEngine::canSaveGameStateCurrently() {
return (_status.viewState == kViewPlay);
}

View file

@ -307,8 +307,8 @@ public:
return *s_Engine;
}
bool canLoadGameStateCurrently() const;
bool canSaveGameStateCurrently() const;
virtual bool canLoadGameStateCurrently();
virtual bool canSaveGameStateCurrently();
bool loadHugoDat();
char *useBG(const char *name);

View file

@ -684,7 +684,7 @@ void MohawkEngine_Riven::runLoadDialog() {
const EnginePlugin *plugin = 0;
EngineMan.findGame(gameId, &plugin);
int slot = slc.runModal(plugin, ConfMan.getActiveDomainName());
int slot = slc.runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
if (slot >= 0)
loadGameState(slot);

View file

@ -192,7 +192,7 @@ int SaveLoad::selectSaveFile(Common::String &selectedName, bool saveMode, const
const EnginePlugin *plugin = 0;
EngineMan.findGame(gameId, &plugin);
int idx = slc.runModal(plugin, ConfMan.getActiveDomainName());
int idx = slc.runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
if (idx >= 0) {
selectedName = slc.getResultString();
slc.close();

View file

@ -575,7 +575,7 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
EngineMan.findGame(g_sci->getGameIdStr(), &plugin);
GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"));
dialog->setSaveMode(true);
savegameId = dialog->runModal(plugin, ConfMan.getActiveDomainName());
savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
game_description = dialog->getResultString();
if (game_description.empty()) {
// create our own description for the saved game, the user didnt enter it
@ -675,7 +675,7 @@ reg_t kRestoreGame(EngineState *s, int argc, reg_t *argv) {
EngineMan.findGame(g_sci->getGameIdStr(), &plugin);
GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"));
dialog->setSaveMode(false);
savegameId = dialog->runModal(plugin, ConfMan.getActiveDomainName());
savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
delete dialog;
if (savegameId < 0) {
g_sci->_soundCmd->pauseAll(false); // unpause music

View file

@ -2976,7 +2976,7 @@ bool ToonEngine::saveGame(int32 slot, Common::String saveGameDesc) {
if (slot == -1) {
GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save");
dialog->setSaveMode(true);
savegameId = dialog->runModal(plugin, ConfMan.getActiveDomainName());
savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
savegameDescription = dialog->getResultString();
delete dialog;
} else {
@ -3074,7 +3074,7 @@ bool ToonEngine::loadGame(int32 slot) {
if (slot == -1) {
GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore");
dialog->setSaveMode(false);
savegameId = dialog->runModal(plugin, ConfMan.getActiveDomainName());
savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
delete dialog;
} else {
savegameId = slot;

View file

@ -934,7 +934,7 @@ void LauncherDialog::loadGame(int item) {
if (plugin) {
if ((*plugin)->hasFeature(MetaEngine::kSupportsListSaves) &&
(*plugin)->hasFeature(MetaEngine::kSupportsLoadingDuringStartup)) {
int slot = _loadDialog->runModal(plugin, target);
int slot = _loadDialog->runModalWithPluginAndTarget(plugin, target);
if (slot >= 0) {
ConfMan.setActiveDomain(_domains[item]);
ConfMan.setInt("save_slot", slot, Common::ConfigManager::kTransientDomain);

View file

@ -79,7 +79,7 @@ SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel)
SaveLoadChooser::~SaveLoadChooser() {
}
int SaveLoadChooser::runModal(const EnginePlugin *plugin, const String &target) {
int SaveLoadChooser::runModalWithPluginAndTarget(const EnginePlugin *plugin, const String &target) {
if (_gfxWidget)
_gfxWidget->setGfx(0);

View file

@ -66,7 +66,7 @@ public:
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
void setList(const StringArray& list);
int runModal(const EnginePlugin *plugin, const String &target);
int runModalWithPluginAndTarget(const EnginePlugin *plugin, const String &target);
void open();
const Common::String &getResultString() const;