From dbcb13d3c87133117bc54023c162ad0a202efa1d Mon Sep 17 00:00:00 2001 From: John Fultz Date: Tue, 2 Aug 2016 04:08:43 -0500 Subject: 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. --- move.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'move.cpp') diff --git a/move.cpp b/move.cpp index 60e14e4..2d0a9c4 100644 --- a/move.cpp +++ b/move.cpp @@ -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); -- cgit v1.2.3