fix frontend compatibility issues
authoralfadur
Sun, 14 Oct 2018 21:57:30 +0300
changeset 13910 6c8d4e140f27
parent 13909 a44e4c057f57
child 13911 fa9f93393e9c
fix frontend compatibility issues
QTfrontend/campaign.cpp
QTfrontend/drawmapscene.cpp
QTfrontend/ui/widget/about.cpp
QTfrontend/ui/widget/chatwidget.cpp
QTfrontend/util/namegen.cpp
--- a/QTfrontend/campaign.cpp	Sun Oct 14 21:25:59 2018 +0300
+++ b/QTfrontend/campaign.cpp	Sun Oct 14 21:57:30 2018 +0300
@@ -31,7 +31,7 @@
     // if then is found rename it to use _
     QString spaceCampName = campaignName;
     spaceCampName = spaceCampName.replace(QString("_"),QString(" "));
-    if (!teamfile->childGroups().contains("Campaign " + campaignName) and
+    if (!teamfile->childGroups().contains("Campaign " + campaignName) &&
             teamfile->childGroups().contains("Campaign " + spaceCampName)){
         teamfile->beginGroup("Campaign " + spaceCampName);
         QStringList keys = teamfile->childKeys();
@@ -57,7 +57,7 @@
     QSettings* teamfile = getCampTeamFile(campaignName, teamName);
     int progress = teamfile->value("Campaign " + campaignName + "/Progress", 0).toInt();
     int unlockedMissions = teamfile->value("Campaign " + campaignName + "/UnlockedMissions", 0).toInt();
-    if(progress>0 and unlockedMissions==0)
+    if(progress>0 && unlockedMissions==0)
     {
         QSettings campfile("physfs://Missions/Campaign/" + campaignName + "/campaign.ini", QSettings::IniFormat, 0);
         campfile.setIniCodec("UTF-8");
@@ -124,9 +124,9 @@
 
     QSettings* m_info = getCampMetaInfo();
 
-    if(progress>=0 and unlockedMissions==0)
+    if(progress >= 0 && unlockedMissions == 0)
     {
-        for(unsigned int i=progress+1;i>0;i--)
+        for(unsigned int i = progress + 1; i > 0; i--)
         {
             MissionInfo missionInfo;
             QString script = campfile.value(QString("Mission %1/Script").arg(i)).toString();
--- a/QTfrontend/drawmapscene.cpp	Sun Oct 14 21:25:59 2018 +0300
+++ b/QTfrontend/drawmapscene.cpp	Sun Oct 14 21:57:30 2018 +0300
@@ -29,6 +29,10 @@
 #define DRAWN_MAP_COLOR_CURSOR_PEN (Qt::green)
 #define DRAWN_MAP_COLOR_CURSOR_ERASER (Qt::red)
 
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
 template <class T> T sqr(const T & x)
 {
     return x*x;
--- a/QTfrontend/ui/widget/about.cpp	Sun Oct 14 21:25:59 2018 +0300
+++ b/QTfrontend/ui/widget/about.cpp	Sun Oct 14 21:57:30 2018 +0300
@@ -100,12 +100,16 @@
     //: For the version numbers of Hedgewars' software dependencies
     QString libinfo = QString(tr("Dependency versions:") + QString("<br>"));
 
-#ifdef __GNUC__
+#if defined(__GNUC__)
     libinfo.append(QString(tr("<a href=\"https://gcc.gnu.org\">GCC</a>: %1")).arg(__VERSION__));
+#elif defined(WIN32_VCPKG)
+    libinfo.append(QString(tr("<a href=\"https://visualstudio.microsoft.com\">VC++</a>: %1")).arg(_MSC_FULL_VER));
+#elif defined(__VERSION__)
+    libinfo.append(QString(tr("Unknown Compiler: %1")).arg(__VERSION__));
+#else 
+    libinfo.append(QString(tr("Unknown Compiler")));
+#endif
     libinfo.append(QString("<br>"));
-#else
-    libinfo.append(QString(tr("Unknown Compiler")).arg(__VERSION__) + QString("<br>"));
-#endif
 
     const SDL_version *sdl_ver;
     SDL_version sdl_version;
--- a/QTfrontend/ui/widget/chatwidget.cpp	Sun Oct 14 21:25:59 2018 +0300
+++ b/QTfrontend/ui/widget/chatwidget.cpp	Sun Oct 14 21:57:30 2018 +0300
@@ -308,7 +308,7 @@
 
 void HWChatWidget::linkClicked(const QUrl & link)
 {
-    if ((link.scheme() == "http") or (link.scheme() == "https"))
+    if ((link.scheme() == "http") || (link.scheme() == "https"))
         QDesktopServices::openUrl(link);
     else if (link.scheme() == "hwnick")
     {
--- a/QTfrontend/util/namegen.cpp	Sun Oct 14 21:25:59 2018 +0300
+++ b/QTfrontend/util/namegen.cpp	Sun Oct 14 21:57:30 2018 +0300
@@ -155,7 +155,7 @@
     for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
     {
         HWHog hh = team.hedgehog(i);
-        if (sameHogs and i > 0)
+        if (sameHogs && i > 0)
             hh.Hat = team.hedgehog(i-1).Hat;
         else
             hh.Hat = getRandomHat(withDLC);