Skip to content

Commit

Permalink
Switched back to the switch statement
Browse files Browse the repository at this point in the history
  • Loading branch information
koliva8245 committed Jun 17, 2020
1 parent 591cab6 commit 447e1f5
Showing 1 changed file with 37 additions and 14 deletions.
51 changes: 37 additions & 14 deletions Heroes.ReplayParser/MPQFiles/ReplayInitData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,44 @@ public static void Parse(Replay replay, byte[] buffer)

// m_ammId
if (replay.ReplayBuild >= 43905 && reader.ReadBoolean())
{
replay.GameMode = (reader.ReadInt32()) switch
switch (reader.ReadInt32())
{
50001 => GameMode.QuickMatch,
50021 => GameMode.Cooperative,
50031 => GameMode.Brawl,
50041 => GameMode.Practice,
50051 => GameMode.UnrankedDraft,
50061 => GameMode.HeroLeague,
50071 => GameMode.TeamLeague,
50091 => GameMode.StormLeague,

_ => GameMode.Unknown,
};
}
case 50001:
replay.GameMode = GameMode.QuickMatch;
break;

case 50021:
replay.GameMode = GameMode.Cooperative;
break;

case 50031:
replay.GameMode = GameMode.Brawl;
break;

case 50041:
replay.GameMode = GameMode.TryMe;
break;

case 50051:
replay.GameMode = GameMode.UnrankedDraft;
break;

case 50061:
replay.GameMode = GameMode.HeroLeague;
break;

case 50071:
replay.GameMode = GameMode.TeamLeague;
break;

case 50091:
replay.GameMode = GameMode.StormLeague;
break;

default:
replay.GameMode = GameMode.Unknown;
break;
}

reader.Read(3); // Game Speed

Expand Down

0 comments on commit 447e1f5

Please sign in to comment.