Skip to content

Commit

Permalink
Fallout UnknownObjectModification stores its type
Browse files Browse the repository at this point in the history
  • Loading branch information
Noggog committed Nov 14, 2023
1 parent e728c09 commit e98db46
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,21 @@ public static AObjectModification CreateFromBinary(
}
}
var type = new RecordType(BinaryPrimitives.ReadInt32LittleEndian(data.Content.Slice(10)));
return type.TypeInt switch
switch (type.TypeInt)
{
RecordTypeInts.ARMO => ArmorModification.CreateFromBinary(frame),
RecordTypeInts.NPC_ => NpcModification.CreateFromBinary(frame),
RecordTypeInts.WEAP => WeaponModification.CreateFromBinary(frame),
RecordTypeInts.NONE => ObjectModification.CreateFromBinary(frame),
_ => UnknownObjectModification.CreateFromBinary(frame),
};
case RecordTypeInts.ARMO:
return ArmorModification.CreateFromBinary(frame);
case RecordTypeInts.NPC_:
return NpcModification.CreateFromBinary(frame);
case RecordTypeInts.WEAP:
return WeaponModification.CreateFromBinary(frame);
case RecordTypeInts.NONE:
return ObjectModification.CreateFromBinary(frame);
default:
var unknown = UnknownObjectModification.CreateFromBinary(frame);
unknown.ModificationType = type;
return unknown;
}
}
catch (Exception e)
{
Expand Down

0 comments on commit e98db46

Please sign in to comment.