summaryrefslogtreecommitdiffstats
path: root/libkdegames/kgame/kgamenetwork.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
commit838baf3f99ec5ab81b063eb5449a3381d860f377 (patch)
treedd31abcfde08ca92e4623b8f50b3d762a87c997a /libkdegames/kgame/kgamenetwork.cpp
parent2bf598bafa22fac4126fc8842df6b0119aadc0e9 (diff)
downloadtdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.tar.gz
tdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.zip
TQt4 port kdegames
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1236074 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkdegames/kgame/kgamenetwork.cpp')
-rw-r--r--libkdegames/kgame/kgamenetwork.cpp78
1 files changed, 39 insertions, 39 deletions
diff --git a/libkdegames/kgame/kgamenetwork.cpp b/libkdegames/kgame/kgamenetwork.cpp
index 92669834..2fe901b3 100644
--- a/libkdegames/kgame/kgamenetwork.cpp
+++ b/libkdegames/kgame/kgamenetwork.cpp
@@ -50,7 +50,7 @@ public:
public:
KMessageClient* mMessageClient;
KMessageServer* mMessageServer;
- Q_UINT32 mDisconnectId; // Stores gameId() over a disconnect process
+ TQ_UINT32 mDisconnectId; // Stores gameId() over a disconnect process
DNSSD::PublicService* mService;
TQString mType;
TQString mName;
@@ -59,10 +59,10 @@ public:
};
// ------------------- NETWORK GAME ------------------------
-KGameNetwork::KGameNetwork(int c, TQObject* parent) : TQObject(parent, 0)
+KGameNetwork::KGameNetwork(int c, TQObject* tqparent) : TQObject(tqparent, 0)
{
d = new KGameNetworkPrivate;
- d->mCookie = (Q_INT16)c;
+ d->mCookie = (TQ_INT16)c;
// Init the game as a local game, i.e.
// create your own KMessageServer and a KMessageClient connected to it.
@@ -83,7 +83,7 @@ KGameNetwork::~KGameNetwork()
bool KGameNetwork::isNetwork() const
{ return isOfferingConnections() || d->mMessageClient->isNetwork();}
-Q_UINT32 KGameNetwork::gameId() const
+TQ_UINT32 KGameNetwork::gameId() const
{
//return d->mMessageClient->id() ;
// Return stored id in the case of disconnect. In any other
@@ -120,25 +120,25 @@ void KGameNetwork::setMaster()
}
if (!d->mMessageClient) {
d->mMessageClient = new KMessageClient (this);
- connect (d->mMessageClient, TQT_SIGNAL(broadcastReceived(const TQByteArray&, Q_UINT32)),
- this, TQT_SLOT(receiveNetworkTransmission(const TQByteArray&, Q_UINT32)));
+ connect (d->mMessageClient, TQT_SIGNAL(broadcastReceived(const TQByteArray&, TQ_UINT32)),
+ this, TQT_SLOT(receiveNetworkTransmission(const TQByteArray&, TQ_UINT32)));
connect (d->mMessageClient, TQT_SIGNAL(connectionBroken()),
this, TQT_SIGNAL(signalConnectionBroken()));
- connect (d->mMessageClient, TQT_SIGNAL(aboutToDisconnect(Q_UINT32)),
- this, TQT_SLOT(aboutToLoseConnection(Q_UINT32)));
+ connect (d->mMessageClient, TQT_SIGNAL(aboutToDisconnect(TQ_UINT32)),
+ this, TQT_SLOT(aboutToLoseConnection(TQ_UINT32)));
connect (d->mMessageClient, TQT_SIGNAL(connectionBroken()),
this, TQT_SLOT(slotResetConnection()));
connect (d->mMessageClient, TQT_SIGNAL(adminStatusChanged(bool)),
this, TQT_SLOT(slotAdminStatusChanged(bool)));
- connect (d->mMessageClient, TQT_SIGNAL(eventClientConnected(Q_UINT32)),
- this, TQT_SIGNAL(signalClientConnected(Q_UINT32)));
- connect (d->mMessageClient, TQT_SIGNAL(eventClientDisconnected(Q_UINT32, bool)),
- this, TQT_SIGNAL(signalClientDisconnected(Q_UINT32, bool)));
+ connect (d->mMessageClient, TQT_SIGNAL(eventClientConnected(TQ_UINT32)),
+ this, TQT_SIGNAL(signalClientConnected(TQ_UINT32)));
+ connect (d->mMessageClient, TQT_SIGNAL(eventClientDisconnected(TQ_UINT32, bool)),
+ this, TQT_SIGNAL(signalClientDisconnected(TQ_UINT32, bool)));
// broacast and direct messages are treated equally on receive.
- connect (d->mMessageClient, TQT_SIGNAL(forwardReceived(const TQByteArray&, Q_UINT32, const TQValueList<Q_UINT32>&)),
- d->mMessageClient, TQT_SIGNAL(broadcastReceived(const TQByteArray&, Q_UINT32)));
+ connect (d->mMessageClient, TQT_SIGNAL(forwardReceived(const TQByteArray&, TQ_UINT32, const TQValueList<TQ_UINT32>&)),
+ d->mMessageClient, TQT_SIGNAL(broadcastReceived(const TQByteArray&, TQ_UINT32)));
} else {
// should be no problem but still has to be tested
@@ -171,7 +171,7 @@ void KGameNetwork::tryStopPublishing()
if (d->mService) d->mService->stop();
}
-bool KGameNetwork::offerConnections(Q_UINT16 port)
+bool KGameNetwork::offerConnections(TQ_UINT16 port)
{
kdDebug (11001) << k_funcinfo << "on port " << port << endl;
if (!isMaster()) {
@@ -201,7 +201,7 @@ bool KGameNetwork::offerConnections(Q_UINT16 port)
return true;
}
-bool KGameNetwork::connectToServer (const TQString& host, Q_UINT16 port)
+bool KGameNetwork::connectToServer (const TQString& host, TQ_UINT16 port)
{
if (host.isEmpty()) {
kdError(11001) << k_funcinfo << "No hostname given" << endl;
@@ -239,7 +239,7 @@ bool KGameNetwork::connectToServer (const TQString& host, Q_UINT16 port)
return true;
}
-Q_UINT16 KGameNetwork::port() const
+TQ_UINT16 KGameNetwork::port() const
{
if (isNetwork()) {
if (isOfferingConnections()) {
@@ -276,8 +276,8 @@ void KGameNetwork::disconnect()
kdDebug(11001) << k_funcinfo << endl;
stopServerConnection();
if (d->mMessageServer) {
- TQValueList <Q_UINT32> list=d->mMessageServer->clientIDs();
- TQValueList<Q_UINT32>::Iterator it;
+ TQValueList <TQ_UINT32> list=d->mMessageServer->clientIDs();
+ TQValueList<TQ_UINT32>::Iterator it;
for( it = list.begin(); it != list.end(); ++it )
{
kdDebug(11001) << "Client id=" << (*it) << endl;
@@ -320,7 +320,7 @@ void KGameNetwork::disconnect()
kdDebug(11001) << k_funcinfo << "DONE" << endl;
}
-void KGameNetwork::aboutToLoseConnection(Q_UINT32 clientID)
+void KGameNetwork::aboutToLoseConnection(TQ_UINT32 clientID)
{
kdDebug(11001) << "Storing client id of connection "<<clientID<<endl;
d->mDisconnectId = clientID;
@@ -332,7 +332,7 @@ void KGameNetwork::slotResetConnection()
d->mDisconnectId = 0;
}
-void KGameNetwork::electAdmin(Q_UINT32 clientID)
+void KGameNetwork::electAdmin(TQ_UINT32 clientID)
{
if (!isAdmin()) {
kdWarning(11001) << k_funcinfo << "only ADMIN is allowed to call this!" << endl;
@@ -340,7 +340,7 @@ void KGameNetwork::electAdmin(Q_UINT32 clientID)
}
TQByteArray buffer;
TQDataStream stream(buffer,IO_WriteOnly);
- stream << static_cast<Q_UINT32>( KMessageServer::REQ_ADMIN_CHANGE );
+ stream << static_cast<TQ_UINT32>( KMessageServer::RETQ_ADMIN_CHANGE );
stream << clientID;
d->mMessageClient->sendServerMessage(buffer);
}
@@ -353,8 +353,8 @@ void KGameNetwork::setMaxClients(int max)
}
TQByteArray buffer;
TQDataStream stream(buffer,IO_WriteOnly);
- stream << static_cast<Q_UINT32>( KMessageServer::REQ_MAX_NUM_CLIENTS );
- stream << (Q_INT32)max;
+ stream << static_cast<TQ_UINT32>( KMessageServer::RETQ_MAX_NUM_CLIENTS );
+ stream << (TQ_INT32)max;
d->mMessageClient->sendServerMessage(buffer);
}
@@ -374,7 +374,7 @@ void KGameNetwork::unlock()
// --------------------- send messages ---------------------------
-bool KGameNetwork::sendSystemMessage(int data, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
+bool KGameNetwork::sendSystemMessage(int data, int msgid, TQ_UINT32 receiver, TQ_UINT32 sender)
{
TQByteArray buffer;
TQDataStream stream(buffer,IO_WriteOnly);
@@ -382,7 +382,7 @@ bool KGameNetwork::sendSystemMessage(int data, int msgid, Q_UINT32 receiver, Q_U
return sendSystemMessage(buffer,msgid,receiver,sender);
}
-bool KGameNetwork::sendSystemMessage(const TQString &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
+bool KGameNetwork::sendSystemMessage(const TQString &msg, int msgid, TQ_UINT32 receiver, TQ_UINT32 sender)
{
TQByteArray buffer;
TQDataStream stream(buffer, IO_WriteOnly);
@@ -390,10 +390,10 @@ bool KGameNetwork::sendSystemMessage(const TQString &msg, int msgid, Q_UINT32 re
return sendSystemMessage(buffer, msgid, receiver, sender);
}
-bool KGameNetwork::sendSystemMessage(const TQDataStream &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
+bool KGameNetwork::sendSystemMessage(const TQDataStream &msg, int msgid, TQ_UINT32 receiver, TQ_UINT32 sender)
{ return sendSystemMessage(((TQBuffer*)msg.device())->buffer(), msgid, receiver, sender); }
-bool KGameNetwork::sendSystemMessage(const TQByteArray& data, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
+bool KGameNetwork::sendSystemMessage(const TQByteArray& data, int msgid, TQ_UINT32 receiver, TQ_UINT32 sender)
{
TQByteArray buffer;
TQDataStream stream(buffer,IO_WriteOnly);
@@ -401,7 +401,7 @@ bool KGameNetwork::sendSystemMessage(const TQByteArray& data, int msgid, Q_UINT3
sender = gameId();
}
- Q_UINT32 receiverClient = KGameMessage::rawGameId(receiver); // KGame::gameId()
+ TQ_UINT32 receiverClient = KGameMessage::rawGameId(receiver); // KGame::gameId()
int receiverPlayer = KGameMessage::rawPlayerId(receiver); // KPlayer::id()
KGameMessage::createHeader(stream, sender, receiver, msgid);
@@ -435,35 +435,35 @@ bool KGameNetwork::sendSystemMessage(const TQByteArray& data, int msgid, Q_UINT3
return true;
}
-bool KGameNetwork::sendMessage(int data, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
+bool KGameNetwork::sendMessage(int data, int msgid, TQ_UINT32 receiver, TQ_UINT32 sender)
{ return sendSystemMessage(data,msgid+KGameMessage::IdUser,receiver,sender); }
-bool KGameNetwork::sendMessage(const TQString &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
+bool KGameNetwork::sendMessage(const TQString &msg, int msgid, TQ_UINT32 receiver, TQ_UINT32 sender)
{ return sendSystemMessage(msg,msgid+KGameMessage::IdUser,receiver,sender); }
-bool KGameNetwork::sendMessage(const TQDataStream &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
+bool KGameNetwork::sendMessage(const TQDataStream &msg, int msgid, TQ_UINT32 receiver, TQ_UINT32 sender)
{ return sendSystemMessage(msg, msgid+KGameMessage::IdUser, receiver, sender); }
-bool KGameNetwork::sendMessage(const TQByteArray &msg, int msgid, Q_UINT32 receiver, Q_UINT32 sender)
+bool KGameNetwork::sendMessage(const TQByteArray &msg, int msgid, TQ_UINT32 receiver, TQ_UINT32 sender)
{ return sendSystemMessage(msg, msgid+KGameMessage::IdUser, receiver, sender); }
-void KGameNetwork::sendError(int error,const TQByteArray& message, Q_UINT32 receiver, Q_UINT32 sender)
+void KGameNetwork::sendError(int error,const TQByteArray& message, TQ_UINT32 receiver, TQ_UINT32 sender)
{
TQByteArray buffer;
TQDataStream stream(buffer,IO_WriteOnly);
- stream << (Q_INT32) error;
+ stream << (TQ_INT32) error;
stream.writeRawBytes(message.data(), message.size());
sendSystemMessage(stream,KGameMessage::IdError,receiver,sender);
}
// ----------------- receive messages from the network
-void KGameNetwork::receiveNetworkTransmission(const TQByteArray& receiveBuffer, Q_UINT32 clientID)
+void KGameNetwork::receiveNetworkTransmission(const TQByteArray& receiveBuffer, TQ_UINT32 clientID)
{
TQDataStream stream(receiveBuffer, IO_ReadOnly);
int msgid;
- Q_UINT32 sender; // the id of the KGame/KPlayer who sent the message
- Q_UINT32 receiver; // the id of the KGame/KPlayer the message is for
+ TQ_UINT32 sender; // the id of the KGame/KPlayer who sent the message
+ TQ_UINT32 receiver; // the id of the KGame/KPlayer the message is for
KGameMessage::extractHeader(stream, sender, receiver, msgid);
// kdDebug(11001) << k_funcinfo << "id=" << msgid << " sender=" << sender << " recv=" << receiver << endl;
@@ -481,7 +481,7 @@ void KGameNetwork::receiveNetworkTransmission(const TQByteArray& receiveBuffer,
else if (msgid==KGameMessage::IdError)
{
TQString text;
- Q_INT32 error;
+ TQ_INT32 error;
stream >> error;
kdDebug(11001) << k_funcinfo << "Got IdError " << error << endl;
text = KGameError::errorText(error, stream);