Mutagen-Modding / Mutagen

A .NET library for analyzing, creating, and manipulating Bethesda mods

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FormVersion not set in some ctors, on records of games without multiple releases

Noggog opened this issue · comments

Fallout4's ArmorModification, for ex, if you make with a FormKey as the only parameter, the FormVersion will be left at 0.

public ArmorModification(FormKey formKey)
        {
            this.FormKey = formKey;
            CustomCtor();
        }

        private ArmorModification(
            FormKey formKey,
            GameRelease gameRelease)
        {
            this.FormKey = formKey;
            this.FormVersion = gameRelease.GetDefaultFormVersion()!.Value;
            CustomCtor();
        }

        internal ArmorModification(
            FormKey formKey,
            ushort formVersion)
        {
            this.FormKey = formKey;
            this.FormVersion = formVersion;
            CustomCtor();
        }

        public ArmorModification(IFallout4Mod mod)
            : this(mod.GetNextFormKey())
        {
        }

Top ctor should probably call the 2nd, passing GameRelease.Fallout4