Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f6e7de1093 | |||
| b5a780ddf4 | |||
| 3322fd4250 |
@@ -20,4 +20,4 @@ resources:
|
||||
images:
|
||||
- name: solitaire-server
|
||||
newName: git.aleshym.co/funman300/solitaire-server
|
||||
newTag: ea9dd848
|
||||
newTag: 90eb5fd2
|
||||
|
||||
@@ -193,7 +193,7 @@ impl GameState {
|
||||
is_auto_completable: false,
|
||||
undo_count: 0,
|
||||
recycle_count: 0,
|
||||
take_from_foundation: false,
|
||||
take_from_foundation: true,
|
||||
schema_version: GAME_STATE_SCHEMA_VERSION,
|
||||
undo_stack: VecDeque::new(),
|
||||
}
|
||||
@@ -1408,9 +1408,9 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn take_from_foundation_disabled_by_default() {
|
||||
fn take_from_foundation_enabled_by_default() {
|
||||
let g = setup_take_from_foundation_game();
|
||||
assert!(!g.take_from_foundation, "take_from_foundation is off by default (non-standard rule)");
|
||||
assert!(g.take_from_foundation, "take_from_foundation is on by default (standard Klondike rule)");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -437,7 +437,12 @@ impl SolitaireGame {
|
||||
/// that can't be deserialised (e.g. from a future schema version).
|
||||
pub fn from_saved(json: &str) -> Result<SolitaireGame, JsValue> {
|
||||
serde_json::from_str::<GameState>(json)
|
||||
.map(|game| SolitaireGame { game })
|
||||
.map(|mut game| {
|
||||
// Older saves serialised with take_from_foundation=false (the core default).
|
||||
// The web client has no settings layer, so enforce the standard rule here.
|
||||
game.take_from_foundation = true;
|
||||
SolitaireGame { game }
|
||||
})
|
||||
.map_err(|e| JsValue::from_str(&e.to_string()))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user