Working on loading

This commit is contained in:
Vladislav Khorev committed 2026-10-23 23:49:54 +06:00
1 parent d38a75ea72
commit 9b71ee447a
11 files changed
+268 -55

No files matched your search

+22
View File
@@ -553,4 +553,26 @@ namespace FRG
textureMap.clear();
}
void TextureManager::MarkAllResident()
{
for (const auto& [key, tex] : textureMap) residentKeys.insert(key);
}
void TextureManager::UnloadNonResident(const std::string& residentPrefix)
{
size_t unloaded = 0;
for (auto it = textureMap.begin(); it != textureMap.end(); ) {
const bool keep = residentKeys.count(it->first)
|| (!residentPrefix.empty() && it->first.compare(0, residentPrefix.size(), residentPrefix) == 0);
if (keep) {
++it;
}
else {
it = textureMap.erase(it);
++unloaded;
}
}
logger() << "Unloaded " << unloaded << " non-resident textures" << std::endl;
}
}