AlexVinS пре 9 година
родитељ
комит
483276b128

+ 1 - 1
lib/CArtHandler.h

@@ -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;
 		}

+ 1 - 1
lib/CCreatureHandler.h

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

+ 2 - 2
lib/CHeroHandler.h

@@ -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;
-		}		
+		}
 	}
 };
 

+ 1 - 1
lib/Connection.h

@@ -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;

+ 15 - 1
lib/filesystem/CFileInputStream.cpp

@@ -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)
 {

+ 6 - 6
lib/filesystem/CZipLoader.cpp

@@ -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

+ 1 - 1
lib/filesystem/CZipLoader.h

@@ -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;

+ 2 - 2
lib/mapObjects/CObjectClassesHandler.h

@@ -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;
 			}

+ 1 - 1
lib/mapObjects/CObjectHandler.h

@@ -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;
 		}

+ 2 - 2
lib/mapping/MapFormatJson.cpp

@@ -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());