Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
644ea048
Commit
644ea048
authored
Aug 08, 2015
by
woogerboy21
Browse files
Merge pull request #1347 from woogerboy21/fix_clientid_localgame
Fix local game not starting properly.
parents
129a6983
afa2c67e
Changes
3
Show whitespace changes
Inline
Side-by-side
cockatrice/src/localclient.cpp
View file @
644ea048
...
@@ -3,13 +3,14 @@
...
@@ -3,13 +3,14 @@
#include
"pb/session_commands.pb.h"
#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
)
:
AbstractClient
(
parent
),
lsi
(
_lsi
)
{
{
connect
(
lsi
,
SIGNAL
(
itemToClient
(
const
ServerMessage
&
)),
this
,
SLOT
(
itemFromServer
(
const
ServerMessage
&
)));
connect
(
lsi
,
SIGNAL
(
itemToClient
(
const
ServerMessage
&
)),
this
,
SLOT
(
itemFromServer
(
const
ServerMessage
&
)));
Command_Login
loginCmd
;
Command_Login
loginCmd
;
loginCmd
.
set_user_name
(
_playerName
.
toStdString
());
loginCmd
.
set_user_name
(
_playerName
.
toStdString
());
loginCmd
.
set_clientid
(
_clientId
.
toStdString
());
sendCommand
(
prepareSessionCommand
(
loginCmd
));
sendCommand
(
prepareSessionCommand
(
loginCmd
));
Command_JoinRoom
joinCmd
;
Command_JoinRoom
joinCmd
;
...
...
cockatrice/src/localclient.h
View file @
644ea048
...
@@ -10,7 +10,7 @@ class LocalClient : public AbstractClient {
...
@@ -10,7 +10,7 @@ class LocalClient : public AbstractClient {
private:
private:
LocalServerInterface
*
lsi
;
LocalServerInterface
*
lsi
;
public:
public:
LocalClient
(
LocalServerInterface
*
_lsi
,
const
QString
&
_playerName
,
QObject
*
parent
=
0
);
LocalClient
(
LocalServerInterface
*
_lsi
,
const
QString
&
_playerName
,
const
QString
&
_clientId
,
QObject
*
parent
=
0
);
~
LocalClient
();
~
LocalClient
();
void
sendCommandContainer
(
const
CommandContainer
&
cont
);
void
sendCommandContainer
(
const
CommandContainer
&
cont
);
...
...
cockatrice/src/window_main.cpp
View file @
644ea048
...
@@ -189,13 +189,13 @@ void MainWindow::actSinglePlayer()
...
@@ -189,13 +189,13 @@ void MainWindow::actSinglePlayer()
localServer
=
new
LocalServer
(
this
);
localServer
=
new
LocalServer
(
this
);
LocalServerInterface
*
mainLsi
=
localServer
->
newConnection
();
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
;
QList
<
AbstractClient
*>
localClients
;
localClients
.
append
(
mainClient
);
localClients
.
append
(
mainClient
);
for
(
int
i
=
0
;
i
<
numberPlayers
-
1
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numberPlayers
-
1
;
++
i
)
{
LocalServerInterface
*
slaveLsi
=
localServer
->
newConnection
();
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
);
localClients
.
append
(
slaveClient
);
}
}
tabSupervisor
->
startLocal
(
localClients
);
tabSupervisor
->
startLocal
(
localClients
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment