Skip to content

Commit

Permalink
fix custom engines not running, set standard PvE time Parameter to 1 …
Browse files Browse the repository at this point in the history
…second
  • Loading branch information
goekaykaraahmetli committed Feb 22, 2022
1 parent acbd326 commit ab06261
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
4 changes: 3 additions & 1 deletion src/renderer/components/PVLines.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 2 additions & 3 deletions src/renderer/components/PvESwitch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/RoundedSwitch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
}
},
Expand Down
9 changes: 4 additions & 5 deletions src/renderer/components/SettingsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@
v-model.number="PvEInput"
type="number"
:step="1"
:min="5"
:max="45"
:min="1"
class="input"
>
</td>
Expand Down Expand Up @@ -179,7 +178,7 @@ export default {
value: 'time',
options: ['time', 'nodes', 'depth'],
settingsName: 'Time in seconds',
PvEInput: 5
PvEInput: 1
}
},
computed: {
Expand All @@ -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'
Expand Down Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions src/renderer/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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) {
Expand All @@ -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')
}
Expand Down

0 comments on commit ab06261

Please sign in to comment.