--- a/QTfrontend/hedgewars.qrc Wed Oct 17 23:09:16 2012 +0400
+++ b/QTfrontend/hedgewars.qrc Wed Oct 17 23:33:33 2012 +0400
@@ -144,5 +144,6 @@
<file>res/chat/serveradmin.png</file>
<file>res/chat/serveradmin_gray.png</file>
<file>res/chat/lamp_off.png</file>
+ <file>res/chat/ingame.png</file>
</qresource>
</RCC>
--- a/QTfrontend/model/playerslistmodel.cpp Wed Oct 17 23:09:16 2012 +0400
+++ b/QTfrontend/model/playerslistmodel.cpp Wed Oct 17 23:33:33 2012 +0400
@@ -186,6 +186,7 @@
setData(mi, "0", RoomFilterRole);
setData(mi, false, RoomAdmin);
setData(mi, false, Ready);
+ setData(mi, false, InGame);
updateSortData(mi);
updateIcon(mi);
@@ -205,6 +206,7 @@
<< index.data(Registered).toBool()
<< index.data(Friend).toBool()
<< index.data(Ignore).toBool()
+ << index.data(InGame).toBool()
<< (index.data(RoomFilterRole).toString() == "1")
;
@@ -224,10 +226,13 @@
QPainter painter(&result);
if(index.data(RoomFilterRole).toString() == "1")
- if(index.data(Ready).toBool())
- painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/chat/lamp.png"));
+ if(index.data(InGame).toBool())
+ painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/chat/ingame.png"));
else
- painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/chat/lamp_off.png"));
+ if(index.data(Ready).toBool())
+ painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/chat/lamp.png"));
+ else
+ painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/chat/lamp_off.png"));
QString mainIconName(":/res/chat/");
--- a/QTfrontend/model/playerslistmodel.h Wed Oct 17 23:09:16 2012 +0400
+++ b/QTfrontend/model/playerslistmodel.h Wed Oct 17 23:33:33 2012 +0400
@@ -18,7 +18,8 @@
RoomAdmin = Qt::UserRole + 2,
Registered = Qt::UserRole + 3,
Friend = Qt::UserRole + 4,
- Ignore = Qt::UserRole + 5
+ Ignore = Qt::UserRole + 5,
+ InGame = Qt::UserRole + 6
};
enum SpecialRoles {
--- a/QTfrontend/net/newnetclient.cpp Wed Oct 17 23:09:16 2012 +0400
+++ b/QTfrontend/net/newnetclient.cpp Wed Oct 17 23:33:33 2012 +0400
@@ -407,6 +407,11 @@
m_playersModel->setFlag(nick, PlayersListModel::Registered, setFlag);
break;
+ case 'g':
+ foreach(const QString & nick, nicks)
+ m_playersModel->setFlag(nick, PlayersListModel::InGame, setFlag);
+ break;
+
// flag indicating if a player is the host/master of the room
case 'h':
foreach (const QString & nick, nicks)
Binary file QTfrontend/res/chat/ingame.png has changed
--- a/gameServer/HWProtoInRoomState.hs Wed Oct 17 23:09:16 2012 +0400
+++ b/gameServer/HWProtoInRoomState.hs Wed Oct 17 23:33:33 2012 +0400
@@ -172,6 +172,7 @@
rm <- thisRoom
chans <- roomClientsChans
+ let nicks = map (nick . client rnc) . roomClients rnc $ clientRoom rnc ci
let allPlayersRegistered = all ((<) 0 . B.length . webPassword . client rnc . teamownerId) $ teams rm
if isMaster cl && playersIn rm == readyPlayers rm && not (isJust $ gameInfo rm) then
@@ -183,6 +184,7 @@
}
)
, AnswerClients chans ["RUN_GAME"]
+ , AnswerClients chans $ "CLIENT_FLAGS" : "+g" : nicks
, ModifyRoomClients (\c -> c{isInGame = True})
]
else
@@ -209,16 +211,19 @@
handleCmd_inRoom ["ROUNDFINISHED", correctly] = do
cl <- thisClient
rm <- thisRoom
+ chans <- roomClientsChans
+
let clTeams = map teamname . filter (\t -> teamowner t == nick cl) . teams $ rm
+ let unsetInGameState = [AnswerClients chans ["CLIENT_FLAGS", "-g", nick cl], ModifyClient (\c -> c{isInGame = False})]
if isInGame cl then
if isJust $ gameInfo rm then
if (isMaster cl && isCorrect) then
- return [ModifyClient (\c -> c{isInGame = False}), FinishGame]
+ return $ FinishGame : unsetInGameState
else
- return $ (ModifyClient (\c -> c{isInGame = False})) : map SendTeamRemovalMessage clTeams
+ return $ unsetInGameState ++ map SendTeamRemovalMessage clTeams
else
- return [ModifyClient (\c -> c{isInGame = False})]
+ return unsetInGameState
else
return [] -- don't accept this message twice
where