diff options
author | John Fultz <jfultz@wolfram.com> | 2016-08-02 04:08:43 -0500 |
---|---|---|
committer | John Fultz <jfultz@wolfram.com> | 2016-08-02 06:37:15 -0500 |
commit | dbcb13d3c87133117bc54023c162ad0a202efa1d (patch) | |
tree | 955715420b4584b73baa676c1b4b5fe4febb3c48 /move.cpp | |
parent | a3aa3602d173939a2b616bb78a5a739eb9761d9b (diff) |
Fixes to allow bad endgames to be loaded from GCGs.
Not perfect, but it now does a decent job of not corrupting GCGs when
it loads one where players have messed up tile counts/drawing in the
end-game. It also tries to annotate these for the player and in any
GCG file that's round-tripped.
Also, a lot of C++11-izing of ranged iterators.
Diffstat (limited to 'move.cpp')
-rw-r--r-- | move.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -40,10 +40,12 @@ bool operator==(const Move &move1, const Move &move2) switch (move1.action) { case Quackle::Move::Place: + case Quackle::Move::PlaceError: ret = (move1.horizontal == move2.horizontal && move1.startrow == move2.startrow && move1.startcol == move2.startcol && move1.tiles() == move2.tiles() && move1.isChallengedPhoney() == move2.isChallengedPhoney()); break; case Quackle::Move::UnusedTilesBonus: + case Quackle::Move::UnusedTilesBonusError: case Quackle::Move::Exchange: ret = (Quackle::String::alphabetize(move1.tiles()) == Quackle::String::alphabetize(move2.tiles())); break; @@ -142,6 +144,7 @@ UVString Move::xml() const includeScore = true; break; + case UnusedTilesBonusError: case UnusedTilesBonus: actionString = MARK_UV("unusedtilesbonus"); includeTiles = true; @@ -195,9 +198,9 @@ UVString Move::toString() const ss << "nonmove"; else if (action == Quackle::Move::TimePenalty) ss << "timepenalty " << score; - else if (action == Quackle::Move::UnusedTilesBonus) + else if (action == Quackle::Move::UnusedTilesBonus || action == Quackle::Move::UnusedTilesBonusError) ss << "(" << QUACKLE_ALPHABET_PARAMETERS->userVisible(m_tiles) << ")"; - else if (action == Quackle::Move::Place) + else if (action == Quackle::Move::Place || action == Quackle::Move::PlaceError) { ss << positionString(); ss << " " << QUACKLE_ALPHABET_PARAMETERS->userVisible(m_tiles); |