Removed most of "No such node" messages
parent
c3e95d40a2
commit
6333d2d38e
|
@ -364,6 +364,8 @@ bool CApplication::Create()
|
|||
return false;
|
||||
}
|
||||
|
||||
GetProfile().SetLocalProfileString("Resources", "Data", m_dataPath);
|
||||
|
||||
SetLanguage(m_language);
|
||||
|
||||
//Create the sound instance.
|
||||
|
@ -377,6 +379,11 @@ bool CApplication::Create()
|
|||
m_sound->Create(true);
|
||||
|
||||
// Cache sound files
|
||||
if (defaultValues) {
|
||||
GetProfile().SetLocalProfileString("Resources", "Sound", GetDataSubdirPath(DIR_SOUND));
|
||||
GetProfile().SetLocalProfileString("Resources", "Music", GetDataSubdirPath(DIR_MUSIC));
|
||||
}
|
||||
|
||||
if (GetProfile().GetLocalProfileString("Resources", "Sound", path)) {
|
||||
m_sound->CacheAll(path);
|
||||
} else {
|
||||
|
@ -485,7 +492,7 @@ bool CApplication::Create()
|
|||
m_modelManager = new Gfx::CModelManager(m_engine);
|
||||
|
||||
// Create the robot application.
|
||||
m_robotMain = new CRobotMain(this);
|
||||
m_robotMain = new CRobotMain(this, !defaultValues);
|
||||
|
||||
if (defaultValues) m_robotMain->CreateIni();
|
||||
|
||||
|
|
|
@ -39,21 +39,7 @@ CProfile::CProfile() :
|
|||
|
||||
CProfile::~CProfile()
|
||||
{
|
||||
if (m_profileNeedSave)
|
||||
{
|
||||
try
|
||||
{
|
||||
#ifdef NDEBUG
|
||||
bp::ini_parser::write_ini(GetSystemUtils()->profileFileLocation(), m_propertyTree);
|
||||
#else
|
||||
bp::ini_parser::write_ini("colobot.ini", m_propertyTree);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
GetLogger()->Error("Error on storing profile: %s\n", e.what());
|
||||
}
|
||||
}
|
||||
SaveCurrentDirectory();
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,7 +61,26 @@ bool CProfile::InitCurrentDirectory()
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CProfile::SaveCurrentDirectory()
|
||||
{
|
||||
if (m_profileNeedSave)
|
||||
{
|
||||
try
|
||||
{
|
||||
#ifdef NDEBUG
|
||||
bp::ini_parser::write_ini(GetSystemUtils()->profileFileLocation(), m_propertyTree);
|
||||
#else
|
||||
bp::ini_parser::write_ini("colobot.ini", m_propertyTree);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
GetLogger()->Error("Error on storing profile: %s\n", e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CProfile::SetLocalProfileString(std::string section, std::string key, std::string value)
|
||||
{
|
||||
|
|
|
@ -50,6 +50,11 @@ class CProfile : public CSingleton<CProfile>
|
|||
*/
|
||||
bool InitCurrentDirectory();
|
||||
|
||||
/** Saves colobot.ini to current directory
|
||||
* \return return true on success
|
||||
*/
|
||||
bool SaveCurrentDirectory();
|
||||
|
||||
/** Sets string value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
|
|
|
@ -606,7 +606,7 @@ bool rPoint(CBotVar* pThis, CBotVar* var, CBotVar* pResult, int& Exception)
|
|||
|
||||
|
||||
//! Constructor of robot application
|
||||
CRobotMain::CRobotMain(CApplication* app)
|
||||
CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
|
||||
{
|
||||
m_app = app;
|
||||
|
||||
|
@ -709,22 +709,26 @@ CRobotMain::CRobotMain(CApplication* app)
|
|||
float fValue;
|
||||
int iValue;
|
||||
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "FontSize", fValue)) m_fontSize = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "WindowPosX", fValue)) m_windowPos.x = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "WindowPosY", fValue)) m_windowPos.y = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "WindowDimX", fValue)) m_windowDim.x = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "WindowDimY", fValue)) m_windowDim.y = fValue;
|
||||
if (loadProfile) {
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "FontSize", fValue)) m_fontSize = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "WindowPosX", fValue)) m_windowPos.x = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "WindowPosY", fValue)) m_windowPos.y = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "WindowDimX", fValue)) m_windowDim.x = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "WindowDimY", fValue)) m_windowDim.y = fValue;
|
||||
}
|
||||
|
||||
m_IOPublic = false;
|
||||
m_IODim = Math::Point(320.0f/640.0f, (121.0f+18.0f*8)/480.0f);
|
||||
m_IOPos.x = (1.0f-m_IODim.x)/2.0f; // in the middle
|
||||
m_IOPos.y = (1.0f-m_IODim.y)/2.0f;
|
||||
|
||||
if (GetProfile().GetLocalProfileInt ("Edit", "IOPublic", iValue)) m_IOPublic = iValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "IOPosX", fValue)) m_IOPos.x = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "IOPosY", fValue)) m_IOPos.y = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "IODimX", fValue)) m_IODim.x = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "IODimY", fValue)) m_IODim.y = fValue;
|
||||
if (loadProfile) {
|
||||
if (GetProfile().GetLocalProfileInt ("Edit", "IOPublic", iValue)) m_IOPublic = iValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "IOPosX", fValue)) m_IOPos.x = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "IOPosY", fValue)) m_IOPos.y = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "IODimX", fValue)) m_IODim.x = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "IODimY", fValue)) m_IODim.y = fValue;
|
||||
}
|
||||
|
||||
m_short->FlushShortcuts();
|
||||
InitEye();
|
||||
|
@ -741,10 +745,10 @@ CRobotMain::CRobotMain(CApplication* app)
|
|||
g_unit = UNIT;
|
||||
|
||||
m_gamerName = "";
|
||||
GetProfile().GetLocalProfileString("Gamer", "LastName", m_gamerName);
|
||||
if (loadProfile) GetProfile().GetLocalProfileString("Gamer", "LastName", m_gamerName);
|
||||
SetGlobalGamerName(m_gamerName);
|
||||
ReadFreeParam();
|
||||
m_dialog->SetupRecall();
|
||||
if (loadProfile) m_dialog->SetupRecall();
|
||||
|
||||
for (int i = 0; i < MAXSHOWLIMIT; i++)
|
||||
{
|
||||
|
@ -904,10 +908,20 @@ Ui::CDisplayText* CRobotMain::GetDisplayText()
|
|||
//! Creates the file colobot.ini at the first time
|
||||
void CRobotMain::CreateIni()
|
||||
{
|
||||
int iValue;
|
||||
// colobot.ini doesn't exist?
|
||||
if (!GetProfile().GetLocalProfileInt("Setup", "TotoMode", iValue))
|
||||
m_dialog->SetupMemorize();
|
||||
m_dialog->SetupMemorize();
|
||||
|
||||
GetProfile().SetLocalProfileFloat("Edit", "FontSize", m_fontSize);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "WindowPosX", m_windowPos.x);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "WindowPosY", m_windowPos.y);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "WindowDimX", m_windowDim.x);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "WindowDimY", m_windowDim.y);
|
||||
GetProfile().SetLocalProfileInt("Edit", "IOPublic", m_IOPublic);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "IOPosX", m_IOPos.x);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "IOPosY", m_IOPos.y);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "IODimX", m_IODim.x);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "IODimY", m_IODim.y);
|
||||
|
||||
GetProfile().SaveCurrentDirectory();
|
||||
}
|
||||
|
||||
void CRobotMain::SetDefaultInputBindings()
|
||||
|
|
|
@ -191,7 +191,7 @@ const int AXIS_INVALID = -1;
|
|||
class CRobotMain : public CSingleton<CRobotMain>
|
||||
{
|
||||
public:
|
||||
CRobotMain(CApplication* app);
|
||||
CRobotMain(CApplication* app, bool loadProfile);
|
||||
~CRobotMain();
|
||||
|
||||
Gfx::CCamera* GetCamera();
|
||||
|
|
|
@ -5509,6 +5509,7 @@ void CMainDialog::SetupMemorize()
|
|||
GetProfile().SetLocalProfileInt("Setup", "HimselfDamage", m_bHimselfDamage);
|
||||
GetProfile().SetLocalProfileInt("Setup", "CameraScroll", m_bCameraScroll);
|
||||
GetProfile().SetLocalProfileInt("Setup", "CameraInvertX", m_bCameraInvertX);
|
||||
GetProfile().SetLocalProfileInt("Setup", "CameraInvertY", m_bCameraInvertY);
|
||||
GetProfile().SetLocalProfileInt("Setup", "InterfaceEffect", m_bEffect);
|
||||
GetProfile().SetLocalProfileInt("Setup", "GroundShadow", m_engine->GetShadow());
|
||||
GetProfile().SetLocalProfileInt("Setup", "GroundSpot", m_engine->GetGroundSpot());
|
||||
|
@ -5544,6 +5545,8 @@ void CMainDialog::SetupMemorize()
|
|||
if ( pl != 0 ) {
|
||||
GetProfile().SetLocalProfileInt("Setup", "Resolution", pl->GetSelect());
|
||||
}
|
||||
} else {
|
||||
// TODO: Default value
|
||||
}
|
||||
|
||||
std::stringstream key;
|
||||
|
|
Loading…
Reference in New Issue