QTfrontend/game.cpp
author unc0rr
Sun, 13 Nov 2005 22:13:58 +0000
changeset 21 dff476dcaaa3
parent 20 ccd2c45f043d
child 25 27aa8030322b
permissions -rw-r--r--
- Many improvements to frontend - Small optimization of generating random data in uRandom.pas
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
     1
/*
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
     2
 * Hedgewars, a worms-like game
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
     3
 * Copyright (c) 2005 Andrey Korotaev <unC0Rr@gmail.com>
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
     4
 *
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
     5
 * Distributed under the terms of the BSD-modified licence:
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
     6
 *
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
     7
 * Permission is hereby granted, free of charge, to any person obtaining a copy
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
     8
 * of this software and associated documentation files (the "Software"), to deal
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
     9
 * with the Software without restriction, including without limitation the
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    10
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    11
 * sell copies of the Software, and to permit persons to whom the Software is
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    12
 * furnished to do so, subject to the following conditions:
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    13
 *
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    14
 * 1. Redistributions of source code must retain the above copyright notice,
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    15
 *    this list of conditions and the following disclaimer.
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    16
 * 2. Redistributions in binary form must reproduce the above copyright notice,
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    17
 *    this list of conditions and the following disclaimer in the documentation
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    18
 *    and/or other materials provided with the distribution.
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    19
 * 3. The name of the author may not be used to endorse or promote products
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    20
 *    derived from this software without specific prior written permission.
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    21
 *
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    22
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    23
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    24
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    25
 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    26
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    27
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    28
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    29
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    30
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    31
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    32
 */
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    33
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    34
#include <QMessageBox>
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    35
#include <QProcess>
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    36
#include <QTimer>
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    37
#include <QFile>
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    38
#include <QString>
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    39
#include <QByteArray>
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    40
#include <QTextStream>
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    41
#include "game.h"
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    42
#include "hwconsts.h"
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    43
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    44
HWGame::HWGame()
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    45
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    46
	IPCServer = new QTcpServer(this);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    47
	IPCServer->setMaxPendingConnections(1);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    48
	if (!IPCServer->listen(QHostAddress("127.0.0.1"), IPC_PORT)) 
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    49
	{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    50
		QMessageBox::critical(this, tr("Error"),
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    51
				tr("Unable to start the server: %1.")
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    52
				.arg(IPCServer->errorString()));
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    53
	}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    54
	connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection()));
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    55
	IPCSocket = 0;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    56
	TeamCount = 0;
21
dff476dcaaa3 - Many improvements to frontend
unc0rr
parents: 20
diff changeset
    57
	seed = "seed";
20
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    58
}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    59
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    60
void HWGame::NewConnection()
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    61
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    62
	QTcpSocket * client = IPCServer->nextPendingConnection();
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    63
	if(!IPCSocket)
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    64
	{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    65
		IPCSocket = client;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    66
		connect(client, SIGNAL(disconnected()), this, SLOT(ClientDisconnect()));
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    67
		connect(client, SIGNAL(readyRead()), this, SLOT(ClientRead()));
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    68
		msgsize = 0;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    69
	} else
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    70
	{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    71
		client->disconnectFromHost();
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    72
		delete client;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    73
	}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    74
}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    75
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    76
void HWGame::ClientDisconnect()
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    77
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    78
	IPCSocket = 0;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    79
	delete this;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    80
}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    81
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    82
void HWGame::SendTeamConfig(int index)
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    83
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    84
	QFile teamcfg(teams[index]);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    85
	if (!teamcfg.open(QIODevice::ReadOnly))
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    86
	{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    87
		return ;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    88
	}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    89
	QTextStream stream(&teamcfg);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    90
	stream.setCodec("UTF-8");	
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    91
	QString str;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    92
	
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    93
	while (!stream.atEnd())
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    94
	{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    95
		str = stream.readLine();
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    96
		if (str.startsWith(";")) continue;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    97
		str.prepend("e");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    98
		SendIPC(str.toLocal8Bit());
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    99
	}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   100
	teamcfg.close();
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   101
}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   102
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   103
void HWGame::SendConfig()
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   104
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   105
	SENDIPC("TL");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   106
	SENDIPC("e$gmflags 0");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   107
	SENDIPC("eaddteam");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   108
	SendTeamConfig(0);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   109
	SENDIPC("ecolor 65535");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   110
	SENDIPC("eadd hh0 0");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   111
	SENDIPC("eadd hh1 0");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   112
	SENDIPC("eadd hh2 0");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   113
	SENDIPC("eadd hh3 0");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   114
	SENDIPC("eaddteam");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   115
	SendTeamConfig(1);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   116
	SENDIPC("ecolor 16776960");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   117
	SENDIPC("eadd hh0 1");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   118
	SENDIPC("eadd hh1 1");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   119
	SENDIPC("eadd hh2 1");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   120
	SENDIPC("eadd hh3 1");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   121
}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   122
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   123
void HWGame::ParseMessage()
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   124
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   125
	switch(msgsize) {
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   126
		case 1: switch(msgbuf[0]) {
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   127
			case '?': {
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   128
				SENDIPC("!");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   129
				break;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   130
			}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   131
		}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   132
		case 5: switch(msgbuf[0]) {
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   133
			case 'C': {
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   134
				SendConfig();
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   135
				break;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   136
			}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   137
		}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   138
	}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   139
}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   140
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   141
void HWGame::SendIPC(const char* msg, unsigned char len)
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   142
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   143
	IPCSocket->write((char *)&len, 1);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   144
	IPCSocket->write(msg, len);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   145
}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   146
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   147
void HWGame::SendIPC(const QByteArray buf)
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   148
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   149
	if (buf.size() > 255) return;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   150
	unsigned char len = buf.size();
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   151
	IPCSocket->write((char *)&len, 1);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   152
	IPCSocket->write(buf);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   153
}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   154
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   155
void HWGame::ClientRead()
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   156
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   157
	qint64 readbytes = 1;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   158
	while (readbytes > 0) 
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   159
	{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   160
		if (msgsize == 0) 
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   161
		{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   162
			msgbufsize = 0;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   163
			readbytes = IPCSocket->read((char *)&msgsize, 1);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   164
		} else
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   165
		{
21
dff476dcaaa3 - Many improvements to frontend
unc0rr
parents: 20
diff changeset
   166
			msgbufsize += 
dff476dcaaa3 - Many improvements to frontend
unc0rr
parents: 20
diff changeset
   167
			readbytes = IPCSocket->read((char *)&msgbuf[msgbufsize], msgsize - msgbufsize);
20
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   168
			if (msgbufsize = msgsize)
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   169
			{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   170
				ParseMessage();
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   171
				msgsize = 0;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   172
			}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   173
		}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   174
	}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   175
}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   176
21
dff476dcaaa3 - Many improvements to frontend
unc0rr
parents: 20
diff changeset
   177
void HWGame::Start(int Resolution, bool Fullscreen)
20
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   178
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   179
	if (TeamCount < 2) return;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   180
	QProcess * process;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   181
	QStringList arguments;
21
dff476dcaaa3 - Many improvements to frontend
unc0rr
parents: 20
diff changeset
   182
	seedgen.GenRNDStr(seed, 10);
20
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   183
	process = new QProcess;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   184
	arguments << resolutions[0][Resolution];
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   185
	arguments << resolutions[1][Resolution];
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   186
	arguments << "avematan";
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   187
	arguments << "46631";
21
dff476dcaaa3 - Many improvements to frontend
unc0rr
parents: 20
diff changeset
   188
	arguments << seed;
dff476dcaaa3 - Many improvements to frontend
unc0rr
parents: 20
diff changeset
   189
	arguments << (Fullscreen ? "1" : "0");
20
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   190
	process->start("hw", arguments);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   191
}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   192
21
dff476dcaaa3 - Many improvements to frontend
unc0rr
parents: 20
diff changeset
   193
void HWGame::AddTeam(const QString & teamname)
20
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   194
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   195
	if (TeamCount == 5) return;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   196
	teams[TeamCount] = teamname;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   197
	TeamCount++;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   198
}