- Some debug info
authorunc0rr
Sun, 27 Apr 2008 13:09:11 +0000
changeset 884 99cc72c8a812
parent 883 07a568ba44e0
child 885 5fadd24ec42f
- Some debug info - Fix copyright info
QTfrontend/netconnectedclient.cpp
QTfrontend/netserver.cpp
QTfrontend/newnetclient.cpp
QTfrontend/teamselect.cpp
--- a/QTfrontend/netconnectedclient.cpp	Sun Apr 27 11:40:22 2008 +0000
+++ b/QTfrontend/netconnectedclient.cpp	Sun Apr 27 13:09:11 2008 +0000
@@ -58,6 +58,7 @@
 {
   QString msg = QString::fromUtf8 (line.data(), line.size());
   QStringList lst = msg.split(delimeter);
+//qDebug() << "Parsing: " << lst;
   if(!lst.size())
   {
     qWarning("Net server: Bad message");
@@ -219,15 +220,18 @@
 
 unsigned int HWConnectedClient::removeTeam(const QString& tname)
 {
-  unsigned int netID=0;
-  for(QList<QStringList>::iterator it=m_teamsCfg.begin(); it!=m_teamsCfg.end(); ++it) {
-    if((*it)[0]==tname) {
-      netID=(*it)[1].toUInt();
-      m_teamsCfg.erase(it);
-      break;
-    }
-  }
-  return netID;
+	unsigned int netID=0;
+	for(QList<QStringList>::iterator it=m_teamsCfg.begin(); it!=m_teamsCfg.end(); ++it) {
+		if((*it)[0]==tname) {
+			netID=(*it)[1].toUInt();
+			m_teamsCfg.erase(it);
+			break;
+		}
+	}
+	if (netID == 0)
+		qDebug() << QString("removeTeam: team '%1' not found").arg(tname);
+
+	return netID;
 }
 
 QList<QStringList> HWConnectedClient::getTeamNames() const
--- a/QTfrontend/netserver.cpp	Sun Apr 27 11:40:22 2008 +0000
+++ b/QTfrontend/netserver.cpp	Sun Apr 27 13:09:11 2008 +0000
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a worms-like game
- * Copyright (c) 2006-2008 Ulyanov Igor <iulyanov@gmail.com>
+ * Copyright (c) 2006-2008 Igor Ulyanov <iulyanov@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
--- a/QTfrontend/newnetclient.cpp	Sun Apr 27 11:40:22 2008 +0000
+++ b/QTfrontend/newnetclient.cpp	Sun Apr 27 13:09:11 2008 +0000
@@ -145,6 +145,7 @@
   QString msg = QString::fromUtf8 (line.data(), line.size());
 
   QStringList lst = msg.split(delimeter);
+//qDebug() << "Parsing: " << lst;
   if (lst[0] == "ERRONEUSNICKNAME") {
     QMessageBox::information(0, 0, "Your net nickname is in use or cannot be used");
     return;
--- a/QTfrontend/teamselect.cpp	Sun Apr 27 11:40:22 2008 +0000
+++ b/QTfrontend/teamselect.cpp	Sun Apr 27 13:09:11 2008 +0000
@@ -22,6 +22,7 @@
 #include <QPixmap>
 #include <QPushButton>
 #include <QFrame>
+#include <QDebug>
 
 #include <vertScrollArea.h>
 #include "teamselect.h"
@@ -61,22 +62,36 @@
 
 void TeamSelWidget::hhNumChanged(const HWTeam& team)
 {
-  QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
-  itPlay->numHedgehogs=team.numHedgehogs;
-  emit hhogsNumChanged(team);
+	QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
+	if(itPlay==curPlayingTeams.end())
+	{
+		qWarning() << QString("hhNumChanged: team '%1' not found").arg(team.TeamName);
+		return;
+	}
+	itPlay->numHedgehogs=team.numHedgehogs;
+	emit hhogsNumChanged(team);
 }
 
 void TeamSelWidget::proxyTeamColorChanged(const HWTeam& team)
 {
-  QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
-  itPlay->teamColor=team.teamColor;
-  emit teamColorChanged(team);
+	QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
+	if(itPlay==curPlayingTeams.end())
+	{
+		qWarning() << QString("proxyTeamColorChanged: team '%1' not found").arg(team.TeamName);
+		return;
+	}
+	itPlay->teamColor=team.teamColor;
+	emit teamColorChanged(team);
 }
 
 void TeamSelWidget::changeHHNum(const HWTeam& team)
 {
   QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
-  if(itPlay==curPlayingTeams.end()) return;
+	if(itPlay==curPlayingTeams.end())
+	{
+		qWarning() << QString("changeHHNum: team '%1' not found").arg(team.TeamName);
+		return;
+	}
   itPlay->numHedgehogs=team.numHedgehogs;
 
   framePlaying->setHHNum(team);
@@ -84,26 +99,35 @@
 
 void TeamSelWidget::changeTeamColor(const HWTeam& team)
 {
-  QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
-  if(itPlay==curPlayingTeams.end()) return;
-  itPlay->teamColor=team.teamColor;
+	QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
+	if(itPlay==curPlayingTeams.end())
+	{
+		qWarning() << QString("changeTeamColor: team '%1' not found").arg(team.TeamName);
+		return;
+	}
+	itPlay->teamColor=team.teamColor;
 
-  framePlaying->setTeamColor(team);
+	framePlaying->setTeamColor(team);
 }
 
 void TeamSelWidget::removeNetTeam(const HWTeam& team)
 {
-  for(;;) {
-    QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
-    if(itPlay==curPlayingTeams.end()) break;
-    if(itPlay->isNetTeam()) {
-      QObject::disconnect(framePlaying->getTeamWidget(*itPlay), SIGNAL(teamStatusChanged(HWTeam)));
-      framePlaying->removeTeam(team);
-      curPlayingTeams.erase(itPlay);
-      break;
-    }
-  }
-  emit setEnabledGameStart(curPlayingTeams.size()>1);
+	qDebug() << QString("removeNetTeam: removing team '%1'").arg(team.TeamName);
+	for(;;) {
+		QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
+		if(itPlay==curPlayingTeams.end())
+		{
+			qWarning() << QString("removeNetTeam: team '%1' not found").arg(team.TeamName);
+			break;
+		}
+		if(itPlay->isNetTeam()) {
+			QObject::disconnect(framePlaying->getTeamWidget(*itPlay), SIGNAL(teamStatusChanged(HWTeam)));
+			framePlaying->removeTeam(team);
+			curPlayingTeams.erase(itPlay);
+			break;
+		}
+	}
+	emit setEnabledGameStart(curPlayingTeams.size()>1);
 }
 
 void TeamSelWidget::netTeamStatusChanged(const HWTeam& team)