|
|
@ -90,7 +90,6 @@ Main::Main()
|
|
|
|
mLocalPlayer = new LocalPlayer();
|
|
|
|
mLocalPlayer = new LocalPlayer();
|
|
|
|
mGUIController = new GUIController();
|
|
|
|
mGUIController = new GUIController();
|
|
|
|
mCellController = new CellController();
|
|
|
|
mCellController = new CellController();
|
|
|
|
//mLocalPlayer->CharGen(0, 4);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
server = "mp.tes3mp.com";
|
|
|
|
server = "mp.tes3mp.com";
|
|
|
|
port = 25565;
|
|
|
|
port = 25565;
|
|
|
@ -127,22 +126,22 @@ static Settings::CategorySettingValueMap saveUserSettings;
|
|
|
|
static Settings::CategorySettingValueMap saveDefaultSettings;
|
|
|
|
static Settings::CategorySettingValueMap saveDefaultSettings;
|
|
|
|
static Settings::CategorySettingVector saveChangedSettings;
|
|
|
|
static Settings::CategorySettingVector saveChangedSettings;
|
|
|
|
|
|
|
|
|
|
|
|
void InitMgr(Settings::Manager &mgr)
|
|
|
|
void initializeManager(Settings::Manager &manager)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
saveUserSettings = mgr.mUserSettings;
|
|
|
|
saveUserSettings = manager.mUserSettings;
|
|
|
|
saveDefaultSettings = mgr.mDefaultSettings;
|
|
|
|
saveDefaultSettings = manager.mDefaultSettings;
|
|
|
|
saveChangedSettings = mgr.mChangedSettings;
|
|
|
|
saveChangedSettings = manager.mChangedSettings;
|
|
|
|
mgr.mUserSettings.clear();
|
|
|
|
manager.mUserSettings.clear();
|
|
|
|
mgr.mDefaultSettings.clear();
|
|
|
|
manager.mDefaultSettings.clear();
|
|
|
|
mgr.mChangedSettings.clear();
|
|
|
|
manager.mChangedSettings.clear();
|
|
|
|
loadSettings(mgr);
|
|
|
|
loadSettings(manager);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RestoreMgr(Settings::Manager &mgr)
|
|
|
|
void restoreManager(Settings::Manager &manager)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mgr.mUserSettings = saveUserSettings;
|
|
|
|
manager.mUserSettings = saveUserSettings;
|
|
|
|
mgr.mDefaultSettings = saveDefaultSettings;
|
|
|
|
manager.mDefaultSettings = saveDefaultSettings;
|
|
|
|
mgr.mChangedSettings = saveChangedSettings;
|
|
|
|
manager.mChangedSettings = saveChangedSettings;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Main::init(std::vector<std::string> &content, Files::Collections &collections)
|
|
|
|
bool Main::init(std::vector<std::string> &content, Files::Collections &collections)
|
|
|
@ -150,17 +149,17 @@ bool Main::init(std::vector<std::string> &content, Files::Collections &collectio
|
|
|
|
assert(!pMain);
|
|
|
|
assert(!pMain);
|
|
|
|
pMain = new Main();
|
|
|
|
pMain = new Main();
|
|
|
|
|
|
|
|
|
|
|
|
Settings::Manager mgr;
|
|
|
|
Settings::Manager manager;
|
|
|
|
InitMgr(mgr);
|
|
|
|
initializeManager(manager);
|
|
|
|
|
|
|
|
|
|
|
|
int logLevel = mgr.getInt("logLevel", "General");
|
|
|
|
int logLevel = manager.getInt("logLevel", "General");
|
|
|
|
Log::SetLevel(logLevel);
|
|
|
|
Log::SetLevel(logLevel);
|
|
|
|
if (address.empty())
|
|
|
|
if (address.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pMain->server = mgr.getString("destinationAddress", "General");
|
|
|
|
pMain->server = manager.getString("destinationAddress", "General");
|
|
|
|
pMain->port = (unsigned short) mgr.getInt("port", "General");
|
|
|
|
pMain->port = (unsigned short) manager.getInt("port", "General");
|
|
|
|
|
|
|
|
|
|
|
|
serverPassword = mgr.getString("password", "General");
|
|
|
|
serverPassword = manager.getString("password", "General");
|
|
|
|
if (serverPassword.empty())
|
|
|
|
if (serverPassword.empty())
|
|
|
|
serverPassword = TES3MP_DEFAULT_PASSW;
|
|
|
|
serverPassword = TES3MP_DEFAULT_PASSW;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -173,17 +172,17 @@ bool Main::init(std::vector<std::string> &content, Files::Collections &collectio
|
|
|
|
get().mLocalPlayer->serverPassword = serverPassword;
|
|
|
|
get().mLocalPlayer->serverPassword = serverPassword;
|
|
|
|
|
|
|
|
|
|
|
|
pMain->mNetworking->connect(pMain->server, pMain->port, content, collections);
|
|
|
|
pMain->mNetworking->connect(pMain->server, pMain->port, content, collections);
|
|
|
|
RestoreMgr(mgr);
|
|
|
|
restoreManager(manager);
|
|
|
|
return pMain->mNetworking->isConnected();
|
|
|
|
return pMain->mNetworking->isConnected();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Main::postInit()
|
|
|
|
void Main::postInit()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Settings::Manager mgr;
|
|
|
|
Settings::Manager manager;
|
|
|
|
InitMgr(mgr);
|
|
|
|
initializeManager(manager);
|
|
|
|
|
|
|
|
|
|
|
|
pMain->mGUIController->setupChat(mgr);
|
|
|
|
pMain->mGUIController->setupChat(manager);
|
|
|
|
RestoreMgr(mgr);
|
|
|
|
restoreManager(manager);
|
|
|
|
|
|
|
|
|
|
|
|
const MWBase::Environment &environment = MWBase::Environment::get();
|
|
|
|
const MWBase::Environment &environment = MWBase::Environment::get();
|
|
|
|
environment.getStateManager()->newGame(true);
|
|
|
|
environment.getStateManager()->newGame(true);
|
|
|
|