--- a/QTfrontend/hwmap.cpp Wed Feb 14 20:05:20 2007 +0000
+++ b/QTfrontend/hwmap.cpp Wed Feb 14 22:15:55 2007 +0000
@@ -42,7 +42,7 @@
void HWMap::onClientDisconnect()
{
- QImage im((uchar*)(const char*)readbuffer, 256, 128, QImage::Format_Mono);
+ QImage im((uchar*)(readbuffer.constData()), 256, 128, QImage::Format_Mono);
im.setNumColors(2);
emit ImageReceived(im);
}
--- a/QTfrontend/netconnectedclient.cpp Wed Feb 14 20:05:20 2007 +0000
+++ b/QTfrontend/netconnectedclient.cpp Wed Feb 14 22:15:55 2007 +0000
@@ -109,7 +109,7 @@
}
if(lst[0]=="ADDTEAM:") {
- if(lst.size()<11) return;
+ if(lst.size()<14) return;
lst.pop_front();
// add team ID
--- a/QTfrontend/netserver.cpp Wed Feb 14 20:05:20 2007 +0000
+++ b/QTfrontend/netserver.cpp Wed Feb 14 22:15:55 2007 +0000
@@ -100,15 +100,6 @@
QMap<QString, QStringList> HWNetServer::getGameCfg() const
{
return m_gameCfg;
- /*
- for(QList<HWConnectedClient*>::const_iterator it=connclients.begin(); it!=connclients.end(); ++it) {
- if(isChiefClient(*it)) {
- return (*it)->m_gameCfg;
- }
- }
- // error happened if we are here
- return QMap<QString, QStringList>();
- */
}
bool HWNetServer::haveNick(const QString& nick) const
--- a/QTfrontend/newnetclient.cpp Wed Feb 14 20:05:20 2007 +0000
+++ b/QTfrontend/newnetclient.cpp Wed Feb 14 22:15:55 2007 +0000
@@ -65,6 +65,9 @@
RawSendNet(QString("ADDTEAM:") + delimeter +
team.TeamName + delimeter +
team.teamColor.name() + delimeter +
+ team.Grave + delimeter +
+ team.Fort + delimeter +
+ QString::number(team.difficulty) + delimeter +
team.HHName[0] + delimeter + team.HHName[1] + delimeter +
team.HHName[2] + delimeter + team.HHName[3] + delimeter + team.HHName[4] + delimeter +
team.HHName[5] + delimeter + team.HHName[6] + delimeter + team.HHName[7]);
@@ -279,7 +282,7 @@
void HWNewNet::RunGame()
{
- HWGame* game = new HWGame(config, m_pGameCFGWidget, m_pTeamSelWidget); // FIXME: memory leak here (stackify it?)
+ HWGame* game = new HWGame(config, m_pGameCFGWidget, m_pTeamSelWidget);
connect(game, SIGNAL(SendNet(const QByteArray &)), this, SLOT(SendNet(const QByteArray &)));
connect(this, SIGNAL(FromNet(const QByteArray &)), game, SLOT(FromNet(const QByteArray &)));
connect(this, SIGNAL(LocalCFG(const QString &)), game, SLOT(LocalCFG(const QString &)));
--- a/QTfrontend/tcpBase.cpp Wed Feb 14 20:05:20 2007 +0000
+++ b/QTfrontend/tcpBase.cpp Wed Feb 14 22:15:55 2007 +0000
@@ -59,7 +59,6 @@
IPCSocket = IPCServer->nextPendingConnection();
if(!IPCSocket) return;
connect(IPCSocket, SIGNAL(disconnected()), this, SLOT(ClientDisconnect()));
- connect(IPCSocket, SIGNAL(disconnected()), IPCSocket, SLOT(deleteLater()));
connect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
SendToClientFirst();
}
@@ -78,16 +77,20 @@
void TCPBase::ClientDisconnect()
{
+ disconnect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
onClientDisconnect();
if(srvsList.size()==1) srvsList.pop_front();
emit isReadyNow();
+ IPCSocket->deleteLater();
deleteLater();
}
void TCPBase::ClientRead()
{
- readbuffer.append(IPCSocket->readAll());
+ QByteArray readed=IPCSocket->readAll();
+ if(readed.isEmpty()) return;
+ readbuffer.append(readed);
onClientRead();
}
--- a/QTfrontend/team.cpp Wed Feb 14 20:05:20 2007 +0000
+++ b/QTfrontend/team.cpp Wed Feb 14 22:15:55 2007 +0000
@@ -50,10 +50,13 @@
numHedgehogs(4)
{
// net teams are configured from QStringList
- if(strLst.size()<10) throw HWTeamConstructException();
+ if(strLst.size()<13) throw HWTeamConstructException();
TeamName=strLst[0];
m_netID=strLst[1].toUInt();
- for(int i = 0; i < 8; i++) HHName[i]=strLst[i+2];
+ Grave=strLst[2];
+ Fort=strLst[3];
+ difficulty=strLst[4].toUInt();
+ for(int i = 0; i < 8; i++) HHName[i]=strLst[i+5];
}
HWTeam::HWTeam(quint8 num) :