Skip to content

Commit

Permalink
fix player position reducer
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Reder committed Feb 18, 2020
1 parent 49655b0 commit 211b622
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/renderer/reducers/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ export const connection = (state: ConnectionState = initialState.connection, act
case ConnectionActionType.UPDATE_PLAYER_POSITIONS:
draft.selfPos = action.self
draft.cameraAngle = action.cameraAngle
if (!draft.server) return
if (!draft.server.players) return
for (let i = 0; i < action.positions.length; i++) {
const position = action.positions[i]
if (!position) continue
if (!draft.server) return
if (!draft.server.players) return
if (!draft.server.players[i + 1]) return
if (!draft.server.players[i + 1]) continue
const prevCourse = draft.server.players[i + 1]!.position != null ? draft.server.players[i + 1]!.position!.course : 0
draft.server.players[i + 1]!.position = position
if (draft.server.players[i + 1]!.position!.course === 0) {
Expand Down

0 comments on commit 211b622

Please sign in to comment.