@@ -79,6 +79,9 @@ public abstract class MapRequest extends UserRequest<Object> {
7979 public static final String BUILD_COMPILED_LUA_NAME = "02_compiled.lua" ;
8080 public static final String BUILD_JHCR_SCRIPT_NAME = "03_jhcr_war3map.j" ;
8181
82+ /** RunArgs flag (see {@link RunArgs}) that relaxes Jass type checks and skips PJass; injected for pre-1.24 targets. */
83+ private static final String LEGACY_JASS_CHECKS_ARG = "-legacyJassChecks" ;
84+
8285 /**
8386 * makes the compilation slower, but more safe by discarding results from the editor and working on a copy of the model
8487 */
@@ -102,17 +105,21 @@ public MapRequest(WurstLanguageServer langServer, Optional<File> map, List<Strin
102105 Optional <String > wc3Path , Optional <String > gameExePath ) {
103106 this .langServer = langServer ;
104107 this .map = map ;
105- this .compileArgs = compileArgs ;
106108 this .workspaceRoot = workspaceRoot ;
107- this .runArgs = new RunArgs (compileArgs );
108109 this .wc3Path = wc3Path ;
109110 this .buildConfig = WurstBuildConfig .fromWorkspaceRoot (workspaceRoot );
110- // Patches before 1.24 ship Blizzard common.j/blizzard.j with type mismatches
111- // that the Jass VM tolerates (e.g. real returned as integer). Relax Jass
112- // type checks and skip PJass for such targets so these stock scripts compile.
113- if (buildConfig .isPre124 ()) {
114- runArgs .setLegacyJassTypeChecks (true );
111+ // Patches before 1.24 ship Blizzard common.j/blizzard.j with type mismatches that the
112+ // Jass VM tolerates (e.g. a real returned where an integer is declared). Relax Jass type
113+ // checks and skip PJass for such targets so these stock scripts compile. Carry the flag
114+ // through compileArgs so every RunArgs rebuilt from it (compileScript/compileMap) sees it,
115+ // not just this request-level field.
116+ if (buildConfig .isPre124 () && !compileArgs .contains (LEGACY_JASS_CHECKS_ARG )) {
117+ List <String > legacyArgs = new ArrayList <>(compileArgs );
118+ legacyArgs .add (LEGACY_JASS_CHECKS_ARG );
119+ compileArgs = legacyArgs ;
115120 }
121+ this .compileArgs = compileArgs ;
122+ this .runArgs = new RunArgs (compileArgs );
116123 if (gameExePath .isPresent () && StringUtils .isNotBlank (gameExePath .get ())) {
117124 Optional <GameVersion > configuredVersion = this instanceof RunMap
118125 ? Optional .empty ()
0 commit comments