mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-30 20:34:27 +01:00
Renamed some methods
This commit is contained in:
parent
038910e5df
commit
59fac223f4
8 changed files with 18 additions and 18 deletions
|
@ -26,7 +26,7 @@ INIT_LOGGER(game, Command);
|
|||
|
||||
|
||||
Command::Command()
|
||||
: m_executed(false), m_autoExecution(true)
|
||||
: m_executed(false), m_humanIndependent(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -63,15 +63,15 @@ class Command
|
|||
bool isExecuted() const { return m_executed; }
|
||||
|
||||
/**
|
||||
* Mark the command as auto-executable, which means that it will
|
||||
* Mark the command as human independent, which means that it will
|
||||
* be automatically executed if the commands history is cleared
|
||||
* just before this command.
|
||||
* Auto-executable commands correspond to commands for AI players,
|
||||
* for which the user cannot change the behaviour.
|
||||
* It is mostly useful in FreeGame mode, where a turn played by an AI
|
||||
* player should be re-executed, because the user cannot control it.
|
||||
*/
|
||||
void setAutoExecution(bool autoExec) { m_autoExecution = autoExec; }
|
||||
/// Return true if the command is auto-executable
|
||||
virtual bool isAutoExecution() const { return m_autoExecution; }
|
||||
void setHumanIndependent(bool humanIndependent) { m_humanIndependent = humanIndependent; }
|
||||
/// Return true if the command is human independent
|
||||
virtual bool isHumanIndependent() const { return m_humanIndependent; }
|
||||
|
||||
/**
|
||||
* Description of the command, for debugging purposes
|
||||
|
@ -84,7 +84,7 @@ class Command
|
|||
|
||||
private:
|
||||
bool m_executed;
|
||||
bool m_autoExecution;
|
||||
bool m_humanIndependent;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -194,11 +194,11 @@ void Duplicate::recordPlayerMove(const Move &iMove, Player &ioPlayer, bool isFor
|
|||
{
|
||||
LOG_INFO("Player " << ioPlayer.getId() << " plays: " << lfw(iMove.toString()));
|
||||
Command *pCmd = new PlayerMoveCmd(ioPlayer, iMove);
|
||||
pCmd->setAutoExecution(!isForHuman);
|
||||
pCmd->setHumanIndependent(!isForHuman);
|
||||
accessNavigation().addAndExecute(pCmd);
|
||||
|
||||
Command *pCmd2 = new MarkPlayedCmd(*this, ioPlayer.getId(), true);
|
||||
pCmd2->setAutoExecution(!isForHuman);
|
||||
pCmd2->setHumanIndependent(!isForHuman);
|
||||
accessNavigation().addAndExecute(pCmd2);
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ void FreeGame::recordPlayerMove(const Move &iMove, Player &ioPlayer,
|
|||
{
|
||||
LOG_INFO("Player " << ioPlayer.getId() << " plays: " << lfw(iMove.toString()));
|
||||
Command *pCmd = new PlayerMoveCmd(ioPlayer, iMove);
|
||||
pCmd->setAutoExecution(!isForHuman);
|
||||
pCmd->setHumanIndependent(!isForHuman);
|
||||
accessNavigation().addAndExecute(pCmd);
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ void Navigation::clearFuture()
|
|||
|
||||
// Replay the auto-execution turns
|
||||
// (i.e. turns where only the AI was involved)
|
||||
while (!isLastTurn() && m_turnCommands[m_currTurn]->isAutoExecution())
|
||||
while (!isLastTurn() && m_turnCommands[m_currTurn]->isHumanIndependent())
|
||||
nextTurn();
|
||||
|
||||
// When there is no future, don't do anything
|
||||
|
|
|
@ -62,7 +62,7 @@ void Training::setRackRandom(bool iCheck, set_rack_mode mode)
|
|||
const PlayedRack &newRack =
|
||||
helperSetRackRandom(getCurrentPlayer().getCurrentRack(), iCheck, mode);
|
||||
Command *pCmd = new PlayerRackCmd(*m_players[m_currPlayer], newRack);
|
||||
pCmd->setAutoExecution(false);
|
||||
pCmd->setHumanIndependent(false);
|
||||
accessNavigation().addAndExecute(pCmd);
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ void Training::setRackManual(bool iCheck, const wstring &iLetters)
|
|||
upperLetters.begin(), towupper);
|
||||
const PlayedRack &newRack = helperSetRackManual(iCheck, upperLetters);
|
||||
Command *pCmd = new PlayerRackCmd(*m_players[m_currPlayer], newRack);
|
||||
pCmd->setAutoExecution(false);
|
||||
pCmd->setHumanIndependent(false);
|
||||
accessNavigation().addAndExecute(pCmd);
|
||||
// Clear the results if everything went well
|
||||
m_results.clear();
|
||||
|
@ -116,7 +116,7 @@ void Training::recordPlayerMove(const Move &iMove, Player &ioPlayer)
|
|||
// (called in this class in endTurn()).
|
||||
// See the big comment in game.cpp, line 96
|
||||
Command *pCmd = new PlayerMoveCmd(ioPlayer, iMove);
|
||||
pCmd->setAutoExecution(false);
|
||||
pCmd->setHumanIndependent(false);
|
||||
accessNavigation().addAndExecute(pCmd);
|
||||
}
|
||||
|
||||
|
|
|
@ -72,11 +72,11 @@ void TurnCmd::doUndo()
|
|||
}
|
||||
|
||||
|
||||
bool TurnCmd::isAutoExecution() const
|
||||
bool TurnCmd::isHumanIndependent() const
|
||||
{
|
||||
BOOST_FOREACH(Command *cmd, m_commands)
|
||||
{
|
||||
if (!cmd->isAutoExecution())
|
||||
if (!cmd->isHumanIndependent())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -51,7 +51,7 @@ class TurnCmd: public Command
|
|||
|
||||
const vector<Command *> & getCommands() const { return m_commands; }
|
||||
|
||||
virtual bool isAutoExecution() const;
|
||||
virtual bool isHumanIndependent() const;
|
||||
|
||||
virtual wstring toString() const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue