Renamed some methods

This commit is contained in:
Olivier Teulière 2012-02-19 16:23:58 +01:00
parent 038910e5df
commit 59fac223f4
8 changed files with 18 additions and 18 deletions

View file

@ -26,7 +26,7 @@ INIT_LOGGER(game, Command);
Command::Command()
: m_executed(false), m_autoExecution(true)
: m_executed(false), m_humanIndependent(true)
{
}

View file

@ -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

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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

View file

@ -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);
}

View file

@ -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;

View file

@ -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;