mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-17 06:11:49 +01:00
- When displaying an old turn, do not allow playing
- Turns start at 0 instead of 1, to indicate that nothing was played on the first turn
This commit is contained in:
parent
06dd7dff71
commit
81b44a8050
3 changed files with 16 additions and 5 deletions
|
@ -65,7 +65,7 @@ unsigned int Navigation::getCurrTurn() const
|
|||
unsigned int currTurn = m_currTurn;
|
||||
if (isLastTurn() && m_turnCommands.back()->isEmpty())
|
||||
--currTurn;
|
||||
return currTurn;
|
||||
return currTurn - 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,7 +74,7 @@ unsigned int Navigation::getNbTurns() const
|
|||
unsigned int count = m_turnCommands.size();
|
||||
if (m_turnCommands.back()->isEmpty())
|
||||
--count;
|
||||
return count;
|
||||
return count - 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -134,9 +134,18 @@ void PlayerWidget::refresh()
|
|||
lineEditCoords->clear();
|
||||
lineEditChange->clear();
|
||||
|
||||
// Do not allow messing with AI players or with players who already played
|
||||
setEnabled(!m_game->hasPlayed(m_player) &&
|
||||
m_game->getPlayer(m_player).isHuman());
|
||||
if (!m_game->isLastTurn())
|
||||
{
|
||||
// Do not allow entering a move when displaying an old turn
|
||||
setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do not allow messing with AI players or with players
|
||||
// who already played
|
||||
setEnabled(!m_game->hasPlayed(m_player) &&
|
||||
m_game->getPlayer(m_player).isHuman());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -117,6 +117,8 @@ void TrainingWidget::refresh()
|
|||
pushButtonComplement->setEnabled(true);
|
||||
pushButtonSearch->setEnabled(m_model->rowCount() == 0 &&
|
||||
lineEditRack->text() != "");
|
||||
// Do not allow entering a move when displaying an old turn
|
||||
setEnabled(m_game->isLastTurn());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue