Skip to content

Commit

Permalink
Fix missing builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliveriver committed Sep 17, 2024
1 parent 60a7c72 commit 071f94c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions server/Adjudication/Execution/Executor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ private Board AdvanceMinorBoard(Board previousBoard)

var localOrders = world.Orders.Where(o => previousBoard.Contains(o.Location));

var builds = localOrders.OfType<Build>();
var builds = localOrders.OfType<Build>().Where(b => b.Status == OrderStatus.Success);
var disbands = localOrders.OfType<Disband>();

var units = previousBoard.Units
.Where(u =>
!disbands.Any(d => d.Unit == u && d.Status == OrderStatus.Success)
&& !builds.Any(b => b.Unit == u && b.Status != OrderStatus.Success))
.Concat(builds.Select(b => b.Unit))
.Where(u => !disbands.Any(d => d.Location == u.Location && d.Status == OrderStatus.Success))
.Distinct()
.Select(u => u.Clone())
.ToList();

Expand Down
1 change: 0 additions & 1 deletion server/Tests/Extensions/BoardExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public static Build Build(this Board board, Nation owner, UnitType type, string
Unit = unit,
};

board.Units.Add(unit);
world.Orders.Add(build);
return build;
}
Expand Down

0 comments on commit 071f94c

Please sign in to comment.