Merge pull request #1347 from woogerboy21/fix_clientid_localgame
Fix local game not starting properly.
This commit is contained in:
commit
644ea0482f
3 changed files with 29 additions and 28 deletions
|
@ -3,13 +3,14 @@
|
|||
|
||||
#include "pb/session_commands.pb.h"
|
||||
|
||||
LocalClient::LocalClient(LocalServerInterface *_lsi, const QString &_playerName, QObject *parent)
|
||||
LocalClient::LocalClient(LocalServerInterface *_lsi, const QString &_playerName, const QString &_clientId, QObject *parent)
|
||||
: AbstractClient(parent), lsi(_lsi)
|
||||
{
|
||||
connect(lsi, SIGNAL(itemToClient(const ServerMessage &)), this, SLOT(itemFromServer(const ServerMessage &)));
|
||||
|
||||
Command_Login loginCmd;
|
||||
loginCmd.set_user_name(_playerName.toStdString());
|
||||
loginCmd.set_clientid(_clientId.toStdString());
|
||||
sendCommand(prepareSessionCommand(loginCmd));
|
||||
|
||||
Command_JoinRoom joinCmd;
|
||||
|
|
|
@ -10,7 +10,7 @@ class LocalClient : public AbstractClient {
|
|||
private:
|
||||
LocalServerInterface *lsi;
|
||||
public:
|
||||
LocalClient(LocalServerInterface *_lsi, const QString &_playerName, QObject *parent = 0);
|
||||
LocalClient(LocalServerInterface *_lsi, const QString &_playerName, const QString &_clientId, QObject *parent = 0);
|
||||
~LocalClient();
|
||||
|
||||
void sendCommandContainer(const CommandContainer &cont);
|
||||
|
|
|
@ -189,13 +189,13 @@ void MainWindow::actSinglePlayer()
|
|||
|
||||
localServer = new LocalServer(this);
|
||||
LocalServerInterface *mainLsi = localServer->newConnection();
|
||||
LocalClient *mainClient = new LocalClient(mainLsi, tr("Player %1").arg(1), this);
|
||||
LocalClient *mainClient = new LocalClient(mainLsi, tr("Player %1").arg(1), settingsCache->getClientID(), this);
|
||||
QList<AbstractClient *> localClients;
|
||||
localClients.append(mainClient);
|
||||
|
||||
for (int i = 0; i < numberPlayers - 1; ++i) {
|
||||
LocalServerInterface *slaveLsi = localServer->newConnection();
|
||||
LocalClient *slaveClient = new LocalClient(slaveLsi, tr("Player %1").arg(i + 2), this);
|
||||
LocalClient *slaveClient = new LocalClient(slaveLsi, tr("Player %1").arg(i + 2), settingsCache->getClientID(), this);
|
||||
localClients.append(slaveClient);
|
||||
}
|
||||
tabSupervisor->startLocal(localClients);
|
||||
|
|
Loading…
Reference in a new issue