Skip to content

Commit

Permalink
Fix march order line
Browse files Browse the repository at this point in the history
  • Loading branch information
gereon77 committed Feb 23, 2024
1 parent 65ff0a5 commit fe0f5dd
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions agot-bg-game-server/src/client/GameLogListComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default class GameLogListComponent extends Component<GameLogListComponent
</Col>}
<Col>
<div className="game-log-content">
{this.renderGameLogData(l.data, this.currentRound, i)}
{this.renderGameLogData(l.data, this.currentRound, i, l.time)}
</div>
</Col>
</Row>
Expand All @@ -172,7 +172,7 @@ export default class GameLogListComponent extends Component<GameLogListComponent
));
}

renderGameLogData(data: GameLogData, currentRound: number, currentLogIndex: number): ReactNode {
renderGameLogData(data: GameLogData, currentRound: number, currentLogIndex: number, logTime: Date): ReactNode {
switch (data.type) {
case "player-action": {
const house = this.game.houses.get(data.house);
Expand Down Expand Up @@ -243,12 +243,21 @@ export default class GameLogListComponent extends Component<GameLogListComponent
const army = data.units.map(utid => unitTypes.get(utid));
const orderImgUrl = data.orderType ? orderImages.get(data.orderType) : null;

const showDottedLine = this.logManager.logs[currentLogIndex - 1]?.data.type != "march-resolved";
const previousLog = this.logManager.logs[currentLogIndex - 1];
let showDottedLine = true;

if (previousLog.data.type == "action-phase-resolve-march-began") {
showDottedLine = false;
} else if (previousLog.data.type == "march-resolved") {
if (previousLog.data.house == data.attacker && (logTime.getTime() - previousLog.time.getTime()) <= 100) {
showDottedLine = false;
}
}

return (
<Row className="align-items-center">
{showDottedLine && <Col xs="12">
<hr style={{ borderTop: "dotted 3px" }} />
<hr style={{ borderTop: "dotted 1px", color: "grey" }} />
</Col>}
{orderImgUrl && <Col xs="auto">
<img src={orderImgUrl} width="42px"/>
Expand Down

0 comments on commit fe0f5dd

Please sign in to comment.