1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-01 00:45:26 +02:00

large filesystem update. Filesysytem is now fully functional, everything should work.

- completely replaced CLodHandler, removed bitmaph and spriteh
- replaced CLodStream in favour of CCompressedStream (2 new files)
- renamed CResourceLoaderFactory and ResourceIndetifier to shorter names
NOTES:
- campaign loading is currently broken. Will fix.
- I am going to remove several unused files in several days (e.g. LodHandler)
This commit is contained in:
Ivan Savenko
2012-08-01 12:02:54 +00:00
parent 17a513c01b
commit b3c17d2788
55 changed files with 1319 additions and 767 deletions

View File

@ -7,6 +7,7 @@
#include "CGameInfo.h"
#include "mapHandler.h"
#include "../lib/Filesystem/CResourceLoader.h"
#include "CPreGame.h"
#include "CCastleInterface.h"
#include "../lib/CConsoleHandler.h"
@ -476,16 +477,25 @@ void processCommand(const std::string &message)
}*/
else if(message=="get txt")
{
tlog0<<"Command accepted.\t";
boost::filesystem::create_directory("Extracted_txts");
tlog0<<"Command accepted. Opening .lod file...\t";
CLodHandler * txth = new CLodHandler;
txth->init(GameConstants::DATA_DIR + "/Data/H3bitmap.lod","");
tlog0<<"done.\nScanning .lod file\n";
auto iterator = CResourceHandler::get()->getIterator([](const ResourceID & ident)
{
return ident.getType() == EResType::TEXT && boost::algorithm::starts_with(ident.getName(), "DATA/");
});
BOOST_FOREACH(Entry e, txth->entries)
if( e.type == FILE_TEXT )
txth->extractFile(std::string(GVCMIDirs.UserPath + "/Extracted_txts/")+e.name, e.name, FILE_TEXT);
tlog0<<"\rExtracting done :)\n";
std::string basePath = CResourceHandler::get()->getResourceName(std::string("DATA")) + "/Extracted_txts/";
while (iterator.hasNext())
{
std::ofstream file(basePath + iterator->getName() + ".TXT");
auto text = CResourceHandler::get()->loadData(*iterator);
file.write((char*)text.first.get(), text.second);
++iterator;
}
tlog0 << "\rExtracting done :)\n";
tlog0 << " Extracted files can be found in " << basePath << " directory\n";
}
else if(cn=="crash")
{