mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-18 10:26:15 +01:00
When navigating in the history, display the current turn in the status bar
This commit is contained in:
parent
fb4ea0e559
commit
a79b71f028
3 changed files with 32 additions and 1 deletions
|
@ -60,6 +60,24 @@ void Navigation::addAndExecute(Command *iCmd)
|
|||
}
|
||||
|
||||
|
||||
unsigned int Navigation::getCurrTurn() const
|
||||
{
|
||||
unsigned int currTurn = m_currTurn;
|
||||
if (isLastTurn() && m_turnCommands.back()->isEmpty())
|
||||
--currTurn;
|
||||
return currTurn;
|
||||
}
|
||||
|
||||
|
||||
unsigned int Navigation::getNbTurns() const
|
||||
{
|
||||
unsigned int count = m_turnCommands.size();
|
||||
if (m_turnCommands.back()->isEmpty())
|
||||
--count;
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
bool Navigation::isFirstTurn() const
|
||||
{
|
||||
return m_currTurn == 1 ||
|
||||
|
|
|
@ -38,7 +38,8 @@ class Navigation
|
|||
void newTurn();
|
||||
void addAndExecute(Command *iCmd);
|
||||
|
||||
unsigned int getCurrTurn() const { return m_currTurn; }
|
||||
unsigned int getCurrTurn() const;
|
||||
unsigned int getNbTurns() const;
|
||||
bool isFirstTurn() const;
|
||||
bool isLastTurn() const;
|
||||
|
||||
|
|
|
@ -789,6 +789,9 @@ void MainWindow::onHistoryFirstTurn()
|
|||
|
||||
m_game->accessNavigation().firstTurn();
|
||||
emit gameUpdated();
|
||||
unsigned int currTurn = m_game->getNavigation().getCurrTurn();
|
||||
unsigned int nbTurns = m_game->getNavigation().getNbTurns();
|
||||
displayInfoMsg(_q("Turn %1/%2").arg(currTurn).arg(nbTurns));
|
||||
}
|
||||
|
||||
|
||||
|
@ -799,6 +802,9 @@ void MainWindow::onHistoryPrevTurn()
|
|||
|
||||
m_game->accessNavigation().prevTurn();
|
||||
emit gameUpdated();
|
||||
unsigned int currTurn = m_game->getNavigation().getCurrTurn();
|
||||
unsigned int nbTurns = m_game->getNavigation().getNbTurns();
|
||||
displayInfoMsg(_q("Turn %1/%2").arg(currTurn).arg(nbTurns));
|
||||
}
|
||||
|
||||
|
||||
|
@ -809,6 +815,9 @@ void MainWindow::onHistoryNextTurn()
|
|||
|
||||
m_game->accessNavigation().nextTurn();
|
||||
emit gameUpdated();
|
||||
unsigned int currTurn = m_game->getNavigation().getCurrTurn();
|
||||
unsigned int nbTurns = m_game->getNavigation().getNbTurns();
|
||||
displayInfoMsg(_q("Turn %1/%2").arg(currTurn).arg(nbTurns));
|
||||
}
|
||||
|
||||
|
||||
|
@ -819,6 +828,9 @@ void MainWindow::onHistoryLastTurn()
|
|||
|
||||
m_game->accessNavigation().lastTurn();
|
||||
emit gameUpdated();
|
||||
unsigned int currTurn = m_game->getNavigation().getCurrTurn();
|
||||
unsigned int nbTurns = m_game->getNavigation().getNbTurns();
|
||||
displayInfoMsg(_q("Turn %1/%2").arg(currTurn).arg(nbTurns));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue