This commit is contained in:
lanyizi 2025-01-30 12:53:12 +01:00
parent 66458e831c
commit e16eefa166
2 changed files with 8 additions and 5 deletions

View File

@ -108,7 +108,7 @@ namespace AnotherReplayReader.Apm
playerLifes[playerIndex] = estimatedTime; playerLifes[playerIndex] = estimatedTime;
} }
} }
else if (!IsUnknown(commandId) && !IsAuto(commandId)) else if (!IsUnknown(commandId) && !IsAuto(commandId) && playerIndex >= 0)
{ {
if (stricterLifes[playerIndex] < estimatedTime) if (stricterLifes[playerIndex] < estimatedTime)
{ {
@ -138,7 +138,7 @@ namespace AnotherReplayReader.Apm
} }
foreach (var command in commands) foreach (var command in commands)
{ {
if (options.ShouldSkip(command.CommandId)) if (options.ShouldSkip(command.CommandId) || command.PlayerIndex < 0)
{ {
continue; continue;
} }
@ -164,7 +164,7 @@ namespace AnotherReplayReader.Apm
{ {
foreach (var command in commands) foreach (var command in commands)
{ {
if (options.ShouldSkip(command.CommandId)) if (options.ShouldSkip(command.CommandId) || command.PlayerIndex < 0)
{ {
continue; continue;
} }
@ -209,7 +209,10 @@ namespace AnotherReplayReader.Apm
{ {
commandCount = playerCommands[command.CommandId] = new int[Players.Length]; commandCount = playerCommands[command.CommandId] = new int[Players.Length];
} }
commandCount[command.PlayerIndex] = commandCount[command.PlayerIndex] + 1; if (command.PlayerIndex >= 0 && command.PlayerIndex < Players.Length)
{
commandCount[command.PlayerIndex] = commandCount[command.PlayerIndex] + 1;
}
} }
} }
return playerCommands; return playerCommands;

View File

@ -45,7 +45,7 @@ namespace AnotherReplayReader.ReplayFile
var lastByte = current.ReadBytes(size - 2).Last(); var lastByte = current.ReadBytes(size - 2).Last();
if (lastByte != 0xFF) if (lastByte != 0xFF)
{ {
throw new InvalidDataException($"Failed to parse command {command:X}, last byte is {lastByte:X}"); // throw new InvalidDataException($"Failed to parse command {command:X}, last byte is {lastByte:X}");
} }
}; };
} }