From b50364edcf043175aefba4e0110dd2d7e813dc0e Mon Sep 17 00:00:00 2001 From: George Kurelic Date: Tue, 22 Feb 2022 12:57:29 -0600 Subject: [PATCH 1/2] check #if polymod instead of cpp --- source/modding/PolymodHandler.hx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/modding/PolymodHandler.hx b/source/modding/PolymodHandler.hx index e0c7009c5..8013ba99b 100644 --- a/source/modding/PolymodHandler.hx +++ b/source/modding/PolymodHandler.hx @@ -1,6 +1,6 @@ package modding; -#if desktop +#if polymod import polymod.Polymod.ModMetadata; import polymod.Polymod; import polymod.backends.OpenFLBackend; @@ -29,7 +29,7 @@ class PolymodHandler */ public static function loadAllMods() { - #if cpp + #if polymod trace("Initializing Polymod (using all mods)..."); loadModsById(getAllModIds()); #else @@ -43,7 +43,7 @@ class PolymodHandler public static function loadNoMods() { // We still need to configure the debug print calls etc. - #if cpp + #if polymod trace("Initializing Polymod (using no mods)..."); loadModsById([]); #else @@ -53,7 +53,7 @@ class PolymodHandler public static function loadModsById(ids:Array) { - #if cpp + #if polymod if (ids.length == 0) { trace('You attempted to load zero mods.'); @@ -132,7 +132,7 @@ class PolymodHandler #end } - #if cpp + #if polymod static function buildParseRules():polymod.format.ParseRules { var output = polymod.format.ParseRules.getDefault(); @@ -182,9 +182,9 @@ class PolymodHandler } #end - public static function getAllMods():Array<#if cpp ModMetadata #else Dynamic #end> // this is shitty conditional but ModMetadata isn't imported on HTML5! And I'm too lazy to actually do it properly! + public static function getAllMods():Array<#if polymod ModMetadata #else Dynamic #end> // this is shitty conditional but ModMetadata isn't imported on HTML5! And I'm too lazy to actually do it properly! { - #if cpp + #if polymod trace('Scanning the mods folder...'); var modMetadata = Polymod.scan(MOD_FOLDER); trace('Found ${modMetadata.length} mods when scanning.'); From 37517e1e16bba91cf1b299578ee9e63105bc4ab5 Mon Sep 17 00:00:00 2001 From: George Kurelic Date: Tue, 22 Feb 2022 13:03:01 -0600 Subject: [PATCH 2/2] use type inference instead of conditional type --- source/modding/PolymodHandler.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/modding/PolymodHandler.hx b/source/modding/PolymodHandler.hx index 8013ba99b..de4438b54 100644 --- a/source/modding/PolymodHandler.hx +++ b/source/modding/PolymodHandler.hx @@ -182,7 +182,7 @@ class PolymodHandler } #end - public static function getAllMods():Array<#if polymod ModMetadata #else Dynamic #end> // this is shitty conditional but ModMetadata isn't imported on HTML5! And I'm too lazy to actually do it properly! + public static function getAllMods() { #if polymod trace('Scanning the mods folder...'); @@ -190,7 +190,7 @@ class PolymodHandler trace('Found ${modMetadata.length} mods when scanning.'); return modMetadata; #else - return []; + return new Array(); #end }