QTfrontend/game.cpp
author unc0rr
Wed, 09 Nov 2005 18:31:11 +0000
changeset 20 ccd2c45f043d
child 21 dff476dcaaa3
permissions -rw-r--r--
frontend rewrite for QT4
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;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    57
}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    58
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    59
void HWGame::NewConnection()
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    60
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    61
	QTcpSocket * client = IPCServer->nextPendingConnection();
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    62
	if(!IPCSocket)
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    63
	{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    64
		IPCSocket = client;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    65
		connect(client, SIGNAL(disconnected()), this, SLOT(ClientDisconnect()));
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    66
		connect(client, SIGNAL(readyRead()), this, SLOT(ClientRead()));
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    67
		msgsize = 0;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    68
	} else
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    69
	{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    70
		client->disconnectFromHost();
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    71
		delete client;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    72
	}
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
void HWGame::ClientDisconnect()
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    76
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    77
	IPCSocket = 0;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    78
	delete this;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    79
}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    80
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    81
void HWGame::SendTeamConfig(int index)
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    82
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    83
	QFile teamcfg(teams[index]);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    84
	if (!teamcfg.open(QIODevice::ReadOnly))
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    85
	{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    86
		return ;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    87
	}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    88
	QTextStream stream(&teamcfg);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    89
	stream.setCodec("UTF-8");	
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    90
	QString str;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    91
	
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    92
	while (!stream.atEnd())
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    93
	{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    94
		str = stream.readLine();
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    95
		if (str.startsWith(";")) continue;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    96
		str.prepend("e");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    97
		SendIPC(str.toLocal8Bit());
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    98
	}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
    99
	teamcfg.close();
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   100
}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   101
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   102
void HWGame::SendConfig()
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   103
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   104
	SENDIPC("TL");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   105
	SENDIPC("e$gmflags 0");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   106
	SENDIPC("eaddteam");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   107
	SendTeamConfig(0);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   108
	SENDIPC("ecolor 65535");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   109
	SENDIPC("eadd hh0 0");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   110
	SENDIPC("eadd hh1 0");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   111
	SENDIPC("eadd hh2 0");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   112
	SENDIPC("eadd hh3 0");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   113
	SENDIPC("eaddteam");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   114
	SendTeamConfig(1);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   115
	SENDIPC("ecolor 16776960");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   116
	SENDIPC("eadd hh0 1");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   117
	SENDIPC("eadd hh1 1");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   118
	SENDIPC("eadd hh2 1");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   119
	SENDIPC("eadd hh3 1");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   120
}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   121
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   122
void HWGame::ParseMessage()
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   123
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   124
	switch(msgsize) {
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   125
		case 1: switch(msgbuf[0]) {
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   126
			case '?': {
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   127
				SENDIPC("!");
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   128
				break;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   129
			}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   130
		}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   131
		case 5: switch(msgbuf[0]) {
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   132
			case 'C': {
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   133
				SendConfig();
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   134
				break;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   135
			}
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
void HWGame::SendIPC(const char* msg, unsigned char len)
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   141
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   142
	IPCSocket->write((char *)&len, 1);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   143
	IPCSocket->write(msg, len);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   144
}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   145
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   146
void HWGame::SendIPC(const QByteArray buf)
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   147
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   148
	if (buf.size() > 255) return;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   149
	unsigned char len = buf.size();
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   150
	IPCSocket->write((char *)&len, 1);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   151
	IPCSocket->write(buf);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   152
}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   153
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   154
void HWGame::ClientRead()
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   155
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   156
	qint64 readbytes = 1;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   157
	while (readbytes > 0) 
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   158
	{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   159
		if (msgsize == 0) 
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   160
		{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   161
			msgbufsize = 0;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   162
			readbytes = IPCSocket->read((char *)&msgsize, 1);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   163
		} else
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   164
		{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   165
			msgbufsize += readbytes = IPCSocket->read((char *)&msgbuf[msgbufsize], msgsize - msgbufsize);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   166
			if (msgbufsize = msgsize)
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   167
			{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   168
				ParseMessage();
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   169
				msgsize = 0;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   170
			}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   171
		}
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
void HWGame::Start(int Resolution)
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   176
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   177
	if (TeamCount < 2) return;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   178
	QProcess * process;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   179
	QStringList arguments;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   180
	process = new QProcess;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   181
	arguments << resolutions[0][Resolution];
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   182
	arguments << resolutions[1][Resolution];
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   183
	arguments << "avematan";
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   184
	arguments << "46631";
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   185
	arguments << "=seed=";
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   186
	arguments << "1";
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   187
	process->start("hw", arguments);
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   188
}
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   189
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   190
void HWGame::AddTeam(const QString teamname)
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   191
{
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   192
	if (TeamCount == 5) return;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   193
	teams[TeamCount] = teamname;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   194
	TeamCount++;
ccd2c45f043d frontend rewrite for QT4
unc0rr
parents:
diff changeset
   195
}