From 2f576684ac568816b98c7e6c2f3ebd8c66d8fdaa Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Mon, 20 Apr 2020 00:20:37 +0000 Subject: [PATCH] VR r2348 fix - loading .jpc.7z with a single image would cause exception as file was not considered open (by anv) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8786 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Standard Gaming Platform/PngLoader.cpp | 6 +++++- Tactical/PATHAI.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Standard Gaming Platform/PngLoader.cpp b/Standard Gaming Platform/PngLoader.cpp index 1fce3be5c..b817851d1 100644 --- a/Standard Gaming Platform/PngLoader.cpp +++ b/Standard Gaming Platform/PngLoader.cpp @@ -765,7 +765,11 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents) { try { - LoadPngFile lpng( vfs::tReadableFile::cast(vFiles[0]) ); + // VR r2348 fix - loading .jpc.7z with a single image would cause exception as file was not considered open (by anv) + //LoadPngFile lpng(vfs::tReadableFile::cast(vFiles[0])); + vfs::CBufferFile oTempFile(""); + oTempFile.copyToBuffer(*vfs::tReadableFile::cast(vFiles[0])); + LoadPngFile lpng(vfs::tReadableFile::cast(&oTempFile)); bool bLoadS = lpng.Load(); diff --git a/Tactical/PATHAI.cpp b/Tactical/PATHAI.cpp index 2eb32483b..922c85e9e 100644 --- a/Tactical/PATHAI.cpp +++ b/Tactical/PATHAI.cpp @@ -3890,7 +3890,7 @@ if(!GridNoOnVisibleWorldTile(iDestination)) nextCost += 20; } } - } + } newTotCost = curCost + nextCost;