diff options
author | John Fultz <jfultz@wolfram.com> | 2016-07-03 02:54:38 -0500 |
---|---|---|
committer | John Fultz <jfultz@wolfram.com> | 2016-07-03 02:54:38 -0500 |
commit | da2f20720facda706be06b5813ab20057d5b4de9 (patch) | |
tree | e2d266054b384d7d5a5fd38c19bf18d1f952ed61 /game.cpp | |
parent | 0cda99549250c87ab9c9b20044767a7615e279c6 (diff) |
Fix problems with "ex n" where n is a number.
Found a crash where you enter "ex 4" twice,
and it would crash. This led me to look up
how this was implemented, and it wasn't
very robust. It also didn't save properly in
the GCG. So I created a new move type
which I called a BlindExchange and implemented
it throughout the system.
Diffstat (limited to 'game.cpp')
-rw-r--r-- | game.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -357,6 +357,11 @@ int GamePosition::validateMove(const Move &move) const } break; + case Move::BlindExchange: + if (!exchangeAllowed()) + ret |= TooLateExchange; + break; + case Move::UnusedTilesBonus: case Move::TimePenalty: ret = InvalidAction; @@ -783,7 +788,7 @@ bool GamePosition::incrementTurn() } } - if ((m_moveMade.action == Move::Place && m_moveMade.effectiveScore() == 0) || m_moveMade.action == Move::Exchange || m_moveMade.action == Move::Pass) + if ((m_moveMade.action == Move::Place && m_moveMade.effectiveScore() == 0) || m_moveMade.action == Move::Exchange || m_moveMade.action == Move::BlindExchange || m_moveMade.action == Move::Pass) ++m_scorelessTurnsInARow; else m_scorelessTurnsInARow = 0; |