more code for local playing

This commit is contained in:
Max-Wilhelm Bruker 2010-08-14 17:01:14 +02:00
parent f6a340ddf3
commit 5ff099f4bc
15 changed files with 267 additions and 137 deletions

View file

@ -80,11 +80,25 @@ void MainWindow::actDisconnect()
void MainWindow::actSinglePlayer()
{
bool ok;
int numberPlayers = QInputDialog::getInt(this, tr("Number of players"), tr("Please enter the number of players."), 2, 1, 8, 1, &ok);
if (!ok)
return;
LocalServer *ls = new LocalServer(this);
LocalServerInterface *mainLsi = ls->newConnection();
LocalClient *mainClient = new LocalClient(mainLsi, this);
tabSupervisor->start(mainClient);
LocalClient *mainClient = new LocalClient(mainLsi, tr("Player %1").arg(1), this);
localClients.append(mainClient);
for (int i = 0; i < numberPlayers - 1; ++i) {
LocalServerInterface *slaveLsi = ls->newConnection();
LocalClient *slaveClient = new LocalClient(slaveLsi, tr("Player %1").arg(i + 2), this);
localClients.append(slaveClient);
}
tabSupervisor->startLocal(localClients);
Command_CreateGame *createCommand = new Command_CreateGame(QString(), QString(), numberPlayers, false, false, false, false);
mainClient->sendCommand(createCommand);
}
void MainWindow::actDeckEditor()