X-Git-Url: https://git.ralfj.de/multypo.git/blobdiff_plain/e8b07da1c5251e412f80fdeb94fb327b641fc956..e6207dc52430a9fcbfd7df03f46c2876fc05154b:/qt/multypo.cpp diff --git a/qt/multypo.cpp b/qt/multypo.cpp index e6befe2..973686b 100644 --- a/qt/multypo.cpp +++ b/qt/multypo.cpp @@ -41,9 +41,10 @@ void MultypoWindow::resetPlayerText() { } void MultypoWindow::nextWord() { - QByteArray tmp = words.readLine(); + QByteArray tmp = words.readLine().trimmed(); QString word = QString::fromUtf8(tmp); mainLabel->setText(word); + typingPlayers = players.size(); } void MultypoWindow::handleKeyPress(int device, QString string) @@ -61,7 +62,13 @@ void MultypoWindow::handleKeyPress(int device, QString string) players[device]->handleKey(string); if (gameStarted) { // ingame - + qDebug() << players[device]->getCurrentLine(); + qDebug() << mainLabel->text(); + if (players[device]->getCurrentLine() == mainLabel->text()) { + players[device]->score += typingPlayers; + QString readyString = QString("READY: %1 points").arg(typingPlayers); + players[device]->setWaiting(readyString); + } } else { // name entering phase bool allHaveNames = true; for (QMap::Iterator it = players.begin(); it != players.end(); ++it) {