mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2024-12-25 21:59:30 +01:00
Topping: do not assign an empty move to the player immediately.
It is now done only after a timeout, to avoid the need to replace this empty move when the player finds a top move.
This commit is contained in:
parent
086b597f3e
commit
89b5f757ca
5 changed files with 18 additions and 19 deletions
|
@ -51,7 +51,7 @@ void Arbitration::setRackRandom()
|
||||||
|
|
||||||
const PlayedRack &newRack =
|
const PlayedRack &newRack =
|
||||||
helperSetRackRandom(getHistory().getCurrentRack(), true, RACK_NEW);
|
helperSetRackRandom(getHistory().getCurrentRack(), true, RACK_NEW);
|
||||||
setGameAndPlayersRack(newRack);
|
setGameAndPlayersRack(newRack, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ void Arbitration::setRackManual(const wstring &iLetters)
|
||||||
// As a result, we simply make all the letters uppercase
|
// As a result, we simply make all the letters uppercase
|
||||||
const wstring &upperLetters = toUpper(iLetters);
|
const wstring &upperLetters = toUpper(iLetters);
|
||||||
const PlayedRack &newRack = helperSetRackManual(false, upperLetters);
|
const PlayedRack &newRack = helperSetRackManual(false, upperLetters);
|
||||||
setGameAndPlayersRack(newRack);
|
setGameAndPlayersRack(newRack, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -132,12 +132,12 @@ void Duplicate::start()
|
||||||
|
|
||||||
bool fillRacks = Settings::Instance().getBool("arbitration.fill-rack");
|
bool fillRacks = Settings::Instance().getBool("arbitration.fill-rack");
|
||||||
if (isArbitrationGame() && !fillRacks && !hasMasterGame())
|
if (isArbitrationGame() && !fillRacks && !hasMasterGame())
|
||||||
setGameAndPlayersRack(getHistory().getCurrentRack());
|
setGameAndPlayersRack(getHistory().getCurrentRack(), true);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const PlayedRack &newRack =
|
const PlayedRack &newRack =
|
||||||
helperSetRackRandom(getHistory().getCurrentRack(), true, RACK_NEW);
|
helperSetRackRandom(getHistory().getCurrentRack(), true, RACK_NEW);
|
||||||
setGameAndPlayersRack(newRack);
|
setGameAndPlayersRack(newRack, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (EndGameException &e)
|
catch (EndGameException &e)
|
||||||
|
|
|
@ -682,7 +682,7 @@ int Game::checkPlayedWord(const wstring &iCoord,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Game::setGameAndPlayersRack(const PlayedRack &iRack)
|
void Game::setGameAndPlayersRack(const PlayedRack &iRack, bool iWithNoMove)
|
||||||
{
|
{
|
||||||
// Set the game rack
|
// Set the game rack
|
||||||
Command *pCmd = new GameRackCmd(*this, iRack);
|
Command *pCmd = new GameRackCmd(*this, iRack);
|
||||||
|
@ -695,15 +695,18 @@ void Game::setGameAndPlayersRack(const PlayedRack &iRack)
|
||||||
accessNavigation().addAndExecute(pCmd);
|
accessNavigation().addAndExecute(pCmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assign a "no move" pseudo-move to all the players.
|
if (iWithNoMove)
|
||||||
// This avoids the need to distinguish between "has not played yet"
|
|
||||||
// and "has played with no move".
|
|
||||||
// This is also practical to know at which turn the warnings, penalties
|
|
||||||
// and solos should be assigned.
|
|
||||||
BOOST_FOREACH(Player *player, m_players)
|
|
||||||
{
|
{
|
||||||
Command *pCmd = new PlayerMoveCmd(*player, Move());
|
// Assign a "no move" pseudo-move to all the players.
|
||||||
accessNavigation().addAndExecute(pCmd);
|
// This avoids the need to distinguish between "has not played yet"
|
||||||
|
// and "has played with no move" in duplicate and arbitration modes.
|
||||||
|
// This is also practical to know at which turn the warnings, penalties
|
||||||
|
// and solos should be assigned.
|
||||||
|
BOOST_FOREACH(Player *player, m_players)
|
||||||
|
{
|
||||||
|
Command *pCmd = new PlayerMoveCmd(*player, Move());
|
||||||
|
accessNavigation().addAndExecute(pCmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -324,7 +324,7 @@ protected:
|
||||||
* Helper function to set the game rack and the players rack at the same time.
|
* Helper function to set the game rack and the players rack at the same time.
|
||||||
* Shouldn't be used in free game mode.
|
* Shouldn't be used in free game mode.
|
||||||
*/
|
*/
|
||||||
void setGameAndPlayersRack(const PlayedRack &iRack);
|
void setGameAndPlayersRack(const PlayedRack &iRack, bool iWithNoMove);
|
||||||
|
|
||||||
void nextPlayer();
|
void nextPlayer();
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ void Topping::start()
|
||||||
{
|
{
|
||||||
const PlayedRack &newRack =
|
const PlayedRack &newRack =
|
||||||
helperSetRackRandom(getHistory().getCurrentRack(), true, RACK_NEW);
|
helperSetRackRandom(getHistory().getCurrentRack(), true, RACK_NEW);
|
||||||
setGameAndPlayersRack(newRack);
|
setGameAndPlayersRack(newRack, false);
|
||||||
}
|
}
|
||||||
catch (EndGameException &e)
|
catch (EndGameException &e)
|
||||||
{
|
{
|
||||||
|
@ -121,13 +121,9 @@ void Topping::turnTimeOut()
|
||||||
|
|
||||||
m_board.removeTestRound();
|
m_board.removeTestRound();
|
||||||
|
|
||||||
// Commented out, because the player already has
|
|
||||||
// an empty move by default
|
|
||||||
#if 0
|
|
||||||
// The player didn't find the move
|
// The player didn't find the move
|
||||||
Command *pCmd = new PlayerMoveCmd(*m_players[m_currPlayer], Move());
|
Command *pCmd = new PlayerMoveCmd(*m_players[m_currPlayer], Move());
|
||||||
accessNavigation().addAndExecute(pCmd);
|
accessNavigation().addAndExecute(pCmd);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Give a penalty to the player
|
// Give a penalty to the player
|
||||||
// XXX: should we give the penalty directly in the NO_MOVE move?
|
// XXX: should we give the penalty directly in the NO_MOVE move?
|
||||||
|
|
Loading…
Reference in a new issue