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
cb904635
Commit
cb904635
authored
Aug 18, 2009
by
Max-Wilhelm Bruker
Browse files
phase toolbar
parent
0e4517bf
Changes
12
Hide whitespace changes
Inline
Side-by-side
cockatrice/cockatrice.pro
View file @
cb904635
...
@@ -40,12 +40,11 @@ HEADERS += src/counter.h \
...
@@ -40,12 +40,11 @@ HEADERS += src/counter.h \
src
/
carddatabasemodel
.
h
\
src
/
carddatabasemodel
.
h
\
src
/
window_deckeditor
.
h
\
src
/
window_deckeditor
.
h
\
src
/
decklist
.
h
\
src
/
decklist
.
h
\
setsmodel
.
h
\
src
/
setsmodel
.
h
\
src
/
window_sets
.
h
\
src
/
window_sets
.
h
\
src
/
abstractgraphicsitem
.
h
\
src
/
abstractgraphicsitem
.
h
\
src
/
dlg_settings
.
h
\
src
/
dlg_settings
.
h
\
src
/
phasestoolbar
.
h
\
src
/
phasestoolbar
.
h
src
/
phasebutton
.
h
SOURCES
+=
src
/
counter
.
cpp
\
SOURCES
+=
src
/
counter
.
cpp
\
src
/
gameselector
.
cpp
\
src
/
gameselector
.
cpp
\
src
/
dlg_creategame
.
cpp
\
src
/
dlg_creategame
.
cpp
\
...
@@ -83,6 +82,5 @@ SOURCES += src/counter.cpp \
...
@@ -83,6 +82,5 @@ SOURCES += src/counter.cpp \
src
/
window_sets
.
cpp
\
src
/
window_sets
.
cpp
\
src
/
abstractgraphicsitem
.
cpp
\
src
/
abstractgraphicsitem
.
cpp
\
src
/
dlg_settings
.
cpp
\
src
/
dlg_settings
.
cpp
\
src
/
phasestoolbar
.
cpp
\
src
/
phasestoolbar
.
cpp
src
/
phasebutton
.
cpp
TRANSLATIONS
+=
translations
/
cockatrice_de
.
ts
translations
/
cockatrice_en
.
ts
TRANSLATIONS
+=
translations
/
cockatrice_de
.
ts
translations
/
cockatrice_en
.
ts
cockatrice/src/game.cpp
View file @
cb904635
...
@@ -224,10 +224,25 @@ void Game::gameEvent(const ServerEventData &msg)
...
@@ -224,10 +224,25 @@ void Game::gameEvent(const ServerEventData &msg)
emit
logRollDice
(
p
,
sides
,
roll
);
emit
logRollDice
(
p
,
sides
,
roll
);
break
;
break
;
}
}
case
eventSetActivePlayer
:
case
eventSetActivePlayer
:
{
QStringList
data
=
msg
.
getEventData
();
int
playerId
=
data
[
0
].
toInt
();
Player
*
player
=
players
.
findPlayer
(
playerId
);
if
(
!
player
)
{
qDebug
(
QString
(
"setActivePlayer: invalid player: %1"
).
arg
(
playerId
).
toLatin1
());
break
;
}
for
(
int
i
=
0
;
i
<
players
.
size
();
++
i
)
players
[
i
]
->
setActive
(
players
[
i
]
==
player
);
emit
logSetActivePlayer
(
player
);
break
;
break
;
case
eventSetActivePhase
:
}
case
eventSetActivePhase
:
{
QStringList
data
=
msg
.
getEventData
();
int
phase
=
data
[
0
].
toInt
();
emit
setActivePhase
(
p
,
phase
);
break
;
break
;
}
case
eventName
:
case
eventName
:
case
eventCreateToken
:
case
eventCreateToken
:
...
...
cockatrice/src/game.h
View file @
cb904635
...
@@ -78,6 +78,8 @@ signals:
...
@@ -78,6 +78,8 @@ signals:
void
logSetDoesntUntap
(
Player
*
player
,
QString
cardName
,
bool
doesntUntap
);
void
logSetDoesntUntap
(
Player
*
player
,
QString
cardName
,
bool
doesntUntap
);
void
logDumpZone
(
Player
*
player
,
QString
zoneName
,
QString
zoneOwner
,
int
numberCards
);
void
logDumpZone
(
Player
*
player
,
QString
zoneName
,
QString
zoneOwner
,
int
numberCards
);
void
logStopDumpZone
(
Player
*
player
,
QString
zoneName
,
QString
zoneOwner
);
void
logStopDumpZone
(
Player
*
player
,
QString
zoneName
,
QString
zoneOwner
);
void
logSetActivePlayer
(
Player
*
player
);
void
setActivePhase
(
Player
*
player
,
int
phase
);
public:
public:
Game
(
CardDatabase
*
_db
,
Client
*
_client
,
QGraphicsScene
*
_scene
,
QMenu
*
_actionsMenu
,
QMenu
*
_cardMenu
,
int
playerId
,
const
QString
&
playerName
,
QObject
*
parent
=
0
);
Game
(
CardDatabase
*
_db
,
Client
*
_client
,
QGraphicsScene
*
_scene
,
QMenu
*
_actionsMenu
,
QMenu
*
_cardMenu
,
int
playerId
,
const
QString
&
playerName
,
QObject
*
parent
=
0
);
~
Game
();
~
Game
();
...
...
cockatrice/src/messagelogwidget.cpp
View file @
cb904635
...
@@ -97,6 +97,9 @@ void MessageLogWidget::logDraw(Player *player, int number)
...
@@ -97,6 +97,9 @@ void MessageLogWidget::logDraw(Player *player, int number)
void
MessageLogWidget
::
logMoveCard
(
Player
*
player
,
QString
cardName
,
CardZone
*
startZone
,
int
oldX
,
CardZone
*
targetZone
,
int
newX
)
void
MessageLogWidget
::
logMoveCard
(
Player
*
player
,
QString
cardName
,
CardZone
*
startZone
,
int
oldX
,
CardZone
*
targetZone
,
int
newX
)
{
{
if
(
cardName
.
isEmpty
())
cardName
=
tr
(
"a card"
);
QString
startName
=
startZone
->
getName
();
QString
startName
=
startZone
->
getName
();
QString
targetName
=
targetZone
->
getName
();
QString
targetName
=
targetZone
->
getName
();
if
(((
startName
==
"table"
)
&&
(
targetName
==
"table"
))
||
((
startName
==
"hand"
)
&&
(
targetName
==
"hand"
)))
if
(((
startName
==
"table"
)
&&
(
targetName
==
"table"
))
||
((
startName
==
"hand"
)
&&
(
targetName
==
"hand"
)))
...
@@ -197,6 +200,18 @@ void MessageLogWidget::logStopDumpZone(Player *player, QString zoneName, QString
...
@@ -197,6 +200,18 @@ void MessageLogWidget::logStopDumpZone(Player *player, QString zoneName, QString
append
(
tr
(
"%1 stops looking at %2's %3"
).
arg
(
sanitizeHtml
(
player
->
getName
())).
arg
(
zoneOwner
).
arg
(
zoneName
));
append
(
tr
(
"%1 stops looking at %2's %3"
).
arg
(
sanitizeHtml
(
player
->
getName
())).
arg
(
zoneOwner
).
arg
(
zoneName
));
}
}
void
MessageLogWidget
::
logSetActivePlayer
(
Player
*
player
)
{
append
(
"---"
);
append
(
"<font color=
\"
green
\"
>"
+
tr
(
"It is now %1's turn."
).
arg
(
player
->
getName
())
+
"</font>"
);
append
(
"---"
);
}
void
MessageLogWidget
::
logSetActivePhase
(
Player
*
player
,
int
phase
)
{
append
(
"<font color=
\"
green
\"
>"
+
tr
(
"It is now the %1 phase."
).
arg
(
phase
)
+
"</font>"
);
}
void
MessageLogWidget
::
connectToGame
(
Game
*
game
)
void
MessageLogWidget
::
connectToGame
(
Game
*
game
)
{
{
connect
(
game
,
SIGNAL
(
logPlayerListReceived
(
QStringList
)),
this
,
SLOT
(
logPlayerListReceived
(
QStringList
)));
connect
(
game
,
SIGNAL
(
logPlayerListReceived
(
QStringList
)),
this
,
SLOT
(
logPlayerListReceived
(
QStringList
)));
...
@@ -216,6 +231,8 @@ void MessageLogWidget::connectToGame(Game *game)
...
@@ -216,6 +231,8 @@ void MessageLogWidget::connectToGame(Game *game)
connect
(
game
,
SIGNAL
(
logSetDoesntUntap
(
Player
*
,
QString
,
bool
)),
this
,
SLOT
(
logSetDoesntUntap
(
Player
*
,
QString
,
bool
)));
connect
(
game
,
SIGNAL
(
logSetDoesntUntap
(
Player
*
,
QString
,
bool
)),
this
,
SLOT
(
logSetDoesntUntap
(
Player
*
,
QString
,
bool
)));
connect
(
game
,
SIGNAL
(
logDumpZone
(
Player
*
,
QString
,
QString
,
int
)),
this
,
SLOT
(
logDumpZone
(
Player
*
,
QString
,
QString
,
int
)));
connect
(
game
,
SIGNAL
(
logDumpZone
(
Player
*
,
QString
,
QString
,
int
)),
this
,
SLOT
(
logDumpZone
(
Player
*
,
QString
,
QString
,
int
)));
connect
(
game
,
SIGNAL
(
logStopDumpZone
(
Player
*
,
QString
,
QString
)),
this
,
SLOT
(
logStopDumpZone
(
Player
*
,
QString
,
QString
)));
connect
(
game
,
SIGNAL
(
logStopDumpZone
(
Player
*
,
QString
,
QString
)),
this
,
SLOT
(
logStopDumpZone
(
Player
*
,
QString
,
QString
)));
connect
(
game
,
SIGNAL
(
logSetActivePlayer
(
Player
*
)),
this
,
SLOT
(
logSetActivePlayer
(
Player
*
)));
connect
(
game
,
SIGNAL
(
setActivePhase
(
Player
*
,
int
)),
this
,
SLOT
(
logSetActivePhase
(
Player
*
,
int
)));
}
}
MessageLogWidget
::
MessageLogWidget
(
QWidget
*
parent
)
MessageLogWidget
::
MessageLogWidget
(
QWidget
*
parent
)
...
...
cockatrice/src/messagelogwidget.h
View file @
cb904635
...
@@ -37,6 +37,8 @@ private slots:
...
@@ -37,6 +37,8 @@ private slots:
void
logSetDoesntUntap
(
Player
*
player
,
QString
cardName
,
bool
doesntUntap
);
void
logSetDoesntUntap
(
Player
*
player
,
QString
cardName
,
bool
doesntUntap
);
void
logDumpZone
(
Player
*
player
,
QString
zoneName
,
QString
zoneOwner
,
int
numberCards
);
void
logDumpZone
(
Player
*
player
,
QString
zoneName
,
QString
zoneOwner
,
int
numberCards
);
void
logStopDumpZone
(
Player
*
player
,
QString
zoneName
,
QString
zoneOwner
);
void
logStopDumpZone
(
Player
*
player
,
QString
zoneName
,
QString
zoneOwner
);
void
logSetActivePlayer
(
Player
*
player
);
void
logSetActivePhase
(
Player
*
player
,
int
phase
);
public:
public:
void
connectToGame
(
Game
*
game
);
void
connectToGame
(
Game
*
game
);
MessageLogWidget
(
QWidget
*
parent
=
0
);
MessageLogWidget
(
QWidget
*
parent
=
0
);
...
...
cockatrice/src/phasebutton.cpp
deleted
100644 → 0
View file @
0e4517bf
#include
"phasebutton.h"
#include
<QPainter>
#include
<QPen>
//
PhaseButton
::
PhaseButton
(
QIcon
icon
,
QString
name
)
:
QPushButton
(
icon
,
name
)
{
}
//PhaseButton::PhaseButton( )
//: QPushButton()
//{
//
//}
void
PhaseButton
::
update
()
{
QPushButton
::
update
();
}
void
PhaseButton
::
paintEvent
(
QPaintEvent
*
event
)
{
QPushButton
::
paintEvent
(
event
);
if
(
isChecked
())
{
QPainter
painter
(
this
);
int
height
=
size
().
height
();
int
width
=
size
().
width
();
QPen
pen
;
pen
.
setWidth
(
3
);
pen
.
setColor
(
QColor
::
fromRgb
(
180
,
0
,
0
));
painter
.
setPen
(
pen
);
painter
.
drawRect
(
3
,
3
,
width
-
7
,
height
-
7
);
}
}
//
cockatrice/src/phasebutton.h
deleted
100644 → 0
View file @
0e4517bf
#ifndef PHASEBUTTON_H
#define PHASEBUTTON_H
//
#include
<QPushButton>
//
class
PhaseButton
:
public
QPushButton
{
Q_OBJECT
public:
PhaseButton
();
PhaseButton
(
QIcon
,
QString
);
void
update
();
void
paintEvent
(
QPaintEvent
*
event
);
};
#endif
cockatrice/src/phasestoolbar.cpp
View file @
cb904635
#include
"phasestoolbar.h"
#include
"phasestoolbar.h"
#include
<QAction>
#include
<QAction>
//#include <QPushButton>
#include
"phasebutton.h"
#include
<QVBoxLayout>
#include
<QVBoxLayout>
#include
<QButtonGroup>
#include
<QButtonGroup>
#include
<QPainter>
#include
<QPen>
PhaseButton
::
PhaseButton
(
QIcon
icon
)
:
QPushButton
(
icon
,
QString
())
{
}
void
PhaseButton
::
update
()
{
QPushButton
::
update
();
}
void
PhaseButton
::
paintEvent
(
QPaintEvent
*
event
)
{
QPushButton
::
paintEvent
(
event
);
if
(
isChecked
())
{
QPainter
painter
(
this
);
int
height
=
size
().
height
();
int
width
=
size
().
width
();
QPen
pen
;
pen
.
setWidth
(
3
);
pen
.
setColor
(
QColor
::
fromRgb
(
180
,
0
,
0
));
painter
.
setPen
(
pen
);
// painter.setPen(QColor(0, 0, 0, 0));
QRadialGradient
grad
(
QPointF
(
0.5
,
0.5
),
0.5
);
grad
.
setCoordinateMode
(
QGradient
::
ObjectBoundingMode
);
grad
.
setColorAt
(
0
,
QColor
(
180
,
0
,
0
,
0
));
grad
.
setColorAt
(
0.8
,
QColor
(
180
,
0
,
0
,
0
));
grad
.
setColorAt
(
1
,
QColor
(
180
,
0
,
0
,
255
));
painter
.
setBrush
(
QBrush
(
grad
));
// painter.drawEllipse(QRect(0, 0, width, height));
painter
.
drawRect
(
3
,
3
,
width
-
7
,
height
-
7
);
}
}
void
PhaseButton
::
setPhaseText
(
const
QString
&
_phaseText
)
{
phaseText
=
_phaseText
;
setToolTip
(
phaseText
);
}
PhasesToolbar
::
PhasesToolbar
(
QWidget
*
parent
)
PhasesToolbar
::
PhasesToolbar
(
QWidget
*
parent
)
:
QFrame
(
parent
)
:
QFrame
(
parent
)
{
{
PhaseButton
*
untapButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_untap.svg"
)
,
QString
()
);
PhaseButton
*
untapButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_untap.svg"
));
PhaseButton
*
upkeepButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_upkeep.svg"
)
,
QString
()
);
PhaseButton
*
upkeepButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_upkeep.svg"
));
PhaseButton
*
drawButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_draw.svg"
)
,
QString
()
);
PhaseButton
*
drawButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_draw.svg"
));
PhaseButton
*
main1Button
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_main1.svg"
)
,
QString
()
);
PhaseButton
*
main1Button
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_main1.svg"
));
PhaseButton
*
combatStartButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_combat_start.svg"
)
,
QString
()
);
PhaseButton
*
combatStartButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_combat_start.svg"
));
PhaseButton
*
combatAttackersButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_combat_attackers.svg"
)
,
QString
()
);
PhaseButton
*
combatAttackersButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_combat_attackers.svg"
));
PhaseButton
*
combatBlockersButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_combat_blockers.svg"
)
,
QString
()
);
PhaseButton
*
combatBlockersButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_combat_blockers.svg"
));
PhaseButton
*
combatDamageButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_combat_damage.svg"
)
,
QString
()
);
PhaseButton
*
combatDamageButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_combat_damage.svg"
));
PhaseButton
*
combatEndButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_combat_end.svg"
)
,
QString
()
);
PhaseButton
*
combatEndButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_combat_end.svg"
));
PhaseButton
*
main2Button
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_main2.svg"
)
,
QString
()
);
PhaseButton
*
main2Button
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_main2.svg"
));
PhaseButton
*
cleanupButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_cleanup.svg"
)
,
QString
()
);
PhaseButton
*
cleanupButton
=
new
PhaseButton
(
QIcon
(
":/resources/icon_phase_cleanup.svg"
));
buttonList
<<
untapButton
<<
upkeepButton
<<
drawButton
<<
main1Button
<<
combatStartButton
buttonList
<<
untapButton
<<
upkeepButton
<<
drawButton
<<
main1Button
<<
combatStartButton
<<
combatAttackersButton
<<
combatBlockersButton
<<
combatDamageButton
<<
combatEndButton
<<
combatAttackersButton
<<
combatBlockersButton
<<
combatDamageButton
<<
combatEndButton
<<
main2Button
<<
cleanupButton
;
<<
main2Button
<<
cleanupButton
;
for
(
int
i
=
0
;
i
<
buttonList
.
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
buttonList
.
size
();
++
i
)
{
buttonList
[
i
]
->
setCheckable
(
true
);
buttonList
[
i
]
->
setCheckable
(
true
);
buttonList
[
i
]
->
setIconSize
(
QSize
(
40
,
40
));
buttonList
[
i
]
->
setIconSize
(
QSize
(
40
,
40
));
}
}
Phase
Button
*
nextTurnButton
=
new
Phase
Button
(
QIcon
(
":/resources/icon_nextturn.svg"
),
QString
());
QPush
Button
*
nextTurnButton
=
new
QPush
Button
(
QIcon
(
":/resources/icon_nextturn.svg"
),
QString
());
nextTurnButton
->
setIconSize
(
QSize
(
40
,
40
));
nextTurnButton
->
setIconSize
(
QSize
(
40
,
40
));
QVBoxLayout
*
layout
=
new
QVBoxLayout
;
QVBoxLayout
*
layout
=
new
QVBoxLayout
;
...
@@ -40,7 +84,6 @@ PhasesToolbar::PhasesToolbar(QWidget *parent)
...
@@ -40,7 +84,6 @@ PhasesToolbar::PhasesToolbar(QWidget *parent)
bg
->
addButton
(
buttonList
[
i
]);
bg
->
addButton
(
buttonList
[
i
]);
}
}
layout
->
addStretch
(
1
);
layout
->
addStretch
(
1
);
layout
->
addWidget
(
untapButton
);
layout
->
addWidget
(
untapButton
);
layout
->
addWidget
(
upkeepButton
);
layout
->
addWidget
(
upkeepButton
);
...
@@ -61,5 +104,21 @@ PhasesToolbar::PhasesToolbar(QWidget *parent)
...
@@ -61,5 +104,21 @@ PhasesToolbar::PhasesToolbar(QWidget *parent)
layout
->
addWidget
(
nextTurnButton
);
layout
->
addWidget
(
nextTurnButton
);
layout
->
addStretch
(
1
);
layout
->
addStretch
(
1
);
retranslateUi
();
setLayout
(
layout
);
setLayout
(
layout
);
}
}
void
PhasesToolbar
::
retranslateUi
()
{
buttonList
[
0
]
->
setPhaseText
(
tr
(
"Untap step"
));
buttonList
[
1
]
->
setPhaseText
(
tr
(
"Upkeep step"
));
buttonList
[
2
]
->
setPhaseText
(
tr
(
"Draw step"
));
buttonList
[
3
]
->
setPhaseText
(
tr
(
"First main phase"
));
buttonList
[
4
]
->
setPhaseText
(
tr
(
"Beginning of combat step"
));
buttonList
[
5
]
->
setPhaseText
(
tr
(
"Declare attackers step"
));
buttonList
[
6
]
->
setPhaseText
(
tr
(
"Declare blockers step"
));
buttonList
[
7
]
->
setPhaseText
(
tr
(
"Combat damage step"
));
buttonList
[
8
]
->
setPhaseText
(
tr
(
"End of combat step"
));
buttonList
[
9
]
->
setPhaseText
(
tr
(
"Second main phase"
));
buttonList
[
10
]
->
setPhaseText
(
tr
(
"End of turn step"
));
}
cockatrice/src/phasestoolbar.h
View file @
cb904635
...
@@ -3,15 +3,30 @@
...
@@ -3,15 +3,30 @@
#include
<QFrame>
#include
<QFrame>
#include
<QList>
#include
<QList>
#include
<QPushButton>
class
QPushButton
;
class
PhaseButton
:
public
QPushButton
{
Q_OBJECT
private:
QString
phaseText
;
public:
PhaseButton
();
PhaseButton
(
QIcon
);
void
setPhaseText
(
const
QString
&
_phaseText
);
QString
getPhaseText
()
const
{
return
phaseText
;
}
public
slots
:
void
update
();
protected:
void
paintEvent
(
QPaintEvent
*
event
);
};
class
PhasesToolbar
:
public
QFrame
{
class
PhasesToolbar
:
public
QFrame
{
Q_OBJECT
Q_OBJECT
public:
public:
PhasesToolbar
(
QWidget
*
parent
=
0
);
PhasesToolbar
(
QWidget
*
parent
=
0
);
void
retranslateUi
();
private:
private:
QList
<
QPush
Button
*>
buttonList
;
QList
<
Phase
Button
*>
buttonList
;
};
};
#endif
#endif
cockatrice/src/player.cpp
View file @
cb904635
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#include
<QMenu>
#include
<QMenu>
Player
::
Player
(
const
QString
&
_name
,
int
_id
,
QPointF
_base
,
bool
_local
,
CardDatabase
*
_db
,
Client
*
_client
,
QGraphicsScene
*
_scene
,
Game
*
_parent
)
Player
::
Player
(
const
QString
&
_name
,
int
_id
,
QPointF
_base
,
bool
_local
,
CardDatabase
*
_db
,
Client
*
_client
,
QGraphicsScene
*
_scene
,
Game
*
_parent
)
:
QObject
(
_parent
),
defaultNumberTopCards
(
3
),
name
(
_name
),
id
(
_id
),
base
(
_base
),
local
(
_local
),
db
(
_db
),
client
(
_client
)
:
QObject
(
_parent
),
defaultNumberTopCards
(
3
),
name
(
_name
),
id
(
_id
),
active
(
false
),
base
(
_base
),
local
(
_local
),
db
(
_db
),
client
(
_client
)
{
{
area
=
new
PlayerArea
(
this
);
area
=
new
PlayerArea
(
this
);
area
->
setPos
(
_base
);
area
->
setPos
(
_base
);
...
@@ -315,3 +315,8 @@ void Player::showCardMenu(const QPoint &p)
...
@@ -315,3 +315,8 @@ void Player::showCardMenu(const QPoint &p)
{
{
emit
sigShowCardMenu
(
p
);
emit
sigShowCardMenu
(
p
);
}
}
void
Player
::
setActive
(
bool
_active
)
{
active
=
_active
;
}
cockatrice/src/player.h
View file @
cb904635
...
@@ -49,6 +49,7 @@ private:
...
@@ -49,6 +49,7 @@ private:
int
defaultNumberTopCards
;
int
defaultNumberTopCards
;
QString
name
;
QString
name
;
int
id
;
int
id
;
bool
active
;
QPointF
base
;
QPointF
base
;
bool
local
;
bool
local
;
ZoneList
zones
;
ZoneList
zones
;
...
@@ -68,6 +69,8 @@ public:
...
@@ -68,6 +69,8 @@ public:
void
gameEvent
(
const
ServerEventData
&
event
);
void
gameEvent
(
const
ServerEventData
&
event
);
CardDatabase
*
getDb
()
const
{
return
db
;
}
CardDatabase
*
getDb
()
const
{
return
db
;
}
void
showCardMenu
(
const
QPoint
&
p
);
void
showCardMenu
(
const
QPoint
&
p
);
bool
getActive
()
const
{
return
active
;
}
void
setActive
(
bool
_active
);
};
};
#endif
#endif
servatrice/src/serversocket.cpp
View file @
cb904635
...
@@ -609,6 +609,7 @@ ReturnMessage::ReturnCode ServerSocket::cmdSetActivePlayer(const QList<QVariant>
...
@@ -609,6 +609,7 @@ ReturnMessage::ReturnCode ServerSocket::cmdSetActivePlayer(const QList<QVariant>
if
(
!
game
->
getPlayer
(
active_player
))
if
(
!
game
->
getPlayer
(
active_player
))
return
ReturnMessage
::
ReturnContextError
;
return
ReturnMessage
::
ReturnContextError
;
game
->
setActivePlayer
(
active_player
);
game
->
setActivePlayer
(
active_player
);
emit
broadcastEvent
(
QString
(
"set_active_player|%1"
).
arg
(
active_player
),
this
);
return
ReturnMessage
::
ReturnOk
;
return
ReturnMessage
::
ReturnOk
;
}
}
...
@@ -616,7 +617,10 @@ ReturnMessage::ReturnCode ServerSocket::cmdSetActivePhase(const QList<QVariant>
...
@@ -616,7 +617,10 @@ ReturnMessage::ReturnCode ServerSocket::cmdSetActivePhase(const QList<QVariant>
{
{
int
active_phase
=
params
[
0
].
toInt
();
int
active_phase
=
params
[
0
].
toInt
();
// XXX Überprüfung, ob die Phase existiert...
// XXX Überprüfung, ob die Phase existiert...
if
(
game
->
getActivePlayer
()
!=
playerId
)
return
ReturnMessage
::
ReturnContextError
;
game
->
setActivePhase
(
active_phase
);
game
->
setActivePhase
(
active_phase
);
emit
broadcastEvent
(
QString
(
"set_active_phase|%1"
).
arg
(
active_phase
),
this
);
return
ReturnMessage
::
ReturnOk
;
return
ReturnMessage
::
ReturnOk
;
}
}
...
...
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