Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
4744cf7d
Commit
4744cf7d
authored
Sep 13, 2011
by
unknown
Browse files
hopefully fixed yesterday's fix
parent
3ed26e11
Changes
4
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/playerlistwidget.cpp
View file @
4744cf7d
...
...
@@ -137,13 +137,21 @@ void PlayerListWidget::updatePing(int playerId, int pingTime)
twi
->
setIcon
(
0
,
QIcon
(
PingPixmapGenerator
::
generatePixmap
(
12
,
pingTime
,
10
)));
}
void
PlayerListWidget
::
setGameStarted
(
bool
_gameStarted
)
void
PlayerListWidget
::
setGameStarted
(
bool
_gameStarted
,
bool
resuming
)
{
gameStarted
=
_gameStarted
;
QMapIterator
<
int
,
QTreeWidgetItem
*>
i
(
players
);
while
(
i
.
hasNext
())
{
QTreeWidgetItem
*
twi
=
i
.
next
().
value
();
twi
->
setIcon
(
2
,
gameStarted
?
(
twi
->
data
(
2
,
Qt
::
UserRole
).
toBool
()
?
concededIcon
:
QIcon
())
:
(
twi
->
data
(
2
,
Qt
::
UserRole
+
1
).
toBool
()
?
readyIcon
:
notReadyIcon
));
if
(
gameStarted
)
{
if
(
resuming
)
twi
->
setIcon
(
2
,
twi
->
data
(
2
,
Qt
::
UserRole
).
toBool
()
?
concededIcon
:
QIcon
());
else
{
twi
->
setData
(
2
,
Qt
::
UserRole
,
false
);
twi
->
setIcon
(
2
,
QIcon
());
}
}
else
twi
->
setIcon
(
2
,
notReadyIcon
);
}
}
...
...
cockatrice/src/playerlistwidget.h
View file @
4744cf7d
...
...
@@ -44,7 +44,7 @@ public:
void
setActivePlayer
(
int
playerId
);
void
updatePing
(
int
playerId
,
int
pingTime
);
void
updatePlayerProperties
(
ServerInfo_PlayerProperties
*
prop
);
void
setGameStarted
(
bool
_gameStarted
);
void
setGameStarted
(
bool
_gameStarted
,
bool
resuming
);
void
showContextMenu
(
const
QPoint
&
pos
,
const
QModelIndex
&
index
);
};
...
...
cockatrice/src/tab_game.cpp
View file @
4744cf7d
...
...
@@ -159,7 +159,7 @@ void DeckViewContainer::setDeck(DeckList *deck)
}
TabGame
::
TabGame
(
TabSupervisor
*
_tabSupervisor
,
QList
<
AbstractClient
*>
&
_clients
,
int
_gameId
,
const
QString
&
_gameDescription
,
int
_localPlayerId
,
ServerInfo_User
*
_userInfo
,
bool
_spectator
,
bool
_spectatorsCanTalk
,
bool
_spectatorsSeeEverything
,
bool
_resuming
)
:
Tab
(
_tabSupervisor
),
clients
(
_clients
),
gameId
(
_gameId
),
gameDescription
(
_gameDescription
),
localPlayerId
(
_localPlayerId
),
spectator
(
_spectator
),
spectatorsCanTalk
(
_spectatorsCanTalk
),
spectatorsSeeEverything
(
_spectatorsSeeEverything
),
started
(
false
),
resuming
(
_resuming
),
currentPhase
(
-
1
)
:
Tab
(
_tabSupervisor
),
clients
(
_clients
),
gameId
(
_gameId
),
gameDescription
(
_gameDescription
),
localPlayerId
(
_localPlayerId
),
spectator
(
_spectator
),
spectatorsCanTalk
(
_spectatorsCanTalk
),
spectatorsSeeEverything
(
_spectatorsSeeEverything
),
gameStateKnown
(
false
),
started
(
false
),
resuming
(
_resuming
),
currentPhase
(
-
1
)
{
phasesToolbar
=
new
PhasesToolbar
;
phasesToolbar
->
hide
();
...
...
@@ -486,7 +486,7 @@ void TabGame::sendCommandContainer(CommandContainer *cont, int playerId)
client
->
sendCommandContainer
(
cont
);
}
void
TabGame
::
startGame
()
void
TabGame
::
startGame
(
bool
resuming
)
{
currentPhase
=
-
1
;
...
...
@@ -498,7 +498,13 @@ void TabGame::startGame()
}
mainLayout
->
removeItem
(
deckViewContainerLayout
);
playerListWidget
->
setGameStarted
(
true
);
if
(
!
resuming
)
{
QMapIterator
<
int
,
Player
*>
playerIterator
(
players
);
while
(
playerIterator
.
hasNext
())
playerIterator
.
next
().
value
()
->
setConceded
(
false
);
}
playerListWidget
->
setGameStarted
(
true
,
resuming
);
started
=
true
;
static_cast
<
GameScene
*>
(
gameView
->
scene
())
->
rearrange
();
gameView
->
show
();
...
...
@@ -510,10 +516,6 @@ void TabGame::stopGame()
currentPhase
=
-
1
;
activePlayer
=
-
1
;
QMapIterator
<
int
,
Player
*>
playerIterator
(
players
);
while
(
playerIterator
.
hasNext
())
playerIterator
.
next
().
value
()
->
setConceded
(
false
);
QMapIterator
<
int
,
DeckViewContainer
*>
i
(
deckViewContainers
);
while
(
i
.
hasNext
())
{
i
.
next
();
...
...
@@ -522,7 +524,7 @@ void TabGame::stopGame()
mainLayout
->
insertLayout
(
1
,
deckViewContainerLayout
,
10
);
playerListWidget
->
setActivePlayer
(
-
1
);
playerListWidget
->
setGameStarted
(
false
);
playerListWidget
->
setGameStarted
(
false
,
false
);
started
=
false
;
gameView
->
hide
();
phasesToolbar
->
hide
();
...
...
@@ -578,8 +580,8 @@ void TabGame::eventGameStateChanged(Event_GameStateChanged *event, GameEventCont
}
}
if
(
event
->
getGameStarted
()
&&
!
started
)
{
startGame
();
if
(
!
resuming
)
startGame
(
!
gameStateKnown
);
if
(
gameStateKnown
)
messageLog
->
logGameStart
();
setActivePlayer
(
event
->
getActivePlayer
());
setActivePhase
(
event
->
getActivePhase
());
...
...
@@ -587,6 +589,7 @@ void TabGame::eventGameStateChanged(Event_GameStateChanged *event, GameEventCont
stopGame
();
scene
->
clearViews
();
}
gameStateKnown
=
true
;
emit
userEvent
();
}
...
...
cockatrice/src/tab_game.h
View file @
4744cf7d
...
...
@@ -93,6 +93,7 @@ private:
bool
spectatorsCanTalk
,
spectatorsSeeEverything
;
QMap
<
int
,
Player
*>
players
;
QMap
<
int
,
QString
>
spectators
;
bool
gameStateKnown
;
bool
started
;
bool
resuming
;
QStringList
phasesList
;
...
...
@@ -120,7 +121,7 @@ private:
Player
*
addPlayer
(
int
playerId
,
ServerInfo_User
*
info
);
void
startGame
();
void
startGame
(
bool
resuming
);
void
stopGame
();
void
eventSpectatorSay
(
Event_Say
*
event
,
GameEventContext
*
context
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment