Skip to content

Commit

Permalink
rename aux => plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
brollin committed Apr 9, 2024
1 parent a5558c1 commit 10b0d24
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions ui/analyse/src/ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ export default class AnalyseCtrl {
}
site.pubsub.emit('ply', this.node.ply, this.tree.lastMainlineNode(this.path).ply === this.node.ply);
this.showGround();
this.auxUpdate(this.node.fen);
this.pluginUpdate(this.node.fen);
}

userJump = (path: Tree.Path): void => {
Expand Down Expand Up @@ -592,7 +592,7 @@ export default class AnalyseCtrl {
this.tree.addDests(dests, path);
if (path === this.path) {
this.showGround();
this.auxUpdate(this.node.fen);
this.pluginUpdate(this.node.fen);
if (this.outcome()) this.ceval.stop();
}
this.withCg(cg => cg.playPremove());
Expand Down Expand Up @@ -993,14 +993,14 @@ export default class AnalyseCtrl {
else if (plyDelta < -1) control.first(this);
};

auxMove = (orig: cg.Key, dest: cg.Key, prom: cg.Role | undefined) => {
pluginMove = (orig: cg.Key, dest: cg.Key, prom: cg.Role | undefined) => {
const capture = this.chessground.state.pieces.get(dest);
this.sendMove(orig, dest, capture, prom);
};

auxUpdate = (fen: string) => {
pluginUpdate = (fen: string) => {
// if controller and chessground board state differ, ignore this update. once the chessground
// state is updated to match, auxUpdate will be called again.
// state is updated to match, pluginUpdate will be called again.
if (!fen.startsWith(this.chessground?.getFen())) return;

this.keyboardMove?.update({ fen, canMove: true });
Expand Down
2 changes: 1 addition & 1 deletion ui/chess/src/moveRootCtrl.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as cg from 'chessground/types';

export interface MoveRootCtrl {
auxMove: (orig: cg.Key, dest: cg.Key, prom: cg.Role | undefined) => void;
pluginMove: (orig: cg.Key, dest: cg.Key, prom: cg.Role | undefined) => void;
redraw: () => void;
flipNow: () => void;
offerDraw?: (v: boolean, immediately?: boolean) => void;
Expand Down
2 changes: 1 addition & 1 deletion ui/keyboardMove/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function ctrl(root: KeyboardMoveRootCtrl): KeyboardMove {
if (!role || role == 'pawn' || (role == 'king' && variant !== 'antichess')) return;
cg.cancelMove();
promote(cg, dest, role);
root.auxMove(orig, dest, role);
root.pluginMove(orig, dest, role);
},
update(up: MoveUpdate) {
if (up.cg) cg = up.cg;
Expand Down
10 changes: 5 additions & 5 deletions ui/puzzle/src/ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default class PuzzleCtrl implements ParentCtrl {
game: { variant: { key: 'standard' } },
player: { color: this.pov },
},
auxMove: this.auxMove,
pluginMove: this.pluginMove,
redraw: this.redraw,
flipNow: this.flip,
userJumpPlyDelta: this.userJumpPlyDelta,
Expand Down Expand Up @@ -251,7 +251,7 @@ export default class PuzzleCtrl implements ParentCtrl {

showGround = (g: CgApi): void => g.set(this.makeCgOpts());

auxMove = (orig: Key, dest: Key, role?: Role) => {
pluginMove = (orig: Key, dest: Key, role?: Role) => {
if (role) this.playUserMove(orig, dest, role);
else
this.withGround(g => {
Expand All @@ -261,7 +261,7 @@ export default class PuzzleCtrl implements ParentCtrl {
});
};

auxUpdate = (fen: string): void => {
pluginUpdate = (fen: string): void => {
this.voiceMove?.update({ fen, canMove: true });
this.keyboardMove?.update({ fen, canMove: true });
};
Expand All @@ -272,7 +272,7 @@ export default class PuzzleCtrl implements ParentCtrl {
!this.promotion.start(orig, dest, { submit: this.playUserMove, show: this.voiceMove?.promotionHook() })
)
this.playUserMove(orig, dest);
this.auxUpdate(this.node.fen);
this.pluginUpdate(this.node.fen);
};

playUci = (uci: Uci): void => this.sendMove(parseUci(uci)!);
Expand Down Expand Up @@ -539,7 +539,7 @@ export default class PuzzleCtrl implements ParentCtrl {
this.promotion.cancel();
this.justPlayed = undefined;
this.autoScrollRequested = true;
this.auxUpdate(this.node.fen);
this.pluginUpdate(this.node.fen);
site.pubsub.emit('ply', this.node.ply);
};

Expand Down
10 changes: 5 additions & 5 deletions ui/round/src/ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export default class RoundController implements MoveRootCtrl {
this.chessground.set(config);
if (s.san && isForwardStep) site.sound.move(s);
this.autoScroll();
this.auxUpdate(s.fen);
this.pluginUpdate(s.fen);
site.pubsub.emit('ply', ply);
return true;
};
Expand Down Expand Up @@ -335,7 +335,7 @@ export default class RoundController implements MoveRootCtrl {
this.redraw();
};

auxMove = (orig: cg.Key, dest: cg.Key, role?: cg.Role) => {
pluginMove = (orig: cg.Key, dest: cg.Key, role?: cg.Role) => {
if (!role) {
this.chessground.move(orig, dest);
// TODO look into possibility of making cg.Api.move function update player turn itself.
Expand All @@ -347,7 +347,7 @@ export default class RoundController implements MoveRootCtrl {
this.sendMove(orig, dest, role, { premove: false });
};

auxUpdate = (fen: string) => {
pluginUpdate = (fen: string) => {
this.voiceMove?.update({ fen, canMove: this.canMove() });
this.keyboardMove?.update({ fen, canMove: this.canMove() });
};
Expand Down Expand Up @@ -501,7 +501,7 @@ export default class RoundController implements MoveRootCtrl {
}
this.autoScroll();
this.onChange();
this.auxUpdate(step.fen);
this.pluginUpdate(step.fen);
site.sound.move({ ...o, filter: 'music' });
site.sound.saySan(step.san);
return true; // prevents default socket pubsub
Expand Down Expand Up @@ -539,7 +539,7 @@ export default class RoundController implements MoveRootCtrl {
this.autoScroll();
this.onChange();
this.setLoading(false);
this.auxUpdate(d.steps[d.steps.length - 1].fen);
this.pluginUpdate(d.steps[d.steps.length - 1].fen);
};

endWithData = (o: ApiEnd): void => {
Expand Down
2 changes: 1 addition & 1 deletion ui/voice/src/move/moveCtrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ export function initModule(opts: { root: MoveRootCtrl; ui: VoiceCtrl; initial: M
const role = cs.promo(uci) as cs.Role;
cg.cancelMove();
if (role) promote(cg, dest(uci), role);
root.auxMove(src(uci), dest(uci), role);
root.pluginMove(src(uci), dest(uci), role);
return true;
}

Expand Down

0 comments on commit 10b0d24

Please sign in to comment.