From: <geo...@us...> - 2011-02-20 23:54:20
|
Revision: 3983 http://freeorion.svn.sourceforge.net/freeorion/revision/?rev=3983&view=rev Author: geoffthemedio Date: 2011-02-20 23:54:13 +0000 (Sun, 20 Feb 2011) Log Message: ----------- Based on suggestion and patch by Guillaume Rousse, modified expected location of ogre_plugins.cfg and OISInput.cfg to be in the root data directory, rather than the binary directory. These are the same on Windows, but apparently should not be the same on Linux. This might break something on OSX or some Linux builds, until they're updated. Doing this involved added a parameter to HumanClientApp to take the path to the OISInput.cfg file. This path is passed in when creating the HumanClientApp object in chmain.cpp, making the determination of this file's location similar to ogre_plugins.cfg which is passed to Ogre::Root in the same calling function. Modified Paths: -------------- trunk/FreeOrion/client/human/HumanClientApp.cpp trunk/FreeOrion/client/human/HumanClientApp.h trunk/FreeOrion/client/human/chmain.cpp Modified: trunk/FreeOrion/client/human/HumanClientApp.cpp =================================================================== --- trunk/FreeOrion/client/human/HumanClientApp.cpp 2011-02-20 23:47:36 UTC (rev 3982) +++ trunk/FreeOrion/client/human/HumanClientApp.cpp 2011-02-20 23:54:13 UTC (rev 3983) @@ -158,9 +158,10 @@ Ogre::RenderWindow* window, Ogre::SceneManager* scene_manager, Ogre::Camera* camera, - Ogre::Viewport* viewport) : + Ogre::Viewport* viewport, + const std::string& ois_input_cfg_file_name) : ClientApp(), - OgreGUI(window, (GetBinDir() / "OISInput.cfg").string()), + OgreGUI(window, ois_input_cfg_file_name), m_fsm(0), m_single_player_game(true), m_game_started(false), @@ -213,7 +214,7 @@ GG::Connect(GetOptionsDB().OptionChangedSignal("show-fps"), &HumanClientApp::UpdateFPSLimit, this); boost::shared_ptr<GG::BrowseInfoWnd> default_browse_info_wnd( - new GG::TextBoxBrowseInfoWnd(GG::X(400), GG::GUI::GetGUI()->GetFont(ClientUI::Font(), ClientUI::Pts()), + new GG::TextBoxBrowseInfoWnd(GG::X(400), ClientUI::GetFont(), GG::Clr(0, 0, 0, 200), ClientUI::WndOuterBorderColor(), ClientUI::TextColor(), GG::FORMAT_LEFT | GG::FORMAT_WORDBREAK, 1)); GG::Wnd::SetDefaultBrowseInfoWnd(default_browse_info_wnd); Modified: trunk/FreeOrion/client/human/HumanClientApp.h =================================================================== --- trunk/FreeOrion/client/human/HumanClientApp.h 2011-02-20 23:47:36 UTC (rev 3982) +++ trunk/FreeOrion/client/human/HumanClientApp.h 2011-02-20 23:54:13 UTC (rev 3983) @@ -37,7 +37,8 @@ Ogre::RenderWindow* window, Ogre::SceneManager* scene_manager, Ogre::Camera* camera, - Ogre::Viewport* viewport); + Ogre::Viewport* viewport, + const std::string& ois_input_cfg_file_name); virtual ~HumanClientApp(); //@} Modified: trunk/FreeOrion/client/human/chmain.cpp =================================================================== --- trunk/FreeOrion/client/human/chmain.cpp 2011-02-20 23:47:36 UTC (rev 3982) +++ trunk/FreeOrion/client/human/chmain.cpp 2011-02-20 23:54:13 UTC (rev 3983) @@ -98,8 +98,8 @@ // read config.xml and set options entries from it, if present - XMLDoc doc; { + XMLDoc doc; try { boost::filesystem::ifstream ifs(GetConfigPath()); if (ifs) { @@ -116,15 +116,14 @@ GetOptionsDB().SetFromCommandLine(argc, argv); -#ifdef FREEORION_MACOSX // Handle the case where the resource-dir does not exist anymore // gracefully by resetting it to the standard path into the // application bundle. This may happen if a previous installed // version of FreeOrion was residing in a different directory. - if (!boost::filesystem::exists(boost::filesystem::path(GetOptionsDB().Get<std::string>("resource-dir")))) - GetOptionsDB().Set<std::string>("resource-dir", (GetRootDataDir() / "default").directory_string()); -#endif + if (!boost::filesystem::exists(GetResourceDir())) + GetOptionsDB().Set<std::string>("resource-dir", ""); + // did the player request generation of config.xml, saving the default (or current) options to disk? if (GetOptionsDB().Get<bool>("generate-config-xml")) { try { @@ -180,7 +179,7 @@ log_manager = new LogManager(); log_manager->createLog((GetUserDir() / "ogre.log").string(), true, false); - root = new Root((GetBinDir() / "ogre_plugins.cfg").string()); + root = new Root((GetRootDataDir() / "ogre_plugins.cfg").string()); #if defined(OGRE_STATIC_LIB) octree_plugin = new Ogre::OctreePlugin; @@ -236,7 +235,7 @@ //EntityRenderer entity_renderer(scene_manager); - HumanClientApp app(root, window, scene_manager, camera, viewport); + HumanClientApp app(root, window, scene_manager, camera, viewport, (GetRootDataDir() / "OISInput.cfg").string()); #ifdef FREEORION_MACOSX ois_input_plugin = new OISInput; |