wip
This commit is contained in:
@@ -75,7 +75,8 @@ namespace AnotherReplayReader.Utils
|
||||
var playerStrongOwnership = new Dictionary<int, HashSet<uint>>();
|
||||
var playerWeakOwnership = new Dictionary<int, HashSet<uint>>();
|
||||
var playerTechChoices = new Dictionary<int, HashSet<string>>();
|
||||
var controlGroups = new Dictionary<int, HashSet<uint>>();
|
||||
// 编队号在同一局内可能被不同玩家复用,因此键必须包含玩家。
|
||||
var controlGroups = new Dictionary<long, HashSet<uint>>();
|
||||
|
||||
foreach (var (time, commands) in timeline)
|
||||
{
|
||||
@@ -121,7 +122,7 @@ namespace AnotherReplayReader.Utils
|
||||
Dictionary<int, HashSet<uint>> playerStrongOwnership,
|
||||
Dictionary<int, HashSet<uint>> playerWeakOwnership,
|
||||
Dictionary<int, HashSet<string>> playerTechChoices,
|
||||
Dictionary<int, HashSet<uint>> controlGroups)
|
||||
Dictionary<long, HashSet<uint>> controlGroups)
|
||||
{
|
||||
var player = command.PlayerIndex;
|
||||
var cmdId = command.CommandId;
|
||||
@@ -130,6 +131,10 @@ namespace AnotherReplayReader.Utils
|
||||
{
|
||||
// select unit(s): 0x1F5
|
||||
case 0x1F5:
|
||||
// 选择相同单位(W):ObjectId 语义与选择相同,作为弱所有权
|
||||
case 0x1F6:
|
||||
// 选择所有单位(Q):若能解析出 UnitId,同样作为弱所有权
|
||||
case 0x22A:
|
||||
RecordSelectUnit(time, command, player, unitFirstObserved, playerSelected, playerWeakOwnership);
|
||||
break;
|
||||
|
||||
@@ -460,7 +465,7 @@ namespace AnotherReplayReader.Utils
|
||||
int player,
|
||||
Dictionary<uint, TimeSpan> unitFirstObserved,
|
||||
Dictionary<int, HashSet<uint>> playerStrongOwnership,
|
||||
Dictionary<int, HashSet<uint>> controlGroups)
|
||||
Dictionary<long, HashSet<uint>> controlGroups)
|
||||
{
|
||||
// Data[0]: Int32 编队号;Data[1..]: 成员 ObjectId
|
||||
int? groupNumber = null;
|
||||
@@ -498,7 +503,7 @@ namespace AnotherReplayReader.Utils
|
||||
return;
|
||||
}
|
||||
var group = new HashSet<uint>(members);
|
||||
controlGroups[groupNumber.Value] = group;
|
||||
controlGroups[ControlGroupKey(player, groupNumber.Value)] = group;
|
||||
foreach (var id in members)
|
||||
{
|
||||
TryRecordFirstObserved(id, time, unitFirstObserved);
|
||||
@@ -512,7 +517,7 @@ namespace AnotherReplayReader.Utils
|
||||
int player,
|
||||
Dictionary<uint, TimeSpan> unitFirstObserved,
|
||||
Dictionary<int, HashSet<uint>> playerStrongOwnership,
|
||||
Dictionary<int, HashSet<uint>> controlGroups)
|
||||
Dictionary<long, HashSet<uint>> controlGroups)
|
||||
{
|
||||
foreach (var entry in command.Data)
|
||||
{
|
||||
@@ -529,7 +534,7 @@ namespace AnotherReplayReader.Utils
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (controlGroups.TryGetValue(groupNumber.Value, out var members))
|
||||
if (controlGroups.TryGetValue(ControlGroupKey(player, groupNumber.Value), out var members))
|
||||
{
|
||||
foreach (var id in members)
|
||||
{
|
||||
@@ -540,6 +545,9 @@ namespace AnotherReplayReader.Utils
|
||||
}
|
||||
}
|
||||
|
||||
private static long ControlGroupKey(int player, int group) =>
|
||||
((long)player << 32) | (uint)group;
|
||||
|
||||
private static void RecordTechChoice(
|
||||
TimeSpan time,
|
||||
CommandChunk command,
|
||||
|
||||
Reference in New Issue
Block a user