Skip to content

Commit 7473af7

Browse files
committed
Logger: Yet another hopeful fix to the highlighting issue
1 parent 712cfc6 commit 7473af7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/games/logger.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ export class LoggerGame extends GameBase {
255255
}
256256
}
257257

258-
private getMode(move: string): "place"|"move"|"spawn"|"act" {
258+
public getMode(move: string): "place"|"move"|"spawn"|"act" {
259259
if (move === undefined) {
260260
move = "";
261261
}
@@ -675,6 +675,10 @@ export class LoggerGame extends GameBase {
675675

676676
// if all spawning is done, grow all the non-spawned trees
677677
if (this.highlights.length === 0) {
678+
if (spawn === undefined || spawn.length === 0) {
679+
this.interimMove += ";";
680+
}
681+
this.interimMove += ";";
678682
const spawned = decisions.map(([,p]) => p);
679683
const graph = new SquareOrthGraph(5,5);
680684
const [pcx, pcy] = graph.algebraic2coords(to);
@@ -963,7 +967,7 @@ export class LoggerGame extends GameBase {
963967
rep.annotations.push({type: "enter", targets: [{row: toY, col: toX}], colour: this.currplayer > 2 ? this.currplayer + 1 : this.currplayer});
964968
}
965969
}
966-
// only proactively show placement options for currplayer
970+
// only proactively show placement options for participants
967971
else if (perspective !== undefined && [...this.board.values()].find(pc => pc === `P${this.currplayer}`) === undefined) {
968972
if (! ("annotations" in rep)) {
969973
rep.annotations = [];
@@ -974,8 +978,8 @@ export class LoggerGame extends GameBase {
974978
rep.annotations!.push({type: "enter", targets: [{row: toY, col: toX}], colour: this.currplayer > 2 ? this.currplayer + 1 : this.currplayer});
975979
}
976980
}
977-
// only proactively show movement options for currplayer
978-
else if (perspective !== undefined && this.getMode(this.interimMove) === "move") {
981+
// only proactively show movement options for participants
982+
else if (perspective !== undefined && this.interimMove.length < 5) {
979983
if (! ("annotations" in rep)) {
980984
rep.annotations = [];
981985
}

0 commit comments

Comments
 (0)