1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Merge fixes

This commit is contained in:
AlexVinS 2016-02-04 12:28:12 +03:00
parent 6e205a58b4
commit 483276b128
10 changed files with 32 additions and 18 deletions

View File

@ -80,7 +80,7 @@ public:
h & static_cast<CBonusSystemNode&>(*this);
h & name & description & eventText & image & large & advMapDef & iconIndex &
price & possibleSlots & constituents & constituentOf & aClass & id;
if(version>=756)
if(version>=759)
{
h & identifier;
}

View File

@ -138,7 +138,7 @@ public:
h & idNumber & faction & sounds & animation;
h & doubleWide & special;
if(version>=756)
if(version>=759)
{
h & identifier;
}

View File

@ -92,10 +92,10 @@ public:
h & ID & imageIndex & initialArmy & heroClass & secSkillsInit & spec & specialty & spells & haveSpellBook & sex & special;
h & name & biography & specName & specDescr & specTooltip;
h & iconSpecSmall & iconSpecLarge & portraitSmall & portraitLarge;
if(version>=756)
if(version>=759)
{
h & identifier;
}
}
}
};

View File

@ -27,7 +27,7 @@
#include "mapping/CCampaignHandler.h" //for CCampaignState
#include "rmg/CMapGenerator.h" // for CMapGenOptions
const ui32 version = 758;
const ui32 version = 759;
const ui32 minSupportedVersion = 753;
class CISer;

View File

@ -21,7 +21,21 @@ CFileInputStream::CFileInputStream(const boost::filesystem::path & file, si64 st
}
CFileInputStream::CFileInputStream(const CFileInfo & file, si64 start, si64 size)
: CFileInputStream{file.getName(), start, size} {}
: dataStart{start},
dataSize{size},
fileStream{file.getName(), std::ios::in | std::ios::binary}
{
if (fileStream.fail())
throw std::runtime_error("File " + file.getName() + " isn't available.");
if (dataSize == 0)
{
fileStream.seekg(0, std::ios::end);
dataSize = tell();
}
fileStream.seekg(dataStart, std::ios::beg);
}
si64 CFileInputStream::read(ui8 * data, si64 size)
{

View File

@ -14,12 +14,12 @@
*
*/
CZipStream::CZipStream(const boost::filesystem::path & archive, unz64_file_pos filepos)
CZipStream::CZipStream(std::shared_ptr<CIOApi> api, const boost::filesystem::path & archive, unz64_file_pos filepos)
{
zlib_filefunc64_def zlibApi;
zlibApi = api->getApiStructure();
file = unzOpen2_64(archive.c_str(), &zlibApi);
unzGoToFilePos64(file, &filepos);
unzOpenCurrentFile(file);
@ -53,7 +53,7 @@ ui32 CZipStream::calculateCRC32()
///CZipLoader
CZipLoader::CZipLoader(const std::string & mountPoint, const boost::filesystem::path & archive, std::shared_ptr<CIOApi> api):
ioApi(api),
zlibApi(ioApi->getApiStructure()),
zlibApi(ioApi->getApiStructure()),
archiveName(archive),
mountPoint(mountPoint),
files(listFiles(mountPoint, archive))
@ -66,7 +66,7 @@ std::unordered_map<ResourceID, unz64_file_pos> CZipLoader::listFiles(const std::
std::unordered_map<ResourceID, unz64_file_pos> ret;
unzFile file = unzOpen2_64(archive.c_str(), &zlibApi);
if(file == nullptr)
logGlobal->errorStream() << archive << " failed to open";
@ -95,7 +95,7 @@ std::unordered_map<ResourceID, unz64_file_pos> CZipLoader::listFiles(const std::
std::unique_ptr<CInputStream> CZipLoader::load(const ResourceID & resourceName) const
{
return std::unique_ptr<CInputStream>(new CZipStream(ioApi, archiveName, files.at(resourceName)));
return std::unique_ptr<CInputStream>(new CZipStream(ioApi, archiveName, files.at(resourceName)));
}
bool CZipLoader::existsResource(const ResourceID & resourceName) const

View File

@ -28,7 +28,7 @@ public:
* @param archive path to archive to open
* @param filepos position of file to open
*/
CZipStream(std::shared_ptr<CIOApi> api, const boost::filesystem::path & archive, unz_file_pos filepos);
CZipStream(std::shared_ptr<CIOApi> api, const boost::filesystem::path & archive, unz64_file_pos filepos);
~CZipStream();
si64 getSize() override;

View File

@ -159,7 +159,7 @@ public:
template <typename Handler> void serialize(Handler &h, const int version)
{
h & type & subtype & templates & rmgInfo & objectName;
if(version >= 756)
if(version >= 759)
{
h & typeName & subTypeName;
}
@ -186,7 +186,7 @@ class DLL_LINKAGE CObjectClassesHandler : public IHandlerBase
template <typename Handler> void serialize(Handler &h, const int version)
{
h & name & handlerName & base & subObjects;
if(version >= 756)
if(version >= 759)
{
h & identifier & subIds;
}

View File

@ -179,7 +179,7 @@ public:
h & pos & ID & subID & id & tempOwner & blockVisit & appearance;
//definfo is handled by map serializer
if(version >= 756)
if(version >= 759)
{
h & typeName & subTypeName;
}

View File

@ -598,7 +598,7 @@ void CMapLoaderJson::MapObjectLoader::construct()
pos.x = configuration["x"].Float();
pos.y = configuration["y"].Float();
pos.z = configuration["l"].Float();
owner->map->grailRadious = configuration["options"]["grailRadius"].Float();
owner->map->grailRadius = configuration["options"]["grailRadius"].Float();
}
handler = VLC->objtypeh->getHandlerFor(typeName, subTypeName);
@ -879,7 +879,7 @@ void CMapSaverJson::writeObjects()
grail["y"].Float() = map->grailPos.y;
grail["l"].Float() = map->grailPos.z;
grail["options"]["radius"].Float() = map->grailRadious;
grail["options"]["radius"].Float() = map->grailRadius;
std::string grailId = boost::str(boost::format("grail_%d") % map->objects.size());