Skip to content

Commit

Permalink
Merge pull request #1874 from Jacky720/lts-differentiation
Browse files Browse the repository at this point in the history
Fix Branch being overwritten less precisely
  • Loading branch information
Miepee authored Aug 22, 2024
2 parents 16679bd + 077ac61 commit 7715977
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions UndertaleModLib/Models/UndertaleGeneralInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -481,24 +481,13 @@ public void Unserialize(UndertaleReader reader)
if (reader.ReadOnlyGEN8)
return;

var detectedVer = TestForCommonGMSVersions(reader, (Major, Minor, Release, Build, Branch));
(Major, Minor, Release, Build, Branch) = detectedVer;

if (reader.undertaleData.GeneralInfo is not null)
{
var prevGenInfo = reader.undertaleData.GeneralInfo;
// If previous version is greater than current
if (prevGenInfo.Major > Major
|| prevGenInfo.Major == Major && prevGenInfo.Minor > Minor
|| prevGenInfo.Major == Major && prevGenInfo.Minor == Minor && prevGenInfo.Release > Release
|| prevGenInfo.Major == Major && prevGenInfo.Minor == Minor && prevGenInfo.Release == Release && prevGenInfo.Build > Build)
{
Major = prevGenInfo.Major;
Minor = prevGenInfo.Minor;
Release = prevGenInfo.Release;
Build = prevGenInfo.Build;
}
}
// TestForCommonGMSVersions is run during the object counting phase, so the previous general info is always accurate.
var prevGenInfo = reader.undertaleData.GeneralInfo;
Major = prevGenInfo.Major;
Minor = prevGenInfo.Minor;
Release = prevGenInfo.Release;
Build = prevGenInfo.Build;
Branch = prevGenInfo.Branch;

DefaultWindowWidth = reader.ReadUInt32();
DefaultWindowHeight = reader.ReadUInt32();
Expand Down

0 comments on commit 7715977

Please sign in to comment.