Skip to content

Commit

Permalink
Get rid of additionalOffset in assignDeterministicUnitNames. The …
Browse files Browse the repository at this point in the history
…offset is incremented for each call of `assignName`.

GitOrigin-RevId: 8c12e065d15c4b3bfc2e89d048b6626727bc35ac
  • Loading branch information
cpojer committed Sep 13, 2024
1 parent 7621a57 commit ab2b331
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions athena/lib/assignDeterministicUnitNames.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default function assignDeterministicUnitNames(
const assignName = <T extends Unit | TransportedUnit>(
unit: T,
vector: Vector,
additionalOffset: number = 0,
): T => {
if (!unit.hasName()) {
const isLeader = unit.player > 0 && !hasLeader(unit.player, unit.info);
Expand All @@ -25,7 +24,6 @@ export default function assignDeterministicUnitNames(
unit.info,
offset++,
);
offset += additionalOffset;
if (isLeader) {
addLeader(unit.player, unit.info);
}
Expand All @@ -34,9 +32,7 @@ export default function assignDeterministicUnitNames(

if (unit.transports?.length) {
unit = unit.copy({
transports: unit.transports.map((unit, index) =>
assignName(unit, vector, index + 1),
),
transports: unit.transports.map((unit) => assignName(unit, vector)),
}) as T;
}

Expand Down

0 comments on commit ab2b331

Please sign in to comment.