NANCY: Remove unnecessary ConfMan instance calls

Removed occurences of the ConfMan macro being used
to get the transient domain name. This makes sure we don't
generate unnecessary calls to ConfigManager::getInstance().
This commit is contained in:
Kaloyan Chehlarski 2024-01-11 23:02:38 +01:00
parent 0ddf8d0549
commit 9ee549edd2
6 changed files with 24 additions and 24 deletions

View File

@ -674,7 +674,7 @@ void ActionManager::debugDrawHotspots() {
// and type of the owning ActionRecord. Hardcoded to font 0 since that's
// the smallest one available in the engine.
RenderObject &obj = NancySceneState._hotspotDebug;
if (ConfMan.getBool("debug_hotspots", ConfMan.kTransientDomain)) {
if (ConfMan.getBool("debug_hotspots", Common::ConfigManager::kTransientDomain)) {
const Font *font = g_nancy->_graphicsManager->getFont(0);
assert(font);
uint16 yOffset = NancySceneState.getViewport().getCurVerticalScroll();

View File

@ -1034,7 +1034,7 @@ bool NancyConsole::Cmd_soundInfo(int argc, const char **argv) {
}
bool NancyConsole::Cmd_showHotspots(int argc, const char **argv) {
ConfMan.setBool("debug_hotspots", !ConfMan.getBool("debug_hotspots", ConfMan.kTransientDomain), ConfMan.kTransientDomain);
ConfMan.setBool("debug_hotspots", !ConfMan.getBool("debug_hotspots", Common::ConfigManager::kTransientDomain), Common::ConfigManager::kTransientDomain);
return cmdExit(0, nullptr);
}

View File

@ -465,9 +465,9 @@ void LoadSaveMenu::save() {
// First, check if we are actually overwriting
SaveStateDescriptor desc = g_nancy->getMetaEngine()->querySaveMetaInfos(ConfMan.getActiveDomainName().c_str(), _selectedSave + 1);
if (desc.isValid()) {
if (!ConfMan.hasKey("sdlg_return", ConfMan.kTransientDomain)) {
if (!ConfMan.hasKey("sdlg_return", Common::ConfigManager::kTransientDomain)) {
// Request the dialog
ConfMan.setInt("sdlg_id", 1, ConfMan.kTransientDomain);
ConfMan.setInt("sdlg_id", 1, Common::ConfigManager::kTransientDomain);
_destroyOnExit = false;
g_nancy->setState(NancyState::kSaveDialog);
return;
@ -475,8 +475,8 @@ void LoadSaveMenu::save() {
// Dialog has returned
g_nancy->_graphicsManager->suppressNextDraw();
_destroyOnExit = true;
uint ret = ConfMan.getInt("sdlg_return", ConfMan.kTransientDomain);
ConfMan.removeKey("sdlg_return", ConfMan.kTransientDomain);
uint ret = ConfMan.getInt("sdlg_return", Common::ConfigManager::kTransientDomain);
ConfMan.removeKey("sdlg_return", Common::ConfigManager::kTransientDomain);
switch (ret) {
case 1 :
// "No" keeps us in the LoadSave state but doesn't save
@ -557,9 +557,9 @@ void LoadSaveMenu::load() {
if (sdlg && sdlg->dialogs.size() > 1 && Nancy::State::Scene::hasInstance() && !g_nancy->_hasJustSaved) {
// nancy6 added a "Do you want load without saving" dialog.
if (!ConfMan.hasKey("sdlg_return", ConfMan.kTransientDomain)) {
if (!ConfMan.hasKey("sdlg_return", Common::ConfigManager::kTransientDomain)) {
// Request the dialog
ConfMan.setInt("sdlg_id", 2, ConfMan.kTransientDomain);
ConfMan.setInt("sdlg_id", 2, Common::ConfigManager::kTransientDomain);
_destroyOnExit = false;
g_nancy->setState(NancyState::kSaveDialog);
return;
@ -567,8 +567,8 @@ void LoadSaveMenu::load() {
// Dialog has returned
_destroyOnExit = true;
g_nancy->_graphicsManager->suppressNextDraw();
uint ret = ConfMan.getInt("sdlg_return", ConfMan.kTransientDomain);
ConfMan.removeKey("sdlg_return", ConfMan.kTransientDomain);
uint ret = ConfMan.getInt("sdlg_return", Common::ConfigManager::kTransientDomain);
ConfMan.removeKey("sdlg_return", Common::ConfigManager::kTransientDomain);
switch (ret) {
case 1 :
// "No" keeps us in the LoadSave state but doesn't load

View File

@ -118,7 +118,7 @@ void MainMenu::init() {
// Always destroy current state to make sure music starts again
NancySceneState.destroy();
if (ConfMan.hasKey("restore_after_ad", ConfMan.kTransientDomain)) {
if (ConfMan.hasKey("restore_after_ad", Common::ConfigManager::kTransientDomain)) {
// Returning to running game, restore second chance
ConfMan.setInt("save_slot", g_nancy->getMetaEngine()->getMaximumSaveSlot(), Common::ConfigManager::kTransientDomain);
} else {
@ -204,17 +204,17 @@ void MainMenu::stop() {
case 6:
// Exit Game
if (g_nancy->getEngineData("SDLG") && Nancy::State::Scene::hasInstance() && !g_nancy->_hasJustSaved) {
if (!ConfMan.hasKey("sdlg_return", ConfMan.kTransientDomain)) {
if (!ConfMan.hasKey("sdlg_return", Common::ConfigManager::kTransientDomain)) {
// Request the "Do you want to save before quitting" dialog
ConfMan.setInt("sdlg_id", 0, ConfMan.kTransientDomain);
ConfMan.setInt("sdlg_id", 0, Common::ConfigManager::kTransientDomain);
_destroyOnExit = false;
g_nancy->setState(NancyState::kSaveDialog);
} else {
// Dialog has returned
_destroyOnExit = true;
g_nancy->_graphicsManager->suppressNextDraw();
uint ret = ConfMan.getInt("sdlg_return", ConfMan.kTransientDomain);
ConfMan.removeKey("sdlg_return", ConfMan.kTransientDomain);
uint ret = ConfMan.getInt("sdlg_return", Common::ConfigManager::kTransientDomain);
ConfMan.removeKey("sdlg_return", Common::ConfigManager::kTransientDomain);
switch (ret) {
case 0 :
// "Yes" switches to LoadSave
@ -261,15 +261,15 @@ void MainMenu::stop() {
if (Scene::hasInstance()) {
// The second chance slot is used as temporary save. We make sure not to
// overwrite it when selecting the ad button multiple times in a row.
if (!ConfMan.hasKey("restore_after_ad", ConfMan.kTransientDomain)) {
if (!ConfMan.hasKey("restore_after_ad", Common::ConfigManager::kTransientDomain)) {
g_nancy->secondChance();
}
ConfMan.setBool("restore_after_ad", true, ConfMan.kTransientDomain);
ConfMan.setBool("restore_after_ad", true, Common::ConfigManager::kTransientDomain);
NancySceneState.destroy();
}
ConfMan.setBool("load_ad", true, ConfMan.kTransientDomain);
ConfMan.setBool("load_ad", true, Common::ConfigManager::kTransientDomain);
g_nancy->setState(NancyState::kScene);
break;
}

View File

@ -92,8 +92,8 @@ void SaveDialog::init() {
auto *sdlg = GetEngineData(SDLG);
assert(sdlg);
_dialogData = &sdlg->dialogs[ConfMan.getInt("sdlg_id", ConfMan.kTransientDomain)];
ConfMan.removeKey("sdlg_id", ConfMan.kTransientDomain);
_dialogData = &sdlg->dialogs[ConfMan.getInt("sdlg_id", Common::ConfigManager::kTransientDomain)];
ConfMan.removeKey("sdlg_id", Common::ConfigManager::kTransientDomain);
_background.init(_dialogData->imageName);
@ -132,7 +132,7 @@ void SaveDialog::run() {
}
void SaveDialog::stop() {
ConfMan.setInt("sdlg_return", _selected, ConfMan.kTransientDomain);
ConfMan.setInt("sdlg_return", _selected, Common::ConfigManager::kTransientDomain);
g_nancy->setToPreviousState();
}

View File

@ -730,7 +730,7 @@ void Scene::synchronize(Common::Serializer &ser) {
}
_isRunningAd = false;
ConfMan.removeKey("restore_after_ad", ConfMan.kTransientDomain);
ConfMan.removeKey("restore_after_ad", Common::ConfigManager::kTransientDomain);
g_nancy->_graphicsManager->suppressNextDraw();
}
@ -759,9 +759,9 @@ void Scene::init() {
_timers.playerTimeNextMinute = 0;
_timers.pushedPlayTime = 0;
if (ConfMan.hasKey("load_ad", ConfMan.kTransientDomain)) {
if (ConfMan.hasKey("load_ad", Common::ConfigManager::kTransientDomain)) {
changeScene(bootSummary->adScene);
ConfMan.removeKey("load_ad", ConfMan.kTransientDomain);
ConfMan.removeKey("load_ad", Common::ConfigManager::kTransientDomain);
_isRunningAd = true;
} else {
changeScene(bootSummary->firstScene);