#include <kgamemessage.h>
Public Types | |
| enum | GameMessageIds { IdSetupGame = 1, IdSetupGameContinue = 2, IdGameLoad = 3, IdGameConnected = 4, IdSyncRandom = 5, IdDisconnect = 6, IdGameSetupDone = 7, IdPlayerProperty = 20, IdGameProperty = 21, IdAddPlayer = 30, IdRemovePlayer = 31, IdActivatePlayer = 32, IdInactivatePlayer = 33, IdTurn = 34, IdError = 100, IdPlayerInput = 101, IdIOAdded = 102, IdProcessQuery = 220, IdPlayerId = 221, IdUser = 256 } |
| Message Ids used inside KGame. More... | |
Static Public Member Functions | |
| static Q_UINT32 | createPlayerId (int player, Q_UINT32 game) |
| Creates a fully qualified player ID which contains the original player id in the lower bits and the game number in the higher bits. | |
| static int | rawPlayerId (Q_UINT32 playerid) |
| Returns the raw playerid, that is, a id which does not contain the game number encoded in it. | |
| static Q_UINT32 | rawGameId (Q_UINT32 playerid) |
| Returns the raw game id, that is, the game id the player belongs to. | |
| static bool | isPlayer (Q_UINT32 id) |
| Checks whether a message receiver/sender is a player. | |
| static bool | isGame (Q_UINT32 id) |
| Checks whether the sender/receiver of a message is a game. | |
| static void | createHeader (QDataStream &msg, Q_UINT32 sender, Q_UINT32 receiver, int msgid) |
| Creates a message header given cookie,sender,receiver,. | |
| static void | extractHeader (QDataStream &msg, Q_UINT32 &sender, Q_UINT32 &receiver, int &msgid) |
| Retrieves the information like cookie,sender,receiver,. | |
| static void | createPropertyHeader (QDataStream &msg, int id) |
| Creates a property header given the property id. | |
| static void | extractPropertyHeader (QDataStream &msg, int &id) |
| Retrieves the property id from a property message header. | |
| static void | createPropertyCommand (QDataStream &msg, int cmdid, int pid, int cmd) |
| Creates a property header given the property id. | |
| static void | extractPropertyCommand (QDataStream &msg, int &pid, int &cmd) |
| Retrieves the property id from a property message header. | |
| static int | version () |
| static QString | messageId2Text (int msgid) |
| This function takes a GameMessageIds as argument and returns a suitable string for it. | |
Definition at line 29 of file kgamemessage.h.
|
|
Message Ids used inside KGame.
You can use your own custom message Id by adding
Definition at line 139 of file kgamemessage.h. |
|
||||||||||||||||||||
|
Creates a message header given cookie,sender,receiver,. .. Also puts "hidden" header into the stream which are used by KGameClient (message length and magic cookie). If you don't need them remove them with dropExternalHeader Definition at line 63 of file kgamemessage.cpp. Referenced by KGameProcessIO::sendAllMessages(), KGameProcess::sendSystemMessage(), and KGameNetwork::sendSystemMessage(). |
|
||||||||||||
|
Creates a fully qualified player ID which contains the original player id in the lower bits and the game number in the higher bits. Do not rely on the exact bit positions as they are internal. See also rawPlayerId and rawGameId which are the inverse operations
Definition at line 30 of file kgamemessage.cpp. Referenced by KGame::addPlayer(). |
|
||||||||||||||||||||
|
Creates a property header given the property id.
Definition at line 87 of file kgamemessage.cpp. References createPropertyHeader(). Referenced by KGamePropertyList< type >::append(), KGamePropertyList< type >::clear(), KGamePropertyList< type >::erase(), KGamePropertyArray< type >::fill(), KGamePropertyList< type >::insert(), KGamePropertyArray< type >::resize(), KGamePropertyArray< type >::setAt(), KGamePropertyBase::setLock(), and KGamePropertyArray< type >::sort(). Here is the call graph for this function: ![]() |
|
||||||||||||
|
Creates a property header given the property id.
Definition at line 75 of file kgamemessage.cpp. Referenced by createPropertyCommand(), KGamePropertyHandler::save(), and KGamePropertyBase::sendProperty(). |
|
||||||||||||||||||||
|
Retrieves the information like cookie,sender,receiver,. .. from a message header Note that it could be necessary to call dropExternalHeader first Definition at line 68 of file kgamemessage.cpp. Referenced by KGameProcess::receivedMessage(), KGameProcessIO::receivedMessage(), and KGameNetwork::receiveNetworkTransmission(). |
|
||||||||||||||||
|
Retrieves the property id from a property message header.
Definition at line 94 of file kgamemessage.cpp. Referenced by KGamePropertyList< type >::extractProperty(), KGamePropertyArray< type >::extractProperty(), and KGamePropertyHandler::processMessage(). |
|
||||||||||||
|
Retrieves the property id from a property message header.
Definition at line 80 of file kgamemessage.cpp. Referenced by KGamePropertyList< type >::extractProperty(), KGamePropertyArray< type >::extractProperty(), and KGamePropertyHandler::processMessage(). |
|
|
Checks whether the sender/receiver of a message is a game.
Definition at line 57 of file kgamemessage.cpp. References isPlayer(). Here is the call graph for this function: ![]() |
|
|
Checks whether a message receiver/sender is a player.
Definition at line 48 of file kgamemessage.cpp. Referenced by isGame(), KGame::networkTransmission(), and KGameNetwork::receiveNetworkTransmission(). |
|
|
This function takes a GameMessageIds as argument and returns a suitable string for it. This string can't be used to identify a message (as it is i18n'ed) but it can make debugging more easy. See also KGameDebugDialog.
Definition at line 108 of file kgamemessage.cpp. References IdActivatePlayer, IdAddPlayer, IdDisconnect, IdError, IdGameConnected, IdGameLoad, IdGameProperty, IdGameSetupDone, IdInactivatePlayer, IdIOAdded, IdPlayerId, IdPlayerInput, IdPlayerProperty, IdProcessQuery, IdRemovePlayer, IdSetupGame, IdSetupGameContinue, IdSyncRandom, IdTurn, and IdUser. Referenced by KGameDebugDialog::slotMessageUpdate(). |
|
|
Returns the raw game id, that is, the game id the player belongs to. Se also createPlayerId which is the inverse operation.
Definition at line 43 of file kgamemessage.cpp. Referenced by KGameNetwork::receiveNetworkTransmission(), and KGameNetwork::sendSystemMessage(). |
|
|
Returns the raw playerid, that is, a id which does not contain the game number encoded in it. See also createPlayerId which is the inverse operation.
Definition at line 38 of file kgamemessage.cpp. Referenced by KGameNetwork::sendSystemMessage(). |
|
|
Definition at line 103 of file kgamemessage.cpp. References MESSAGE_VERSION. Referenced by KGameError::errVersion(), and KGame::negotiateNetworkGame(). |
1.4.6