]> git.tdb.fi Git - libs/gl.git/blobdiff - source/resourcemanager.cpp
Mark fog tokens as legacy features
[libs/gl.git] / source / resourcemanager.cpp
index 733cfaff8c4c37ba5ae1ffbd605ceb3f8d6a58df..7d5d752b2351a3607e17b953212d981cde1c1792 100644 (file)
@@ -4,6 +4,7 @@
 #include <msp/strings/format.h>
 #include <msp/time/utils.h>
 #include "resourcemanager.h"
+#include "resources.h"
 #include "resourcewatcher.h"
 
 using namespace std;
@@ -105,7 +106,9 @@ void ResourceManager::load_resource(Resource &r)
        if(async_loads)
        {
                managed.state = ManagedResource::LOAD_QUEUED;
-               queue.push_back(&managed);
+               LoadQueue::iterator i;
+               for(i=queue.begin(); (i!=queue.end() && (*i)->load_priority>=managed.load_priority); ++i) ;
+               queue.insert(i, &managed);
        }
        else
        {
@@ -270,6 +273,7 @@ ResourceManager::ResourceLocation::ResourceLocation(DataFile::Collection &c, con
 
 ResourceManager::ManagedResource::ManagedResource(Resource &r):
        resource(&r),
+       load_priority(r.get_load_priority()),
        io(0),
        loader(0),
        state(NOT_LOADED),
@@ -283,7 +287,8 @@ void ResourceManager::ManagedResource::start_loading()
        if(!io)
                throw resource_load_error(location.name, "open failed");
 
-       loader = resource->load(*io);
+       const Resources *res = dynamic_cast<Resources *>(location.collection);
+       loader = resource->load(*io, res);
        if(!loader)
        {
                delete io;