garrysmod-issues icon indicating copy to clipboard operation
garrysmod-issues copied to clipboard

BSP header has wrong mapversion when VMF contains func_instance entities

Open jessica945 opened this issue 3 years ago • 0 comments

Details

When parsing a VMF during compile, the value of g_MapRevision is set to the value of any occurrence of the mapversion key, even if it was already set prior. This makes func_instance VMFs override the main VMF's mapversion.

The else if( !stricmp( szKey, "mapversion" ) ) block in src/utils/common/map_shared.cpp should only set the value of g_MapRevision if it was 0 (not set previously).

Steps to reproduce

Compile a VMF that contains instances with a different mapversion keyvalue. Run the command lua_run print( game.GetMapVersion() ) to see the incorrect map version. The map version given will be from the last instance parsed during compile. This can be checked by looking at the VMF of the instances in a text editor to see which instance matches the given mapversion.

jessica945 avatar Jul 09 '22 07:07 jessica945