disconnect when going back from lobby page (regression fix)
authorsheepluva
Sat, 29 Oct 2011 09:19:04 +0200
changeset 6225 505643d4c23d
parent 6223 cc3eb9b7230f
child 6227 ce60b734fff1
disconnect when going back from lobby page (regression fix) fix some indentations
QTfrontend/hwform.cpp
QTfrontend/hwform.h
QTfrontend/team.cpp
QTfrontend/team.h
--- a/QTfrontend/hwform.cpp	Fri Oct 28 19:20:35 2011 +0400
+++ b/QTfrontend/hwform.cpp	Sat Oct 29 09:19:04 2011 +0200
@@ -997,6 +997,9 @@
         delete pnetserver;
         pnetserver = 0;
     }
+
+    if(hwnet)
+        hwnet->Disconnect();
 }
 
 void HWForm::ForcedDisconnect(const QString & reason)
@@ -1166,7 +1169,7 @@
             ui.pageNetGame->pGameCFG->WeaponsName->currentIndex()
             ).toString();
 
-	CreateGame(ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget, ammo);
+    CreateGame(ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget, ammo);
 
     connect(game, SIGNAL(SendNet(const QByteArray &)), hwnet, SLOT(SendNet(const QByteArray &)));
     connect(game, SIGNAL(SendChat(const QString &)), hwnet, SLOT(chatLineToNet(const QString &)));
--- a/QTfrontend/hwform.h	Fri Oct 28 19:20:35 2011 +0400
+++ b/QTfrontend/hwform.h	Sat Oct 29 09:19:04 2011 +0200
@@ -157,11 +157,11 @@
         ID_PAGE_DRAWMAP         = 20,
         ID_PAGE_DATADOWNLOAD    = 21
         };
-	QPointer<HWGame> game;
-	QPointer<HWNetServer> pnetserver;
-	QPointer<HWNetRegisterServer> pRegisterServer;
-	QPointer<HWTeam> editedTeam;
-	QPointer<HWNewNet> hwnet;
+    QPointer<HWGame> game;
+    QPointer<HWNetServer> pnetserver;
+    QPointer<HWNetRegisterServer> pRegisterServer;
+    QPointer<HWTeam> editedTeam;
+    QPointer<HWNewNet> hwnet;
     HWNamegen * namegen;
     AmmoSchemeModel * ammoSchemeModel;
     QStack<int> PagesStack;
--- a/QTfrontend/team.cpp	Fri Oct 28 19:20:35 2011 +0400
+++ b/QTfrontend/team.cpp	Sat Oct 29 09:19:04 2011 +0200
@@ -28,10 +28,10 @@
 #include "hats.h"
 
 HWTeam::HWTeam(const QString & teamname) :
-	QObject(0)
-	, m_difficulty(0)
-	, m_numHedgehogs(4)
-	, m_isNetTeam(false)
+    QObject(0)
+    , m_difficulty(0)
+    , m_numHedgehogs(4)
+    , m_isNetTeam(false)
 {
     m_name = teamname;
     OldTeamName = m_name;
@@ -55,9 +55,9 @@
 }
 
 HWTeam::HWTeam(const QStringList& strLst) :
-	QObject(0)
-	, m_numHedgehogs(4)
-	, m_isNetTeam(true)
+    QObject(0)
+    , m_numHedgehogs(4)
+    , m_isNetTeam(true)
 {
     // net teams are configured from QStringList
     if(strLst.size() != 23) throw HWTeamConstructException();
@@ -82,7 +82,7 @@
 }
 
 HWTeam::HWTeam() :
-	QObject(0)
+    QObject(0)
   , m_difficulty(0)
   , m_numHedgehogs(4)
   , m_isNetTeam(false)
@@ -110,51 +110,51 @@
 }
 
 HWTeam::HWTeam(const HWTeam & other) :
-		QObject(0)
-		, OldTeamName(other.OldTeamName)
-		, m_name(other.m_name)
-		, m_grave(other.m_grave)
-		, m_fort(other.m_fort)
-		, m_flag(other.m_flag)
-		, m_voicepack(other.m_voicepack)
-		, m_hedgehogs(other.m_hedgehogs)
-		, m_difficulty(other.m_difficulty)
-		, m_binds(other.m_binds)
-		, m_numHedgehogs(other.m_numHedgehogs)
-		, m_color(other.m_color)
-		, m_isNetTeam(other.m_isNetTeam)
-		, m_owner(other.m_owner)
-		, m_campaignProgress(other.m_campaignProgress)
-		, m_rounds(other.m_rounds)
-		, m_wins(other.m_wins)
-//	  , AchievementProgress(other.AchievementProgress)
+        QObject(0)
+        , OldTeamName(other.OldTeamName)
+        , m_name(other.m_name)
+        , m_grave(other.m_grave)
+        , m_fort(other.m_fort)
+        , m_flag(other.m_flag)
+        , m_voicepack(other.m_voicepack)
+        , m_hedgehogs(other.m_hedgehogs)
+        , m_difficulty(other.m_difficulty)
+        , m_binds(other.m_binds)
+        , m_numHedgehogs(other.m_numHedgehogs)
+        , m_color(other.m_color)
+        , m_isNetTeam(other.m_isNetTeam)
+        , m_owner(other.m_owner)
+        , m_campaignProgress(other.m_campaignProgress)
+        , m_rounds(other.m_rounds)
+        , m_wins(other.m_wins)
+//      , AchievementProgress(other.AchievementProgress)
 {
 
 }
 
 HWTeam & HWTeam::operator = (const HWTeam & other)
 {
-	if(this != &other)
-	{
-		OldTeamName = other.OldTeamName;
-		m_name = other.m_name;
-		m_grave = other.m_grave;
-		m_fort = other.m_fort;
-		m_flag = other.m_flag;
-		m_voicepack = other.m_voicepack;
-//		m_hedgehogs = other.m_hedgehogs;
-		m_difficulty = other.m_difficulty;
-//		m_binds = other.m_binds;
-		m_numHedgehogs = other.m_numHedgehogs;
-		m_color = other.m_color;
-		m_isNetTeam = other.m_isNetTeam;
-		m_owner = other.m_owner;
-		m_campaignProgress = other.m_campaignProgress;
-		m_rounds = other.m_rounds;
-		m_wins = other.m_wins;
-	}
+    if(this != &other)
+    {
+        OldTeamName = other.OldTeamName;
+        m_name = other.m_name;
+        m_grave = other.m_grave;
+        m_fort = other.m_fort;
+        m_flag = other.m_flag;
+        m_voicepack = other.m_voicepack;
+//        m_hedgehogs = other.m_hedgehogs;
+        m_difficulty = other.m_difficulty;
+//        m_binds = other.m_binds;
+        m_numHedgehogs = other.m_numHedgehogs;
+        m_color = other.m_color;
+        m_isNetTeam = other.m_isNetTeam;
+        m_owner = other.m_owner;
+        m_campaignProgress = other.m_campaignProgress;
+        m_rounds = other.m_rounds;
+        m_wins = other.m_wins;
+    }
 
-	return *this;
+    return *this;
 }
 
 bool HWTeam::loadFromFile()
--- a/QTfrontend/team.h	Fri Oct 28 19:20:35 2011 +0400
+++ b/QTfrontend/team.h	Sat Oct 29 09:19:04 2011 +0200
@@ -44,7 +44,7 @@
 // class representing a team
 class HWTeam : public QObject
 {
-	Q_OBJECT
+    Q_OBJECT
 
     public:
 
@@ -52,7 +52,7 @@
         HWTeam(const QString & teamname);
         HWTeam(const QStringList& strLst);
         HWTeam();
-		HWTeam(const HWTeam & other);
+        HWTeam(const HWTeam & other);
 
         // file operations
         static HWTeam loadFromFile(const QString & teamName);
@@ -96,9 +96,9 @@
         QStringList teamGameConfig(quint32 InitHealth) const;
 
         // comparison operators
-		bool operator == (const HWTeam& t1) const;
-		bool operator < (const HWTeam& t1) const;
-		HWTeam & operator = (const HWTeam & other);
+        bool operator == (const HWTeam& t1) const;
+        bool operator < (const HWTeam& t1) const;
+        HWTeam & operator = (const HWTeam & other);
 
 
     private:
@@ -112,11 +112,11 @@
         QString m_flag;
         QString m_voicepack;
         HWHog m_hedgehogs[HEDGEHOGS_PER_TEAM];
-		quint8 m_difficulty;
+        quint8 m_difficulty;
         BindAction m_binds[BINDS_NUMBER];
 
         // class members that contain info for the current game setup
-		quint8 m_numHedgehogs;
+        quint8 m_numHedgehogs;
         QColor m_color;
         bool m_isNetTeam;
         QString m_owner;