[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/kde4/playground/games/kombination/src
From: Albert Astals Cid <tsdgeos () terra ! es>
Date: 2005-09-30 22:06:08
Message-ID: 1128117968.317394.28165.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 465819 by aacid:
some less replication more
M +16 -20 client.cpp
M +2 -0 client.h
--- branches/work/kde4/playground/games/kombination/src/client.cpp #465818:465819
@@ -109,18 +109,10 @@
aux = m_stream.readLine();
i = aux.toInt();
- if (i == NEXT_TURN)
- {
- QString nick = m_stream.readLine();
- emit nextPlayer(nick, nick == m_nick);
- }
+ if (i == NEXT_TURN) handleNextTurn();
else wrongResponse();
}
- else if (i == MESSAGE)
- {
- QString message = m_stream.readLine();
- emit gotMessage(message);
- }
+ else if (i == MESSAGE) handleMessage();
else if (i == NEW_PLAYER)
{
QString nick = m_stream.readLine();
@@ -130,16 +122,8 @@
break;
case PLAYING_GAME:
- if (i == NEXT_TURN)
- {
- QString nick = m_stream.readLine();
- emit nextPlayer(nick, nick == m_nick);
- }
- else if (i == MESSAGE)
- {
- QString message = m_stream.readLine();
- emit gotMessage(message);
- }
+ if (i == NEXT_TURN) handleNextTurn();
+ else if (i == MESSAGE) handleMessage();
else wrongResponse();
break;
}
@@ -148,6 +132,18 @@
if (m_clientSocket->bytesAvailable()) slotSocketReadyToRead();
}
+void client::handleNextTurn()
+{
+ QString nick = m_stream.readLine();
+ emit nextPlayer(nick, nick == m_nick);
+}
+
+void client::handleMessage()
+{
+ QString message = m_stream.readLine();
+ emit gotMessage(message);
+}
+
void client::sendMessage(const QString &message)
{
m_stream << MESSAGE << endl;
--- branches/work/kde4/playground/games/kombination/src/client.h #465818:465819
@@ -50,6 +50,8 @@
void slotSocketError(int e);
private:
+ void handleNextTurn();
+ void handleMessage();
void wrongResponse();
KNetwork::KBufferedSocket *m_clientSocket;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic