fix(wasm): rebuild pkg with take_from_foundation fix (closes #36)
Build and Deploy / build-and-push (push) Failing after 4m31s
Build and Deploy / build-and-push (push) Failing after 4m31s
The binary in pkg/ was built on May 18, predating commit 3322fd4
(fix(wasm): enable take-from-foundation in web game client, May 19).
Dragging Foundation cards to Tableau was silently rejected because
take_from_foundation was false in the stale binary.
Rebuilt with ./build_wasm.sh against current solitaire_core.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
/* @ts-self-types="./solitaire_wasm.d.ts" */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Browser-side replay state machine. Owns a live `GameState` and the
|
* Browser-side replay state machine. Owns a live `GameState` and the
|
||||||
* replay's move list; each `step()` applies the next move.
|
* replay's move list; each `step()` applies the next move.
|
||||||
@@ -94,6 +92,12 @@ if (Symbol.dispose) ReplayPlayer.prototype[Symbol.dispose] = ReplayPlayer.protot
|
|||||||
* full pile snapshot at any time without mutating state.
|
* full pile snapshot at any time without mutating state.
|
||||||
*/
|
*/
|
||||||
export class SolitaireGame {
|
export class SolitaireGame {
|
||||||
|
static __wrap(ptr) {
|
||||||
|
const obj = Object.create(SolitaireGame.prototype);
|
||||||
|
obj.__wbg_ptr = ptr;
|
||||||
|
SolitaireGameFinalization.register(obj, obj.__wbg_ptr, obj);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
__destroy_into_raw() {
|
__destroy_into_raw() {
|
||||||
const ptr = this.__wbg_ptr;
|
const ptr = this.__wbg_ptr;
|
||||||
this.__wbg_ptr = 0;
|
this.__wbg_ptr = 0;
|
||||||
@@ -125,6 +129,23 @@ export class SolitaireGame {
|
|||||||
const ret = wasm.solitairegame_draw(this.__wbg_ptr);
|
const ret = wasm.solitairegame_draw(this.__wbg_ptr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Restore a game from a JSON string previously produced by [`SolitaireGame::serialize`].
|
||||||
|
*
|
||||||
|
* Returns an error string if the JSON is malformed or describes a state
|
||||||
|
* that can't be deserialised (e.g. from a future schema version).
|
||||||
|
* @param {string} json
|
||||||
|
* @returns {SolitaireGame}
|
||||||
|
*/
|
||||||
|
static from_saved(json) {
|
||||||
|
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||||
|
const len0 = WASM_VECTOR_LEN;
|
||||||
|
const ret = wasm.solitairegame_from_saved(ptr0, len0);
|
||||||
|
if (ret[2]) {
|
||||||
|
throw takeFromExternrefTable0(ret[1]);
|
||||||
|
}
|
||||||
|
return SolitaireGame.__wrap(ret[0]);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Move `count` cards from pile `from` to pile `to`.
|
* Move `count` cards from pile `from` to pile `to`.
|
||||||
*
|
*
|
||||||
@@ -167,6 +188,31 @@ export class SolitaireGame {
|
|||||||
const ret = wasm.solitairegame_seed(this.__wbg_ptr);
|
const ret = wasm.solitairegame_seed(this.__wbg_ptr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Serialise the full game state as a JSON string for `localStorage`.
|
||||||
|
*
|
||||||
|
* Use [`SolitaireGame::from_saved`] to restore it. The returned string is
|
||||||
|
* opaque — callers should treat it as a blob and store/restore it verbatim.
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
serialize() {
|
||||||
|
let deferred2_0;
|
||||||
|
let deferred2_1;
|
||||||
|
try {
|
||||||
|
const ret = wasm.solitairegame_serialize(this.__wbg_ptr);
|
||||||
|
var ptr1 = ret[0];
|
||||||
|
var len1 = ret[1];
|
||||||
|
if (ret[3]) {
|
||||||
|
ptr1 = 0; len1 = 0;
|
||||||
|
throw takeFromExternrefTable0(ret[2]);
|
||||||
|
}
|
||||||
|
deferred2_0 = ptr1;
|
||||||
|
deferred2_1 = len1;
|
||||||
|
return getStringFromWasm0(ptr1, len1);
|
||||||
|
} finally {
|
||||||
|
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Full pile snapshot as a JS object.
|
* Full pile snapshot as a JS object.
|
||||||
*
|
*
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user