diff options
author | pommicket <pommicket@gmail.com> | 2025-08-12 23:04:05 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2025-08-12 23:04:05 -0400 |
commit | e43c01bd11560561daa771463c57442c3b8a761d (patch) | |
tree | a040ea23eaf10d8a7362f523777a8b61e8b55041 /quacker/quacker.cpp | |
parent | a1a21037c465a1a01b2ca13b70f89becfc93546e (diff) |
Integrate Macondo into move chooser
Diffstat (limited to 'quacker/quacker.cpp')
-rw-r--r-- | quacker/quacker.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/quacker/quacker.cpp b/quacker/quacker.cpp index c386968..6bb25fc 100644 --- a/quacker/quacker.cpp +++ b/quacker/quacker.cpp @@ -619,18 +619,21 @@ void TopLevel::updatePositionViews() updateListerDialogWithRack(); } -void TopLevel::updateMoveViews() +void TopLevel::updateMoveViews(const Quackle::MoveList *providedList) { - if (m_simulator->hasSimulationResults()) + Quackle::MoveList list; + if (providedList) { + list = *providedList; + } + else if (m_simulator->hasSimulationResults()) { - const Quackle::MoveList& moveList = m_simulator->moves(/* prune */ true, /* sort by win */ true); - emit movesChanged(&moveList); + list = m_simulator->moves(/* prune */ true, /* sort by win */ true); } else { - const Quackle::MoveList moveList = m_game->currentPosition().moves(); - emit movesChanged(&moveList); + list = m_game->currentPosition().moves(); } + emit movesChanged(&list); m_simulateAction->setEnabled(!m_game->currentPosition().moves().empty()); m_simulateDetailsAction->setEnabled(!m_game->currentPosition().moves().empty()); @@ -1067,6 +1070,15 @@ void TopLevel::simulateToggled(bool startSimulation) if (!m_game->hasPositions()) return; + if (m_macondo->useForSimulation()) { + if (startSimulation) { + m_macondo->simulate(); + } else { + m_macondo->stop(); + } + return; + } + simulate(startSimulation); if (startSimulation) @@ -2003,7 +2015,9 @@ void TopLevel::createWidgets() m_history = new History; plugIntoHistoryMatrix(m_history); - m_macondo = new Macondo(m_game); + m_macondo = new Macondo(m_game, m_moveBox); + plugIntoMatrix(m_macondo); + connect(m_macondo, SIGNAL(newMoves(const Quackle::MoveList *)), this, SLOT(updateMoveViews(const Quackle::MoveList *))); m_tabWidget = new QTabWidget; m_tabWidget->addTab(m_history, tr("Histor&y")); |