Revision: 1704
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=1704&view=rev
Author:   rorthomas
Date:     2011-02-27 18:09:23 +0000 (Sun, 27 Feb 2011)

Log Message:
-----------
fixed error upon .odef loading

Modified Paths:
--------------
    trunk/source/main/framework/ContentManager.cpp
    trunk/source/main/framework/ContentManager.h
    trunk/source/main/gameplay/RoRFrameListener.cpp

Modified: trunk/source/main/framework/ContentManager.cpp
===================================================================
--- trunk/source/main/framework/ContentManager.cpp      2011-02-27 17:10:56 UTC 
(rev 1703)
+++ trunk/source/main/framework/ContentManager.cpp      2011-02-27 18:09:23 UTC 
(rev 1704)
@@ -30,6 +30,7 @@
 
 #include "CacheSystem.h"
 
+#include "utils.h"
 
 using namespace Ogre;
 using namespace std;
@@ -51,15 +52,24 @@
        dirsep="\\";
 #endif
 
-       
ResourceGroupManager::getSingleton().addResourceLocation(SETTINGS.getSetting("Resources
 Path")+dirsep+name, "FileSystem", group, true);
-       try
+       String zipFilename = SETTINGS.getSetting("Resources Path")+name+".zip";
+       if(fileExists(zipFilename))
        {
-               
ResourceGroupManager::getSingleton().addResourceLocation(SETTINGS.getSetting("Resources
 Path")+name+".zip", "Zip", group, true);
-       } catch(...) {}
+               
ResourceGroupManager::getSingleton().addResourceLocation(zipFilename, "Zip", 
group, true);
+       } else
+       {
+               String dirname = SETTINGS.getSetting("Resources 
Path")+dirsep+name;
+               
ResourceGroupManager::getSingleton().addResourceLocation(dirname, "FileSystem", 
group, true);
+       }
 }
 
 bool ContentManager::init(void)
 {
+
+    //Set listener if none has already been set
+    if (!Ogre::ResourceGroupManager::getSingleton().getLoadingListener())
+        Ogre::ResourceGroupManager::getSingleton().setLoadingListener(this);
+
        //try to get correct paths
        //note: we don't have LogManager available yet!
        //FIRST: Get the "program path" and the user space path
@@ -212,3 +222,16 @@
        return true;
 }
 
+Ogre::DataStreamPtr ContentManager::resourceLoading(const Ogre::String &name, 
const Ogre::String &group, Ogre::Resource *resource)
+{
+       return Ogre::DataStreamPtr();
+}
+
+void ContentManager::resourceStreamOpened(const Ogre::String &name, const 
Ogre::String &group, Ogre::Resource *resource, Ogre::DataStreamPtr& dataStream)
+{
+}
+
+bool ContentManager::resourceCollision(Ogre::Resource *resource, 
Ogre::ResourceManager *resourceManager)
+{
+       return false;
+}

Modified: trunk/source/main/framework/ContentManager.h
===================================================================
--- trunk/source/main/framework/ContentManager.h        2011-02-27 17:10:56 UTC 
(rev 1703)
+++ trunk/source/main/framework/ContentManager.h        2011-02-27 18:09:23 UTC 
(rev 1704)
@@ -26,7 +26,7 @@
 #include <OgreResourceGroupManager.h>
 //#include "RoR
 
-class ContentManager : public Ogre::Singleton<ContentManager>
+class ContentManager : public Ogre::Singleton<ContentManager>, public 
Ogre::ResourceLoadingListener
 {
 public:
        ContentManager();
@@ -34,11 +34,17 @@
 
        bool init(void);
 
-private:
+protected:
        ContentManager(const ContentManager&);
        ContentManager& operator= (const ContentManager&);
 
        void loadMainResource(Ogre::String name, Ogre::String 
group=Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+
+
+       // implementation for resource loading listener
+       Ogre::DataStreamPtr resourceLoading(const Ogre::String &name, const 
Ogre::String &group, Ogre::Resource *resource);
+       void resourceStreamOpened(const Ogre::String &name, const Ogre::String 
&group, Ogre::Resource *resource, Ogre::DataStreamPtr& dataStream);
+       bool resourceCollision(Ogre::Resource *resource, Ogre::ResourceManager 
*resourceManager);
 };
 
 #endif // CONTENTMANAGER_H__

Modified: trunk/source/main/gameplay/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.cpp     2011-02-27 17:10:56 UTC 
(rev 1703)
+++ trunk/source/main/gameplay/RoRFrameListener.cpp     2011-02-27 18:09:23 UTC 
(rev 1704)
@@ -1582,14 +1582,14 @@
        // try to load with UID first!
        String odefgroup = "";
        String odefname = "";
-       bool odefFound = true;
+       bool odefFound = false;
        if(terrainUID != "" && !CACHE.stringHasUID(name))
        {
                sprintf(fname,"%s-%s.odef", terrainUID.c_str(), name);
                odefname = String(fname);
                bool exists = 
ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(odefname);
                if(exists)
-               {
+               {       
                        odefgroup = 
ResourceGroupManager::getSingleton().findGroupContainingResource(odefname);
                        odefFound = true;
                }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Rigsofrods-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to