Skip to content

Commit

Permalink
fix(debug): Use local reducer in Log rewind
Browse files Browse the repository at this point in the history
For multiplayer clients, the client reducer won’t run events, which 
means rewinding/rebuilding state will fail as events will never be 
processed. This creates an independent reducer that doesn’t have 
`isClient` set to true that will run everything locally even for 
multiplayer clients.
  • Loading branch information
delucis committed Oct 7, 2020
1 parent 5a18920 commit 600caa8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/client/debug/log/Log.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
const { secondaryPane } = getContext('secondaryPane');
import { MAKE_MOVE } from '../../../core/action-types';
import { CreateGameReducer } from '../../../core/reducer';
import TurnMarker from './TurnMarker.svelte';
import PhaseMarker from './PhaseMarker.svelte';
import LogEvent from './LogEvent.svelte';
import MCTS from '../mcts/MCTS.svelte';
const reducer = CreateGameReducer({ game: client.game });
const initialState = client.getInitialState();
let { log } = $client;
let pinned = null;
Expand All @@ -21,7 +23,7 @@
const { action, automatic } = log[i];
if (!automatic) {
state = client.reducer(state, action);
state = reducer(state, action);
}
if (action.type == MAKE_MOVE) {
Expand Down

0 comments on commit 600caa8

Please sign in to comment.