Android: the engine button turns the engine off again
Some checks are pending
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run

The button kept toggleEngine as it was when the screen was first drawn, so it
saw the engine off forever; the function now reads the states when pressed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-23 01:10:10 +03:00
parent f8c2f11e46
commit cb61f546ba
2 changed files with 9 additions and 2 deletions

View file

@ -277,9 +277,12 @@ fun GameScreen(db: String, startPlace: Int, query: String, onBack: () -> Unit, o
go(n.id.toInt())
}
fun toggleEngine() {
// Read from the states now: the button may hold this function as it was when the
// screen was first drawn.
val ready = files.state.value == NetState.Ready
when {
engineWanted && engineReady -> engineVisit = null
engineReady -> engineVisit = app.visit
ready && engineVisit == app.visit -> engineVisit = null
ready -> engineVisit = app.visit
files.builtIn -> {
wantEngine = true
files.prepare()