From: APTX Date: Sat, 8 Aug 2015 18:19:32 +0000 (+0200) Subject: Try rounding the vote before casting to int. X-Git-Url: https://gitweb.tyo.aptx.org/?a=commitdiff_plain;h=d305b907eefe71f025590579a266c2aef07e8ef1;p=localmylist.git Try rounding the vote before casting to int. --- diff --git a/localmylist/requesthandler.cpp b/localmylist/requesthandler.cpp index f5d8392..62f151a 100644 --- a/localmylist/requesthandler.cpp +++ b/localmylist/requesthandler.cpp @@ -1,5 +1,7 @@ #include "requesthandler.h" +#include + #include "mylist.h" #include "database.h" #include "settings.h" @@ -148,7 +150,7 @@ void RequestHandler::handleMyListUpdates() if (request.vote < 1.0 || request.vote > 10.0) cmd.setValue(-1); else - cmd.setValue(int(request.vote * 100)); + cmd.setValue(static_cast(std::nearbyint(request.vote * 100))); VoteReply *reply = Client::instance()->send(cmd); connect(reply, SIGNAL(replyReady(bool)), this, SLOT(myListUpdateVoteReplyComplete(bool)));