QTfrontend/game.cpp
author unc0rr
Sat, 31 Dec 2005 13:46:49 +0000
changeset 36 a803a00a3272
parent 32 78bff13b11c0
child 40 416d54ce0c34
permissions -rw-r--r--
- Anti-flood and anti-lag changes - Fixed crash on connect to net server
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
     1
/*
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
     2
 * Hedgewars, a worms-like game
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
     3
 * Copyright (c) 2005 Andrey Korotaev <unC0Rr@gmail.com>
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
     4
 *
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
     5
 * Distributed under the terms of the BSD-modified licence:
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
     6
 *
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
     7
 * Permission is hereby granted, free of charge, to any person obtaining a copy
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
     8
 * of this software and associated documentation files (the "Software"), to deal
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
     9
 * with the Software without restriction, including without limitation the
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    10
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    11
 * sell copies of the Software, and to permit persons to whom the Software is
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    12
 * furnished to do so, subject to the following conditions:
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    13
 *
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    14
 * 1. Redistributions of source code must retain the above copyright notice,
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    15
 *    this list of conditions and the following disclaimer.
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    16
 * 2. Redistributions in binary form must reproduce the above copyright notice,
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    17
 *    this list of conditions and the following disclaimer in the documentation
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    18
 *    and/or other materials provided with the distribution.
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    19
 * 3. The name of the author may not be used to endorse or promote products
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    20
 *    derived from this software without specific prior written permission.
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    21
 *
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    22
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    23
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    24
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    25
 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    26
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    27
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    28
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    29
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    30
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    31
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    32
 */
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    33
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    34
#include <QMessageBox>
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    35
#include <QProcess>
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    36
#include <QTimer>
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    37
#include <QString>
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    38
#include <QByteArray>
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    39
#include <QTextStream>
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    40
#include <QFile>
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    41
#include "game.h"
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    42
#include "hwconsts.h"
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    43
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
    44
HWGame::HWGame(int Resolution, bool Fullscreen)
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    45
{
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
    46
	vid_Resolution = Resolution;
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
    47
	vid_Fullscreen = Fullscreen;
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    48
	IPCServer = new QTcpServer(this);
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    49
	IPCServer->setMaxPendingConnections(1);
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    50
	if (!IPCServer->listen(QHostAddress("127.0.0.1"), IPC_PORT))
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    51
	{
28
59f7db859b8a - clear demos list before adding items
unc0rr
parents: 26
diff changeset
    52
		QMessageBox::critical(0, tr("Error"),
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    53
				tr("Unable to start the server: %1.")
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    54
				.arg(IPCServer->errorString()));
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    55
	}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    56
	connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection()));
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    57
	IPCSocket = 0;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    58
	TeamCount = 0;
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
    59
	seed = "";
31
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
    60
	cfgdir.setPath(cfgdir.homePath());
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
    61
	cfgdir.cd(".hedgewars");
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    62
}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    63
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    64
void HWGame::NewConnection()
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    65
{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    66
	QTcpSocket * client = IPCServer->nextPendingConnection();
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    67
	if(!IPCSocket)
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    68
	{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    69
		IPCSocket = client;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    70
		connect(client, SIGNAL(disconnected()), this, SLOT(ClientDisconnect()));
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    71
		connect(client, SIGNAL(readyRead()), this, SLOT(ClientRead()));
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    72
		msgsize = 0;
32
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
    73
		if (toSendBuf.size() > 0)
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
    74
			SENDIPC("?");
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    75
	} else
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    76
	{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    77
		client->disconnectFromHost();
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    78
		delete client;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    79
	}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    80
}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    81
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    82
void HWGame::ClientDisconnect()
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    83
{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    84
	IPCSocket = 0;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    85
	SaveDemo("demo.hwd_1");
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    86
	delete this;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    87
}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    88
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    89
void HWGame::SendTeamConfig(int index)
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    90
{
31
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
    91
	LocalCFG(teams[index]);
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    92
}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    93
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    94
void HWGame::SendConfig()
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    95
{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    96
	SENDIPC("TL");
31
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
    97
//	SENDIPC("e$gmflags 0");
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    98
	SENDIPC("eaddteam");
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
    99
	SendTeamConfig(0);
31
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   100
//	if () SENDIPC("rdriven");
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   101
	SENDIPC("ecolor 65535");
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   102
	SENDIPC("eadd hh0 0");
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   103
	SENDIPC("eadd hh1 0");
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   104
	SENDIPC("eadd hh2 0");
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   105
	SENDIPC("eadd hh3 0");
28
59f7db859b8a - clear demos list before adding items
unc0rr
parents: 26
diff changeset
   106
	SENDIPC("eadd hh4 0");
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   107
	SENDIPC("eaddteam");
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   108
	SendTeamConfig(1);
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   109
	SENDIPC("ecolor 16776960");
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   110
	SENDIPC("eadd hh0 1");
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   111
	SENDIPC("eadd hh1 1");
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   112
	SENDIPC("eadd hh2 1");
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   113
	SENDIPC("eadd hh3 1");
28
59f7db859b8a - clear demos list before adding items
unc0rr
parents: 26
diff changeset
   114
	SENDIPC("eadd hh4 1");
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   115
}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   116
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   117
void HWGame::ParseMessage()
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   118
{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   119
	switch(msgbuf[0])
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   120
	{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   121
		case '?':
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   122
		{
31
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   123
			if (gameType == gtNet)
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   124
				emit SendNet(QByteArray("\x01""?"));
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   125
			else
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   126
				SENDIPC("!");
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   127
			break;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   128
		}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   129
		case 'C':
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   130
		{
31
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   131
			if (gameType == gtNet)
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   132
			{
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   133
				SENDIPC("TN");
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   134
				emit SendNet(QByteArray("\x01""C"));
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   135
			}
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   136
			else
32
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   137
			{
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   138
				if (gameType == gtLocal)
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   139
				 	SendConfig();
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   140
			}
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   141
			break;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   142
		}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   143
		case '+':
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   144
		{
36
a803a00a3272 - Anti-flood and anti-lag changes
unc0rr
parents: 32
diff changeset
   145
			if (gameType == gtNet)
a803a00a3272 - Anti-flood and anti-lag changes
unc0rr
parents: 32
diff changeset
   146
			{
a803a00a3272 - Anti-flood and anti-lag changes
unc0rr
parents: 32
diff changeset
   147
				QByteArray tmpbuf = QByteArray::fromRawData((char *)&msgsize, 1) + QByteArray::fromRawData(msgbuf, msgsize);
a803a00a3272 - Anti-flood and anti-lag changes
unc0rr
parents: 32
diff changeset
   148
				emit SendNet(tmpbuf);
a803a00a3272 - Anti-flood and anti-lag changes
unc0rr
parents: 32
diff changeset
   149
			}
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   150
			break;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   151
		}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   152
		default:
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   153
		{
32
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   154
			QByteArray tmpbuf = QByteArray::fromRawData((char *)&msgsize, 1) + QByteArray::fromRawData(msgbuf, msgsize);
31
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   155
			if (gameType == gtNet)
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   156
			{
32
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   157
				emit SendNet(tmpbuf);
31
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   158
			}
32
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   159
			demo->append(tmpbuf);
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   160
		}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   161
	}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   162
}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   163
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   164
void HWGame::SendIPC(const char * msg, quint8 len)
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   165
{
32
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   166
	SendIPC(QByteArray::fromRawData(msg, len));
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   167
}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   168
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   169
void HWGame::SendIPC(const QByteArray & buf)
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   170
{
28
59f7db859b8a - clear demos list before adding items
unc0rr
parents: 26
diff changeset
   171
	if (buf.size() > MAXMSGCHARS) return;
32
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   172
	if (!IPCSocket)
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   173
	{
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   174
		toSendBuf += buf;
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   175
	} else
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   176
	{
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   177
		quint8 len = buf.size();
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   178
		RawSendIPC(QByteArray::fromRawData((char *)&len, 1) + buf);
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   179
	}
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   180
}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   181
31
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   182
void HWGame::RawSendIPC(const QByteArray & buf)
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   183
{
32
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   184
	if (!IPCSocket)
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   185
	{
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   186
		toSendBuf += buf;
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   187
	} else
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   188
	{
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   189
		if (toSendBuf.size() > 0)
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   190
		{
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   191
			IPCSocket->write(toSendBuf);
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   192
			demo->append(toSendBuf);
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   193
		}
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   194
		IPCSocket->write(buf);
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   195
		demo->append(buf);
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   196
	}
31
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   197
}
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   198
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   199
void HWGame::FromNet(const QByteArray & msg)
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   200
{
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   201
	RawSendIPC(msg);
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   202
}
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   203
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   204
void HWGame::ClientRead()
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   205
{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   206
	qint64 readbytes = 1;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   207
	while (readbytes > 0)
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   208
	{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   209
		if (msgsize == 0)
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   210
		{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   211
			msgbufsize = 0;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   212
			readbytes = IPCSocket->read((char *)&msgsize, 1);
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   213
		} else
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   214
		{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   215
			msgbufsize +=
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   216
			readbytes = IPCSocket->read((char *)&msgbuf[msgbufsize], msgsize - msgbufsize);
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   217
			if (msgbufsize = msgsize)
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   218
			{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   219
				ParseMessage();
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   220
				msgsize = 0;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   221
			}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   222
		}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   223
	}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   224
}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   225
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   226
void HWGame::Start()
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   227
{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   228
	QProcess * process;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   229
	QStringList arguments;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   230
	process = new QProcess;
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   231
	arguments << resolutions[0][vid_Resolution];
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   232
	arguments << resolutions[1][vid_Resolution];
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   233
	arguments << GetThemeBySeed();
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   234
	arguments << "46631";
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   235
	arguments << seed;
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   236
	arguments << (vid_Fullscreen ? "1" : "0");
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   237
	process->start("hw", arguments);
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   238
}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   239
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   240
void HWGame::AddTeam(const QString & teamname)
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   241
{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   242
	if (TeamCount == 5) return;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   243
	teams[TeamCount] = teamname;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   244
	TeamCount++;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   245
}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   246
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   247
QString HWGame::GetThemeBySeed()
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   248
{
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   249
	QFile themesfile(QString(DATA_PATH) + "/Themes/themes.cfg");
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   250
	QStringList themes;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   251
	if (themesfile.open(QIODevice::ReadOnly))
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   252
	{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   253
		QTextStream stream(&themesfile);
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   254
		QString str;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   255
		while (!stream.atEnd())
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   256
		{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   257
			themes << stream.readLine();
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   258
		}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   259
		themesfile.close();
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   260
	}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   261
	quint32 len = themes.size();
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   262
	if (len == 0)
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   263
	{
28
59f7db859b8a - clear demos list before adding items
unc0rr
parents: 26
diff changeset
   264
		QMessageBox::critical(0, "Error", "Cannot access themes.cfg or bad data", "OK");
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   265
		return "avematan";
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   266
	}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   267
	if (seed.isEmpty())
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   268
	{
28
59f7db859b8a - clear demos list before adding items
unc0rr
parents: 26
diff changeset
   269
		QMessageBox::critical(0, "Error", "seed not defined", "OK");
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   270
		return "avematan";
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   271
	}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   272
	quint32 k = 0;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   273
	for (int i = 0; i < seed.length(); i++)
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   274
	{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   275
		k += seed[i].unicode();
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   276
	}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   277
	return themes[k % len];
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   278
}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   279
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   280
void HWGame::SaveDemo(const QString & filename)
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   281
{
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   282
	QFile demofile(filename);
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   283
	if (!demofile.open(QIODevice::WriteOnly))
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   284
	{
28
59f7db859b8a - clear demos list before adding items
unc0rr
parents: 26
diff changeset
   285
		QMessageBox::critical(0,
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   286
				tr("Error"),
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   287
				tr("Cannot save demo to file %s").arg(filename),
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   288
				tr("Quit"));
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   289
		return ;
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   290
	}
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   291
	QDataStream stream(&demofile);
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   292
	stream.writeRawData(demo->constData(), demo->size());
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   293
	demofile.close();
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   294
	delete demo;
25
27aa8030322b - Get rid of old frontend
unc0rr
parents: 21
diff changeset
   295
}
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   296
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   297
void HWGame::PlayDemo(const QString & demofilename)
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   298
{
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   299
	gameType = gtDemo;
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   300
	QFile demofile(demofilename);
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   301
	if (!demofile.open(QIODevice::ReadOnly))
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   302
	{
28
59f7db859b8a - clear demos list before adding items
unc0rr
parents: 26
diff changeset
   303
		QMessageBox::critical(0,
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   304
				tr("Error"),
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   305
				tr("Cannot open demofile %s").arg(demofilename),
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   306
				tr("Quit"));
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   307
		return ;
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   308
	}
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   309
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   310
	// read demo
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   311
	QDataStream stream(&demofile);
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   312
	char buf[512];
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   313
	quint32 readbytes;
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   314
	do
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   315
	{
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   316
		readbytes = stream.readRawData((char *)&buf, 512);
32
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   317
		toSendBuf.append(QByteArray((char *)&buf, readbytes));
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   318
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   319
	} while (readbytes > 0);
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   320
	demofile.close();
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   321
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   322
	// cut seed
32
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   323
	quint32 index = toSendBuf.indexOf(10);
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   324
	if ((index < 3) || (index > 20))
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   325
	{
28
59f7db859b8a - clear demos list before adding items
unc0rr
parents: 26
diff changeset
   326
		QMessageBox::critical(0,
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   327
				tr("Error"),
32
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   328
				tr("Corrupted demo file %1").arg(demofilename),
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   329
				tr("Quit"));
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   330
		return ;
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   331
	}
32
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   332
	seed = QString(toSendBuf.left(index++));
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   333
	toSendBuf.remove(0, index);
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   334
32
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   335
	toSendBuf = QByteArray::fromRawData("\x02TD", 3) + toSendBuf;
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   336
	// run engine
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   337
	demo = new QByteArray;
32
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   338
	Start();
26
e32fa14529f8 Frontend lets define more binds
unc0rr
parents: 25
diff changeset
   339
}
31
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   340
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   341
void HWGame::StartNet(const QString & netseed)
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   342
{
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   343
	gameType = gtNet;
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   344
	seed = netseed;
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   345
	demo = new QByteArray;
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   346
	demo->append(seed.toLocal8Bit());
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   347
	demo->append(10);
32
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   348
	Start();
31
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   349
}
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   350
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   351
void HWGame::StartLocal()
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   352
{
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   353
	gameType = gtLocal;
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   354
	if (TeamCount < 2) return;
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   355
	seedgen.GenRNDStr(seed, 10);
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   356
	demo = new QByteArray;
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   357
	demo->append(seed.toLocal8Bit());
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   358
	demo->append(10);
32
78bff13b11c0 With this patch the game doesn't crash when gaming by net
unc0rr
parents: 31
diff changeset
   359
	Start();
31
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   360
}
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   361
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   362
void HWGame::LocalCFG(const QString & teamname)
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   363
{
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   364
	QFile teamcfg(cfgdir.absolutePath() + "/" + teamname + ".cfg");
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   365
	if (!teamcfg.open(QIODevice::ReadOnly))
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   366
	{
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   367
		return ;
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   368
	}
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   369
	QTextStream stream(&teamcfg);
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   370
	stream.setCodec("UTF-8");
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   371
	QString str;
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   372
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   373
	while (!stream.atEnd())
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   374
	{
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   375
		str = stream.readLine();
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   376
		if (str.startsWith(";") || (str.length() > 254)) continue;
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   377
		str.prepend("e");
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   378
		SendIPC(str.toLocal8Bit());
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   379
	}
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   380
	teamcfg.close();
99888245a4e8 Now net game is near available, but exception occurs...
unc0rr
parents: 28
diff changeset
   381
}