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
e31cfd32
Commit
e31cfd32
authored
Mar 14, 2009
by
Max-Wilhelm Bruker
Browse files
Minor bugfixes
parent
a11f93df
Changes
9
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/client.cpp
View file @
e31cfd32
...
...
@@ -102,11 +102,6 @@ void Client::readLine()
c
=
i
.
next
();
if
(
c
->
getMsgId
()
==
msgid
)
{
found
=
true
;
QString
cmd
=
c
->
getCmd
();
if
(
cmd
.
startsWith
(
"submit_deck"
))
readyStart
();
break
;
}
}
...
...
@@ -276,14 +271,13 @@ int Client::setCardAttr(const QString &zone, int cardid, const QString &aname, c
return
cmd
(
QString
(
"set_card_attr|%1|%2|%3|%4"
).
arg
(
zone
).
arg
(
cardid
).
arg
(
aname
).
arg
(
avalue
));
}
int
Client
::
submitDeck
(
const
QStringList
&
deck
)
void
Client
::
submitDeck
(
const
QStringList
&
deck
)
{
int
retval
=
cmd
(
"submit_deck"
);
cmd
(
"submit_deck"
);
QStringListIterator
i
(
deck
);
while
(
i
.
hasNext
())
msg
(
i
.
next
());
msg
(
"."
);
return
retval
;
}
int
Client
::
readyStart
()
...
...
cockatrice/src/client.h
View file @
e31cfd32
...
...
@@ -57,7 +57,7 @@ public:
~
Client
();
ProtocolStatus
getStatus
()
{
return
status
;
}
QString
peerName
()
const
{
return
socket
->
peerName
();
}
void
connectToServer
(
const
QString
&
hostname
,
unsigned
int
port
,
const
QString
&
playername
);
void
disconnectFromServer
();
int
listGames
();
...
...
@@ -73,7 +73,6 @@ public:
int
moveCard
(
int
cardid
,
const
QString
&
startzone
,
const
QString
&
targetzone
,
int
x
,
int
y
=
0
);
int
createToken
(
const
QString
&
zone
,
const
QString
&
name
,
const
QString
&
powtough
,
int
x
,
int
y
);
int
setCardAttr
(
const
QString
&
zone
,
int
cardid
,
const
QString
&
aname
,
const
QString
&
avalue
);
int
submitDeck
(
const
QStringList
&
deck
);
int
readyStart
();
int
incCounter
(
const
QString
&
counter
,
int
delta
);
int
setCounter
(
const
QString
&
counter
,
int
value
);
...
...
@@ -81,6 +80,8 @@ public:
int
setActivePlayer
(
int
player
);
int
setActivePhase
(
int
phase
);
int
dumpZone
(
int
player
,
const
QString
&
zone
,
int
numberCards
);
public
slots
:
void
submitDeck
(
const
QStringList
&
deck
);
};
#endif
cockatrice/src/dlg_startgame.cpp
View file @
e31cfd32
...
...
@@ -49,6 +49,8 @@ void DlgStartGame::actLoad()
}
card
->
getPixmap
();
}
emit
newDeckLoaded
(
getDeckList
());
}
QStringList
DlgStartGame
::
getDeckList
()
const
...
...
cockatrice/src/dlg_startgame.h
View file @
e31cfd32
...
...
@@ -13,6 +13,8 @@ class DlgStartGame: public QDialog {
public:
DlgStartGame
(
CardDatabase
*
_db
,
QWidget
*
parent
=
0
);
QStringList
getDeckList
()
const
;
signals:
void
newDeckLoaded
(
const
QStringList
&
cards
);
private
slots
:
void
actLoad
();
private:
...
...
cockatrice/src/game.cpp
View file @
e31cfd32
...
...
@@ -84,6 +84,8 @@ Game::Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_a
cardMenu
->
addAction
(
aRearrange
);
dlgStartGame
=
new
DlgStartGame
(
db
);
connect
(
dlgStartGame
,
SIGNAL
(
newDeckLoaded
(
const
QStringList
&
)),
client
,
SLOT
(
submitDeck
(
const
QStringList
&
)));
connect
(
dlgStartGame
,
SIGNAL
(
finished
(
int
)),
this
,
SLOT
(
readyStart
(
int
)));
}
Game
::~
Game
()
...
...
@@ -139,10 +141,16 @@ void Game::playerListReceived(QList<ServerPlayer *> playerList)
restartGameDialog
();
}
void
Game
::
readyStart
(
int
foo
)
{
Q_UNUSED
(
foo
);
client
->
readyStart
();
}
void
Game
::
restartGameDialog
()
{
dlgStartGame
->
exec
();
client
->
submitDeck
(
dlgStartGame
->
getDeckList
());
dlgStartGame
->
show
();
}
void
Game
::
gameEvent
(
ServerEventData
*
msg
)
...
...
cockatrice/src/game.h
View file @
e31cfd32
...
...
@@ -47,6 +47,7 @@ private slots:
void
gameEvent
(
ServerEventData
*
msg
);
void
playerListReceived
(
QList
<
ServerPlayer
*>
playerList
);
void
readyStart
(
int
foo
);
signals:
void
submitDecklist
();
void
hoverCard
(
QString
name
);
...
...
cockatrice/src/main.cpp
View file @
e31cfd32
...
...
@@ -38,7 +38,7 @@ void myMessageOutput(QtMsgType type, const char *msg)
int
main
(
int
argc
,
char
*
argv
[])
{
qInstallMsgHandler
(
myMessageOutput
);
//
qInstallMsgHandler(myMessageOutput);
QApplication
app
(
argc
,
argv
);
app
.
addLibraryPath
(
"plugins"
);
QTextCodec
::
setCodecForCStrings
(
QTextCodec
::
codecForName
(
"UTF-8"
));
...
...
cockatrice/src/window.cpp
View file @
e31cfd32
...
...
@@ -130,7 +130,6 @@ void MainWindow::buttonSay()
void
MainWindow
::
playerIdReceived
(
int
id
,
QString
name
)
{
game
=
new
Game
(
db
,
client
,
scene
,
actionsMenu
,
cardMenu
,
id
,
name
);
connect
(
game
,
SIGNAL
(
submitDecklist
()),
this
,
SLOT
(
decklistDialog
()));
connect
(
game
,
SIGNAL
(
hoverCard
(
QString
)),
this
,
SLOT
(
hoverCard
(
QString
)));
connect
(
game
,
SIGNAL
(
playerAdded
(
Player
*
)),
this
,
SLOT
(
playerAdded
(
Player
*
)));
connect
(
game
,
SIGNAL
(
playerRemoved
(
Player
*
)),
this
,
SLOT
(
playerRemoved
(
Player
*
)));
...
...
servatrice/src/testservergame.cpp
View file @
e31cfd32
...
...
@@ -96,9 +96,11 @@ void TestServerGame::startGameIfReady()
for
(
int
i
=
0
;
i
<
players
.
size
();
i
++
)
if
(
players
.
at
(
i
)
->
getStatus
()
!=
StatusReadyStart
)
return
;
rnd
=
new
TestRandom
(
this
);
rnd
->
init
();
if
(
!
rnd
)
{
rnd
=
new
TestRandom
(
this
);
rnd
->
init
();
}
for
(
int
i
=
0
;
i
<
players
.
size
();
i
++
)
players
.
at
(
i
)
->
setupZones
();
...
...
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