[Kde-games-devel] Re: Sending a message to one KGame client

Andreas Beckermann kde-games-devel@mail.kde.org
Tue, 25 Feb 2003 20:28:58 +0100


On Monday 24 February 2003 23:06, Neil Stevens wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Tuesday February 18, 2003 10:56, Andreas Beckermann wrote:
> > No.
> > It might be possible that the KGame ID matches the KMessageClient id,
> > but I am not sure. I will have a look.
> >
> > About the player ID: the *cannot* match the KMessageClient id. E.g. if
> > you have two different players on one client you need to be able to
> > distinguish a message to player A from a message to player B, although
> > the message is for the same client.
>
> I really don't know where to go from here then.  In my browsing of the
> docs, I see no way of finding a MessageClient that goes with a Player.

I've checked it: the KMessageClient ID is equal to the KGame id (i.e. 
KGame::gameId()).

As said - you *cannot* provide a player ID to the KMessageClient, as one 
client can have multiple players (e.g. two human players sharing one keyboard 
or one human player and one computer player running on the same computer, 
...). The logic to send the message to the specified player is in 
KGameNetwork::receiveNetworkTransmission().

I will soon provide some more code and docs for this, so that you can provide 
a player ID to KGame::sendMessage() and it will be sent to one client (the 
one that contains the player) only.

I think (didn't try - Martin? Do you still remember this one?) that you can 
already provide the KPlayer::id() to KGame::sendMessage() which will then end 
up in the desired KPlayer (KPlayer::networkTransmission()).

CU
Andi