Skip to content

Commit

Permalink
Merge pull request #1826 from gereon77/fix-game-log
Browse files Browse the repository at this point in the history
Fix march order line
  • Loading branch information
gereon77 authored Feb 23, 2024
2 parents 65ff0a5 + fe0f5dd commit 1ef12d3
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 1ef12d3

Please sign in to comment.