mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
ResourceManager stores Reloadables in a list, instead of vector.
This commit is contained in:
parent
a818801ea6
commit
dd10edb904
|
@ -86,19 +86,31 @@ bool ResourceManager::fileExists(const std::string& path) const
|
||||||
|
|
||||||
void ResourceManager::unloadAll()
|
void ResourceManager::unloadAll()
|
||||||
{
|
{
|
||||||
for(auto iter = mReloadables.begin(); iter != mReloadables.end(); iter++)
|
auto iter = mReloadables.begin();
|
||||||
|
while(iter != mReloadables.end())
|
||||||
{
|
{
|
||||||
if(!iter->expired())
|
if(!iter->expired())
|
||||||
|
{
|
||||||
iter->lock()->unload(*this);
|
iter->lock()->unload(*this);
|
||||||
|
iter++;
|
||||||
|
}else{
|
||||||
|
mReloadables.erase(iter++);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceManager::reloadAll()
|
void ResourceManager::reloadAll()
|
||||||
{
|
{
|
||||||
for(auto iter = mReloadables.begin(); iter != mReloadables.end(); iter++)
|
auto iter = mReloadables.begin();
|
||||||
|
while(iter != mReloadables.end())
|
||||||
{
|
{
|
||||||
if(!iter->expired())
|
if(!iter->expired())
|
||||||
|
{
|
||||||
iter->lock()->reload(*this);
|
iter->lock()->reload(*this);
|
||||||
|
iter++;
|
||||||
|
}else{
|
||||||
|
mReloadables.erase(iter++);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <list>
|
||||||
|
|
||||||
//The ResourceManager exists to...
|
//The ResourceManager exists to...
|
||||||
//Allow loading resources embedded into the executable like an actual file.
|
//Allow loading resources embedded into the executable like an actual file.
|
||||||
|
@ -38,5 +38,5 @@ public:
|
||||||
private:
|
private:
|
||||||
ResourceData loadFile(const std::string& path) const;
|
ResourceData loadFile(const std::string& path) const;
|
||||||
|
|
||||||
std::vector< std::weak_ptr<IReloadable> > mReloadables;
|
std::list< std::weak_ptr<IReloadable> > mReloadables;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue