@@ -616,9 +616,11 @@ public static void exportToWurst(List<? extends ObjMod.Obj> customObjs, ObjectFi
616616 * <p>Fields that have no known wrapper method are emitted as commented-out raw
617617 * calls so the output is still useful even when coverage is incomplete.
618618 *
619- * <p>Returns {@code false} only when there is no wrapper class at all for this
619+ * <p>Returns {@code false} when there is no wrapper class at all for this
620620 * object type / base ID (e.g. doodads, upgrades, or an unknown ability base ID),
621- * in which case the caller should fall back to the fully raw format.
621+ * or when a mapped wrapper setter exists but its parameter type is not yet
622+ * supported for source re-emission. In those cases the caller should fall back
623+ * to the fully raw format so no object data is lost on re-export.
622624 */
623625 private static boolean tryExportWithWrapper (Appendable out , ObjectFileType fileType ,
624626 String newId , String oldId ,
@@ -677,11 +679,8 @@ private static boolean tryExportWithWrapper(Appendable out, ObjectFileType fileT
677679 return false ;
678680 }
679681
680- for (ObjMod .Obj .Mod m : mods ) {
681- StdlibObjectMappings .FieldMethodInfo info = fieldMethods .get (fieldKey (m , fileType ));
682- if (info != null && !canUseWrapperForMod (m , info )) {
683- return false ;
684- }
682+ if (hasUnsupportedMappedWrapperField (mods , fieldMethods , fileType )) {
683+ return false ;
685684 }
686685
687686 out .append ("@compiletime function create_" ).append (fileType .getExt ()).append ("_" ).append (newId )
@@ -690,7 +689,7 @@ private static boolean tryExportWithWrapper(Appendable out, ObjectFileType fileT
690689
691690 for (ObjMod .Obj .Mod m : mods ) {
692691 StdlibObjectMappings .FieldMethodInfo info = fieldMethods .get (fieldKey (m , fileType ));
693- if (info != null ) {
692+ if (info != null && canUseWrapperForMod ( m , info ) ) {
694693 out .append ("\t .." ).append (info .methodName ()).append ("(" );
695694 if (info .hasLevel () && m instanceof ObjMod .Obj .ExtendedMod ) {
696695 out .append (String .valueOf (((ObjMod .Obj .ExtendedMod ) m ).getLevel ())).append (", " );
@@ -707,6 +706,21 @@ private static boolean tryExportWithWrapper(Appendable out, ObjectFileType fileT
707706 return true ;
708707 }
709708
709+ private static boolean hasUnsupportedMappedWrapperField (List <ObjMod .Obj .Mod > mods ,
710+ Map <String , StdlibObjectMappings .FieldMethodInfo > fieldMethods ,
711+ ObjectFileType fileType ) {
712+ for (ObjMod .Obj .Mod mod : mods ) {
713+ StdlibObjectMappings .FieldMethodInfo info = fieldMethods .get (fieldKey (mod , fileType ));
714+ if (info == null ) {
715+ continue ;
716+ }
717+ if (!canUseWrapperForMod (mod , info )) {
718+ return true ;
719+ }
720+ }
721+ return false ;
722+ }
723+
710724 /**
711725 * Returns the lookup key used to match a mod to a {@link StdlibObjectMappings.FieldMethodInfo}.
712726 * Uses the mod's actual dataPtr when it is an {@link ObjMod.Obj.ExtendedMod}, regardless of
@@ -724,8 +738,7 @@ static String fieldKey(ObjMod.Obj.Mod m, ObjectFileType fileType) {
724738 }
725739
726740 private static boolean canUseWrapperForMod (ObjMod .Obj .Mod m , StdlibObjectMappings .FieldMethodInfo info ) {
727- if (!info .parameterType ().isEmpty () && !isPrimitiveParameter (info .parameterType ())
728- && !isEnumParameter (info .parameterType ())) {
741+ if (!supportsWrapperParameterType (info .parameterType ())) {
729742 return false ;
730743 }
731744 if (isEnumParameter (info .parameterType ())) {
@@ -734,6 +747,12 @@ private static boolean canUseWrapperForMod(ObjMod.Obj.Mod m, StdlibObjectMapping
734747 return true ;
735748 }
736749
750+ private static boolean supportsWrapperParameterType (String parameterType ) {
751+ return parameterType .isEmpty ()
752+ || isPrimitiveParameter (parameterType )
753+ || isEnumParameter (parameterType );
754+ }
755+
737756 private static boolean isEnumParameter (String parameterType ) {
738757 return ENUM_OBJECT_STRING_TO_CONSTANT .containsKey (parameterType );
739758 }
@@ -848,6 +867,7 @@ private static Map<String, String> enumConstants(String... valueConstantPairs) {
848867 "mline" , "MissileLine"
849868 ),
850869 "WeaponSound" , enumConstants (
870+ "" , "Nothing" ,
851871 "Nothing" , "Nothing" ,
852872 "AxeMediumChop" , "AxeMediumChop" ,
853873 "MetalHeavyBash" , "MetalHeavyBash" ,
0 commit comments