1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-03 00:46:55 +02:00

Zmiany do Programming challenge.

This commit is contained in:
Michał W. Urbańczyk
2011-09-27 21:54:40 +00:00
parent 5d4cfc0d0f
commit bdd66b6537
21 changed files with 588 additions and 82 deletions

View File

@ -271,38 +271,40 @@ void CLodHandler::init(const std::string lodFile, const std::string dirName)
if (!LOD.is_open())
{
tlog1 << "Cannot open " << lodFile << std::endl;
return;
}
Uint32 temp;
LOD.seekg(8);
LOD.read((char *)&temp, 4);
totalFiles = SDL_SwapLE32(temp);
LOD.seekg(0x5c, std::ios::beg);
if(!LOD)
else
{
tlog2 << lodFile << " doesn't store anything!\n";
return;
Uint32 temp;
LOD.seekg(8);
LOD.read((char *)&temp, 4);
totalFiles = SDL_SwapLE32(temp);
LOD.seekg(0x5c, std::ios::beg);
if(!LOD)
{
tlog2 << lodFile << " doesn't store anything!\n";
return;
}
struct LodEntry *lodEntries = new struct LodEntry[totalFiles];
LOD.read((char *)lodEntries, sizeof(struct LodEntry) * totalFiles);
for (unsigned int i=0; i<totalFiles; i++)
{
Entry entry;
initEntry(entry, lodEntries[i].filename);
entry.offset= SDL_SwapLE32(lodEntries[i].offset);
entry.realSize = SDL_SwapLE32(lodEntries[i].uncompressedSize);
entry.size = SDL_SwapLE32(lodEntries[i].size);
entries.insert(entry);
}
delete [] lodEntries;
}
struct LodEntry *lodEntries = new struct LodEntry[totalFiles];
LOD.read((char *)lodEntries, sizeof(struct LodEntry) * totalFiles);
for (unsigned int i=0; i<totalFiles; i++)
{
Entry entry;
initEntry(entry, lodEntries[i].filename);
entry.offset= SDL_SwapLE32(lodEntries[i].offset);
entry.realSize = SDL_SwapLE32(lodEntries[i].uncompressedSize);
entry.size = SDL_SwapLE32(lodEntries[i].size);
entries.insert(entry);
}
delete [] lodEntries;
boost::filesystem::recursive_directory_iterator enddir;
if(boost::filesystem::exists(dirName))
{