mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
[Client] Load up TES3MP's settings in the same map as OpenMW's settings
This allows the "font size" property to be read when the chat window is created.
This commit is contained in:
parent
9b1fbcc6f9
commit
6dccdfe0c1
3 changed files with 12 additions and 38 deletions
|
@ -64,18 +64,18 @@ void mwmp::GUIController::refreshGuiMode(MWGui::GuiMode guiMode)
|
|||
}
|
||||
}
|
||||
|
||||
void mwmp::GUIController::setupChat(const Settings::Manager &mgr)
|
||||
void mwmp::GUIController::setupChat()
|
||||
{
|
||||
assert(mChat == nullptr);
|
||||
|
||||
float chatDelay = mgr.getFloat("delay", "Chat");
|
||||
int chatY = mgr.getInt("y", "Chat");
|
||||
int chatX = mgr.getInt("x", "Chat");
|
||||
int chatW = mgr.getInt("w", "Chat");
|
||||
int chatH = mgr.getInt("h", "Chat");
|
||||
float chatDelay = Settings::Manager::getFloat("delay", "Chat");
|
||||
int chatY = Settings::Manager::getInt("y", "Chat");
|
||||
int chatX = Settings::Manager::getInt("x", "Chat");
|
||||
int chatW = Settings::Manager::getInt("w", "Chat");
|
||||
int chatH = Settings::Manager::getInt("h", "Chat");
|
||||
|
||||
keySay = SDL_GetScancodeFromName(mgr.getString("keySay", "Chat").c_str());
|
||||
keyChatMode = SDL_GetScancodeFromName(mgr.getString("keyChatMode", "Chat").c_str());
|
||||
keySay = SDL_GetScancodeFromName(Settings::Manager::getString("keySay", "Chat").c_str());
|
||||
keyChatMode = SDL_GetScancodeFromName(Settings::Manager::getString("keyChatMode", "Chat").c_str());
|
||||
|
||||
mChat = new GUIChat(chatX, chatY, chatW, chatH);
|
||||
mChat->setDelay(chatDelay);
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace mwmp
|
|||
|
||||
void refreshGuiMode(MWGui::GuiMode guiMode);
|
||||
|
||||
void setupChat(const Settings::Manager &manager);
|
||||
void setupChat();
|
||||
|
||||
void printChatMessage(std::string &msg);
|
||||
void setChatVisible(bool chatVisible);
|
||||
|
|
|
@ -118,35 +118,13 @@ void Main::configure(const boost::program_options::variables_map &variables)
|
|||
resourceDir = variables["resources"].as<Files::EscapeHashString>().toStdString();
|
||||
}
|
||||
|
||||
static Settings::CategorySettingValueMap saveUserSettings;
|
||||
static Settings::CategorySettingValueMap saveDefaultSettings;
|
||||
static Settings::CategorySettingVector saveChangedSettings;
|
||||
|
||||
void initializeManager(Settings::Manager &manager)
|
||||
{
|
||||
saveUserSettings = manager.mUserSettings;
|
||||
saveDefaultSettings = manager.mDefaultSettings;
|
||||
saveChangedSettings = manager.mChangedSettings;
|
||||
manager.mUserSettings.clear();
|
||||
manager.mDefaultSettings.clear();
|
||||
manager.mChangedSettings.clear();
|
||||
loadSettings(manager);
|
||||
}
|
||||
|
||||
void restoreManager(Settings::Manager &manager)
|
||||
{
|
||||
manager.mUserSettings = saveUserSettings;
|
||||
manager.mDefaultSettings = saveDefaultSettings;
|
||||
manager.mChangedSettings = saveChangedSettings;
|
||||
}
|
||||
|
||||
bool Main::init(std::vector<std::string> &content, Files::Collections &collections)
|
||||
{
|
||||
assert(!pMain);
|
||||
pMain = new Main();
|
||||
|
||||
Settings::Manager manager;
|
||||
initializeManager(manager);
|
||||
loadSettings(manager);
|
||||
|
||||
int logLevel = manager.getInt("logLevel", "General");
|
||||
TimedLog::SetLevel(logLevel);
|
||||
|
@ -168,17 +146,13 @@ bool Main::init(std::vector<std::string> &content, Files::Collections &collectio
|
|||
get().mLocalPlayer->serverPassword = serverPassword;
|
||||
|
||||
pMain->mNetworking->connect(pMain->server, pMain->port, content, collections);
|
||||
restoreManager(manager);
|
||||
|
||||
return pMain->mNetworking->isConnected();
|
||||
}
|
||||
|
||||
void Main::postInit()
|
||||
{
|
||||
Settings::Manager manager;
|
||||
initializeManager(manager);
|
||||
|
||||
pMain->mGUIController->setupChat(manager);
|
||||
restoreManager(manager);
|
||||
pMain->mGUIController->setupChat();
|
||||
|
||||
const MWBase::Environment &environment = MWBase::Environment::get();
|
||||
environment.getStateManager()->newGame(true);
|
||||
|
|
Loading…
Reference in a new issue