Commit dfb02321 authored by Yuri Chornoivan's avatar Yuri Chornoivan
Browse files

Fix some compiler warnings

Summary: There are several logic mistakes in the current code. Compiler warns about them and this patch tries to fix tnem.

Test Plan: Compiles and installs, XMPP part was not tested.

Reviewers: #kde_games, aacid

Reviewed By: aacid

Subscribers: nhirsl, aacid, chehrlic, kde-games-devel

Differential Revision: https://phabricator.kde.org/D25199
parent ee0cb923
......@@ -8,7 +8,7 @@ set(KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIO
project(ksirk VERSION ${KDE_APPLICATIONS_VERSION})
set (QT_MIN_VERSION "5.7.0")
set (QT_MIN_VERSION "5.8.0")
set (KF5_MIN_VERSION "5.30.0")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED CONFIG)
......
......@@ -2198,6 +2198,7 @@ void GameAutomaton::slotNetworkData(int msgid, const QByteArray &buffer, quint32
case DecrNbArmies:
stream >> countryName >> nbArmies;
m_game->theWorld()->countryNamed(countryName)->decrNbArmies(nbArmies);
Q_FALLTHROUGH();
case StartLocalCurrentAI:
m_game->startLocalCurrentAI();
break;
......
......@@ -68,7 +68,7 @@ public:
/** Default destructor */
~Goal();
//@{
/** Accessors for the goal type */
inline GoalType type() const {return m_type;}
......
......@@ -71,7 +71,7 @@ ONU::ONU(GameAutomaton* automaton,
}
#endif
m_font.family = "URW Chancery L";
m_font.size = (uint)(13*m_zoom);
m_font.size = (int)(13*m_zoom);
m_font.weight = QFont::Bold;
m_font.italic = true;
m_font.foregroundColor = "black";
......@@ -222,7 +222,7 @@ ONU::ONU(GameAutomaton* automaton,
KConfigGroup fontgroup = config.group("font");
m_font.family = fontgroup.readEntry("family","URW Chancery L");
m_font.size = fontgroup.readEntry("size",(uint)(13*m_zoom));
m_font.size = fontgroup.readEntry("size",(int)(13*m_zoom));
QString w = fontgroup.readEntry("weight", "bold");;
if (w == "normal")
{
......@@ -640,7 +640,7 @@ void ONU::applyZoomFactor(qreal zoomFactor)
m_zoom *= zoomFactor;
//m_font.size = (unsigned int)(m_font.size*m_zoom);
//m_font.size = (int)(m_font.size*m_zoom);
//m_width = (unsigned int)(m_width *m_zoom);
//m_height = (unsigned int)(m_height *m_zoom);
......@@ -665,7 +665,7 @@ void ONU::applyZoomFactorFast(qreal zoomFactor) //benj
//Application of zoom
if (zoomFactor > 1 && m_nbZooms < nbLimitZooms)
{
m_font.size = (unsigned int)(m_font.size*zoomFactor);
m_font.size = (int)(m_font.size*zoomFactor);
m_width = (unsigned int)(m_width *zoomFactor);
m_height = (unsigned int)(m_height *zoomFactor);
......@@ -684,7 +684,7 @@ void ONU::applyZoomFactorFast(qreal zoomFactor) //benj
}
else if (zoomFactor < 1 && m_nbZooms > -nbLimitZooms)
{
m_font.size = (unsigned int)(m_font.size*zoomFactor);
m_font.size = (int)(m_font.size*zoomFactor);
m_width = (unsigned int)(m_width *zoomFactor);
m_height = (unsigned int)(m_height *zoomFactor);
......
......@@ -207,7 +207,7 @@ private:
struct FontDesc
{
QString family;
uint size;
int size;
QFont::Weight weight;
bool italic;
QString foregroundColor;
......
......@@ -443,31 +443,31 @@ void KRightDialog::displayFightResult(int A1=0, int A2=0, int A3=0, int D1=0, in
QHBoxLayout * deAtt = new QHBoxLayout();
QHBoxLayout * deDef = new QHBoxLayout();
if(A1!=0 || A1!=-1)
if(A1!=0 && A1!=-1)
{
QLabel * de1 = new QLabel();
de1->setPixmap(game->getDice(KGameWindow::Red,A1));
rightContents.insert(0,de1);deAtt->addWidget(de1);
}
if(A2!=0 || A2!=-1)
if(A2!=0 && A2!=-1)
{
QLabel * de2= new QLabel();
de2->setPixmap(game->getDice(KGameWindow::Red,A2));
rightContents.insert(0,de2);deAtt->addWidget(de2);
}
if(A3!=0 || A3!=-1)
if(A3!=0 && A3!=-1)
{
QLabel * de3= new QLabel();
de3->setPixmap(game->getDice(KGameWindow::Red,A3));
rightContents.insert(0,de3);deAtt->addWidget(de3);
}
if(D1!=0 || D1!=-1)
if(D1!=0 && D1!=-1)
{
QLabel * de4= new QLabel();
de4->setPixmap(game->getDice(KGameWindow::Blue,D1));
rightContents.insert(0,de4);deDef->addWidget(de4);
}
if(D2!=0 || D2!=-1)
if(D2!=0 && D2!=-1)
{
QLabel * de5= new QLabel();
de5->setPixmap(game->getDice(KGameWindow::Blue,D2));
......
......@@ -56,7 +56,7 @@ ONU::ONU(const QString& configDir, QObject *parent)
qCDebug(KSIRKSKINEDITOR_LOG) << "ONU constructor: " << m_configFileName;
m_font.family = QStringLiteral("URW Chancery L");
m_font.size = (uint)(13);
m_font.size = 13;
m_font.weight = QFont::Bold;
m_font.italic = true;
m_font.foregroundColor = QStringLiteral("black");
......@@ -199,7 +199,7 @@ ONU::ONU(const QString& configDir, QObject *parent)
qCDebug(KSIRKSKINEDITOR_LOG) << "Loading font data";
KConfigGroup fontgroup = config.group("font");
m_font.family = fontgroup.readEntry("family","URW Chancery L");
m_font.size = fontgroup.readEntry("size",(uint)(13));
m_font.size = fontgroup.readEntry("size", 13);
QString w = fontgroup.readEntry("weight", "bold");;
if (w == QLatin1String("normal"))
{
......
......@@ -213,7 +213,7 @@ public:
struct FontDesc
{
QString family;
uint size;
int size;
QFont::Weight weight;
bool italic;
QString foregroundColor;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment