Page MenuHomeWildfire Games

Fix VFS loading of map heightmap images
ClosedPublic

Authored by elexis on May 1 2018, 9:42 PM.

Details

Summary

In rP21113 when reusing the Atlas OsPath heightmap image fileloading code for random maps in the VFS,
I forgot to account for the release version where the VFS files are not saved on the disk directly but archived in public.zip.

This patch removes the hence invalid g_VFS->GetRealPath call and loads from the VFS directly in the rmgen case and loads from the Os directly for atlas.

Test Plan

Works for me on linux with unzipped files. It should be tested that it works on Windows and with a public.zip as well.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

elexis created this revision.May 1 2018, 9:42 PM
Vulcan added a subscriber: Vulcan.May 1 2018, 9:44 PM

Build failure - The Moirai have given mortals hearts that can endure.

Linter detected issues:
Executing section Default...
Executing section Source...

source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp
|  33| #include·"lib/file/vfs/vfs_path.h"
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character ({) when these macros are defined: ''.

source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp
|  33| #include·"lib/file/vfs/vfs_path.h"
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character ({) when these macros are defined: 'MESSAGES_SKIP_STRUCTS'.

source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp
|  33| #include·"lib/file/vfs/vfs_path.h"
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character ({) when these macros are defined: '_MSC_VER'.
Executing section JS...

Link to build: https://jenkins.wildfiregames.com/job/differential/455/display/redirect

Itms added a reviewer: Itms.May 1 2018, 9:55 PM
Imarok added a subscriber: Imarok.May 1 2018, 9:57 PM

What about also using vfs in atlas and removing the OS variant of the function? (Just speculating)

Itms added a comment.May 1 2018, 9:59 PM
In D1480#60501, @Imarok wrote:

What about also using vfs in atlas and removing the OS variant of the function? (Just speculating)

I thought that would work but in Atlas you can load files that are completely outside of 0 A.D. folders and not mounted in VFS at all.

elexis added a comment.May 1 2018, 9:59 PM

The atlas feature is that one can open files on the disk, i.e. they are not in the VFS.

elexis updated this revision to Diff 6502.May 1 2018, 10:13 PM

std::size_t -> size_t since we use the version of the compiler, not the one of the std lib.
OsPath and VFSPath aren't classes but typedefs, so don't try a forward declaration.

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Default...
Executing section Source...

source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp
|  33| #include·"lib/file/vfs/vfs_path.h"
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character ({) when these macros are defined: ''.

source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp
|  33| #include·"lib/file/vfs/vfs_path.h"
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character ({) when these macros are defined: 'MESSAGES_SKIP_STRUCTS'.

source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp
|  33| #include·"lib/file/vfs/vfs_path.h"
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character ({) when these macros are defined: '_MSC_VER'.
Executing section JS...

Link to build: https://jenkins.wildfiregames.com/job/differential/456/display/redirect

elexis updated this revision to Diff 6503.May 1 2018, 10:21 PM

Remove <cstdio> leftover

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Default...
Executing section Source...

source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp
|  33| #include·"lib/file/vfs/vfs_path.h"
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character ({) when these macros are defined: ''.

source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp
|  33| #include·"lib/file/vfs/vfs_path.h"
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character ({) when these macros are defined: 'MESSAGES_SKIP_STRUCTS'.

source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp
|  33| #include·"lib/file/vfs/vfs_path.h"
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Invalid number of character ({) when these macros are defined: '_MSC_VER'.
Executing section JS...

Link to build: https://jenkins.wildfiregames.com/job/differential/457/display/redirect

Itms accepted this revision.May 1 2018, 10:43 PM
This revision is now accepted and ready to land.May 1 2018, 10:43 PM
This revision was automatically updated to reflect the committed changes.
Owners added subscribers: Restricted Owners Package, Restricted Owners Package.May 1 2018, 11:16 PM