diff --git a/src/renderer/components/PVLines.vue b/src/renderer/components/PVLines.vue index 1baefef..96efaa8 100644 --- a/src/renderer/components/PVLines.vue +++ b/src/renderer/components/PVLines.vue @@ -107,7 +107,9 @@ export default { if (this.active && this.PvE && !this.turn) { if (this.PvEValue === 'time') { if (this.enginetime === (this.PvEInput)) { - this.onClick(this.lines[0]) + if (this.lines[0] != null) { + this.onClick(this.lines[0]) + } } } else if (this.PvEValue === 'nodes') { if (this.enginetime === 60000) { diff --git a/src/renderer/components/PvESwitch.vue b/src/renderer/components/PvESwitch.vue index d50493e..81882da 100644 --- a/src/renderer/components/PvESwitch.vue +++ b/src/renderer/components/PvESwitch.vue @@ -20,9 +20,8 @@ export default { watch: { turn () { if (this.turn && this.PvE) { - this.$store.dispatch('stopEnginePvE') - } else if (!this.turn && this.PvE) { - this.$store.dispatch('restartEngine') + this.$store.dispatch('resetEngineData') + this.$store.commit('resetEngineTime') } } }, diff --git a/src/renderer/components/RoundedSwitch.vue b/src/renderer/components/RoundedSwitch.vue index 7d51dac..a413be1 100644 --- a/src/renderer/components/RoundedSwitch.vue +++ b/src/renderer/components/RoundedSwitch.vue @@ -20,8 +20,8 @@ export default { }, watch: { active () { - if ((this.active && !this.PvE) || (this.active && this.PvE && !this.turn)) { - this.$store.dispatch('restartEngine') + if (this.active && !this.turn && this.PvE) { + this.$store.dispatch('goEnginePvE') } } }, diff --git a/src/renderer/components/SettingsTab.vue b/src/renderer/components/SettingsTab.vue index 83bb8b0..85d0e42 100644 --- a/src/renderer/components/SettingsTab.vue +++ b/src/renderer/components/SettingsTab.vue @@ -126,8 +126,7 @@ v-model.number="PvEInput" type="number" :step="1" - :min="5" - :max="45" + :min="1" class="input" > @@ -179,7 +178,7 @@ export default { value: 'time', options: ['time', 'nodes', 'depth'], settingsName: 'Time in seconds', - PvEInput: 5 + PvEInput: 1 } }, computed: { @@ -204,7 +203,7 @@ export default { } else if (payload === 'time') { this.settingsName = 'Time in seconds' this.value = 'time' - this.PvEInput = 5 + this.PvEInput = 1 } else if (payload === 'depth') { this.PvEInput = 20 this.settingsName = 'depth of' @@ -236,7 +235,7 @@ export default { case 'time': this.$store.dispatch( 'setPvEParam', - 'go btime ' + this.PvEInput * 1000 + 'go movetime ' + this.PvEInput * 1000 ) this.$store.dispatch('setPvEInput', this.PvEInput * 1000) break diff --git a/src/renderer/store.js b/src/renderer/store.js index 86d93b9..fbd03d3 100644 --- a/src/renderer/store.js +++ b/src/renderer/store.js @@ -108,9 +108,9 @@ export const store = new Vuex.Store({ initialized: false, active: false, PvE: false, - PvEParam: 'go btime 5000', + PvEParam: 'go movetime 1000', PvEValue: 'time', - PvEInput: 5000, + PvEInput: 1000, turn: true, fen: 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1', lastFen: 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1', // to track the end of the current line @@ -612,7 +612,6 @@ export const store = new Vuex.Store({ goEnginePvE (context) { engine.send(context.getters.PvEParam) context.commit('setEngineClock') - context.commit('active', true) }, setActiveTrue (context) { context.commit('active', true) @@ -628,7 +627,12 @@ export const store = new Vuex.Store({ }, PvEfalse (context) { context.commit('PvE', false) - context.dispatch('stopEngine') + if (!context.getters.turn) { + context.dispatch('stopEngine') + } else { + context.commit('resetEngineTime') + context.commit('active', false) + } context.dispatch('resetEngineData') }, stopEngine (context) { @@ -643,7 +647,6 @@ export const store = new Vuex.Store({ context.dispatch('position') context.dispatch('goEngine') } else if (context.getters.active && context.getters.PvE && !context.getters.turn) { - context.dispatch('stopEngine') context.dispatch('position') context.dispatch('goEnginePvE') }