1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-21 21:17:49 +02:00
vcmi/lib/filesystem/CMappedFileLoader.cpp
Ivan Savenko 8be801a6dc - CMappedFileLoader class to remap WoG files to h3 names
- WoG should be optional, all remapped files are listed in WoG/config/wogFileOverrides.json
- fixed several cases of incorrect positioning of creatures in battles
- some missing sounds for battle effects
- negative luck support, disabled by default
- a bit hackish detection of WoG presence, VCMI should work on SoD-only installs
2013-05-04 13:14:23 +00:00

46 lines
1.0 KiB
C++

#include "StdInc.h"
#include "CMappedFileLoader.h"
#include "CResourceLoader.h"
#include "../JsonNode.h"
CMappedFileLoader::CMappedFileLoader(const JsonNode &config)
{
BOOST_FOREACH(auto entry, config.Struct())
{
fileList[ResourceID(entry.first)] = entry.second.String();
}
}
std::unique_ptr<CInputStream> CMappedFileLoader::load(const std::string & resourceName) const
{
return CResourceHandler::get()->load(ResourceID(resourceName));
}
bool CMappedFileLoader::existsEntry(const std::string & resourceName) const
{
for(auto it = fileList.begin(); it != fileList.end(); ++it)
{
if(it->second == resourceName)
{
return true;
}
}
return false;
}
boost::unordered_map<ResourceID, std::string> CMappedFileLoader::getEntries() const
{
return fileList;
}
std::string CMappedFileLoader::getOrigin() const
{
return ""; // does not have any meaning with this type of data source
}
std::string CMappedFileLoader::getFullName(const std::string & resourceName) const
{
return CResourceHandler::get()->getResourceName(ResourceID(resourceName));
}