RackWidget: filter the rack correctly when the played word contains a blank

This commit is contained in:
Olivier Teulière 2013-01-13 22:36:05 +01:00
parent 94b2b520d1
commit d9ee0633db

View file

@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/
#include <algorithm>
#include <QtGui/QHBoxLayout> #include <QtGui/QHBoxLayout>
#include <QtGui/QDragEnterEvent> #include <QtGui/QDragEnterEvent>
#include <QtGui/QDragLeaveEvent> #include <QtGui/QDragLeaveEvent>
@ -151,15 +153,11 @@ vector<Tile> RackWidget::filterRack(const vector<Tile> &iTiles) const
if (round.isPlayedFromRack(i)) if (round.isPlayedFromRack(i))
{ {
const Tile &t = round.getTile(i); const Tile &t = round.getTile(i);
vector<Tile>::iterator it; vector<Tile>::iterator it =
for (it = result.begin(); it != result.end(); ++it) std::find(result.begin(), result.end(),
{ t.isJoker() ? Tile::Joker() : t);
if (*it == t) if (it != result.end())
{ result.erase(it);
result.erase(it);
break;
}
}
} }
} }