Skip to content

Commit

Permalink
foundation
Browse files Browse the repository at this point in the history
  • Loading branch information
eguneys committed Dec 29, 2023
1 parent 823947d commit 8cb0797
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/solitaire.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,11 @@ export class SolitairePlay extends Play {
scoreboard.score = _
}

make_solitaire_back(game, on_score).then(back_res => {
const on_new_game = (_: Settings) => {
title.settings = _
}

make_solitaire_back(game, on_score, on_new_game).then(back_res => {
game.back_res = back_res
game._collect_pov()
Sound.music('main')
Expand Down
5 changes: 4 additions & 1 deletion src/solitaire_back.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export type BackRes = {
}


export const make_solitaire_back = async (game: SolitaireGame, on_score: (_: number) => void): Promise<BackRes> => {
export const make_solitaire_back = async (game: SolitaireGame,
on_score: (_: number) => void,
on_new_game: (_: Settings) => void): Promise<BackRes> => {

let back = solitaire_back
let game_pov = await back.get_pov()
Expand Down Expand Up @@ -64,6 +66,7 @@ export const make_solitaire_back = async (game: SolitaireGame, on_score: (_: num
game.new_game()

back.get_pov().then(_ => on_score(_.score))
back.get_pov().then(_ => on_new_game(_.game.settings))
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/solitaire_game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,9 @@ export class SolitaireGame extends Play {


cant(cmd: IMoveType<SolitairePov, Solitaire>, data: any) {
if (cmd === WasteToTableu) {
if (cmd === FoundationToTableu) {
this._release_cancel_drag()
} else if (cmd === WasteToTableu) {
this._release_cancel_drag()
} else if (cmd === WasteToFoundation) {
this._release_cancel_drag()
Expand Down

0 comments on commit 8cb0797

Please sign in to comment.