Skip to content

Commit

Permalink
Fix load game after new game logic
Browse files Browse the repository at this point in the history
  • Loading branch information
oskarrough committed Jun 20, 2020
1 parent 9f0bae0 commit e3ca255
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions public/ui/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ export default class App extends Component {
this.handlePlayerReward = this.handlePlayerReward.bind(this)
this.playCard = this.playCard.bind(this)

// Set up either a saved or new game.
// Set up a new game
const game = createNewGame()
this.game = game
this.state = game.state

// If there is a saved game state, use it.
const savedGame = window.location.hash && load()
if (savedGame) {
this.state = savedGame
} else {
const game = createNewGame()
this.game = game
this.state = game.state
}

// Enable debugging in the browser.
Expand Down

0 comments on commit e3ca255

Please sign in to comment.