diff --git a/apps/openmw/mwgui/window_manager.cpp b/apps/openmw/mwgui/window_manager.cpp index f704c16ad..948f55577 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 2dcbb848d..bca7fb839 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);