From 3cc57a058a1b696f0bb917f419766622c5cefdb6 Mon Sep 17 00:00:00 2001 From: Jan Borsodi Date: Wed, 15 Sep 2010 12:41:53 +0200 Subject: [PATCH] The label for the name dialog is now fetched from the GMST store. --- apps/openmw/mwgui/window_manager.cpp | 13 ++++++++++++- apps/openmw/mwgui/window_manager.hpp | 9 +++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/window_manager.cpp b/apps/openmw/mwgui/window_manager.cpp index f704c16ade..948f55577b 100644 --- a/apps/openmw/mwgui/window_manager.cpp +++ b/apps/openmw/mwgui/window_manager.cpp @@ -94,7 +94,10 @@ void WindowManager::updateVisible() if (mode == GM_Name) { if (!nameDialog) - nameDialog = new TextInputDialog(environment, "Name", nameChosen, gui->getViewSize()); + { + std::string sName = getGameSettingString("sName", "Name"); + nameDialog = new TextInputDialog(environment, sName, nameChosen, gui->getViewSize()); + } nameDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onNameDialogDone); nameDialog->setVisible(true); return; @@ -152,6 +155,14 @@ void WindowManager::messageBox (const std::string& message, const std::vectorgetStore().gameSettings.search(id); + if (setting && setting->type == ESM::VT_String) + return setting->str; + return default; +} + void WindowManager::updateCharacterGeneration() { if (raceDialog) diff --git a/apps/openmw/mwgui/window_manager.hpp b/apps/openmw/mwgui/window_manager.hpp index 2dcbb848d8..bca7fb8396 100644 --- a/apps/openmw/mwgui/window_manager.hpp +++ b/apps/openmw/mwgui/window_manager.hpp @@ -167,6 +167,15 @@ namespace MWGui void messageBox (const std::string& message, const std::vector& buttons); private: + /** + * Fetches a GMST string from the store, if there is no setting with the given + * ID or it is not a string the default string is returned. + * + * @param id Identifier for the GMST setting, e.g. "aName" + * @param default Default value if the GMST setting cannot be used. + */ + const std::string &getGameSettingString(const std::string &id, const std::string &default); + void updateCharacterGeneration(); void checkCharacterGeneration(GuiMode mode);