Merge branch 'NicolasMerge' into devel
This commit is contained in:
commit
17c8bdb1cd
11 changed files with 95 additions and 14 deletions
|
@ -60,6 +60,7 @@
|
||||||
<file>resources/countries/br.svg</file>
|
<file>resources/countries/br.svg</file>
|
||||||
<file>resources/countries/by.svg</file>
|
<file>resources/countries/by.svg</file>
|
||||||
<file>resources/countries/ca.svg</file>
|
<file>resources/countries/ca.svg</file>
|
||||||
|
<file>resources/countries/cl.svg</file>
|
||||||
<file>resources/countries/cz.svg</file>
|
<file>resources/countries/cz.svg</file>
|
||||||
<file>resources/countries/ch.svg</file>
|
<file>resources/countries/ch.svg</file>
|
||||||
<file>resources/countries/cn.svg</file>
|
<file>resources/countries/cn.svg</file>
|
||||||
|
@ -96,6 +97,7 @@
|
||||||
<file>resources/countries/ua.svg</file>
|
<file>resources/countries/ua.svg</file>
|
||||||
<file>resources/countries/uk.svg</file>
|
<file>resources/countries/uk.svg</file>
|
||||||
<file>resources/countries/us.svg</file>
|
<file>resources/countries/us.svg</file>
|
||||||
|
<file>resources/countries/ve.svg</file>
|
||||||
<file>resources/countries/za.svg</file>
|
<file>resources/countries/za.svg</file>
|
||||||
|
|
||||||
<file>resources/counters/w.svg</file>
|
<file>resources/counters/w.svg</file>
|
||||||
|
|
35
cockatrice/resources/countries/cl.svg
Normal file
35
cockatrice/resources/countries/cl.svg
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
width="1500"
|
||||||
|
height="1000"
|
||||||
|
version="1.1">
|
||||||
|
<rect width="1500" height="1000" fill="#fff"/>
|
||||||
|
<rect
|
||||||
|
width="500"
|
||||||
|
height="1000"
|
||||||
|
fill="#0039A6"/>
|
||||||
|
<rect width="1500" height="500"
|
||||||
|
y="500" fill="#D52B1E"/><g id="star"
|
||||||
|
transform="translate(250,250) scale(125)"
|
||||||
|
fill="#fff">
|
||||||
|
<g id="cone">
|
||||||
|
<polygon
|
||||||
|
id="triangle"
|
||||||
|
points="0,0 0,1 .5,1" transform="translate(0,-1) rotate(18)"/><use
|
||||||
|
xlink:href="#triangle"
|
||||||
|
transform="scale(-1,1)" id="use12"/>
|
||||||
|
</g>
|
||||||
|
<use
|
||||||
|
xlink:href="#cone" transform="rotate(72)" id="use14"/>
|
||||||
|
<use xlink:href="#cone" transform="rotate(-72)"
|
||||||
|
id="use16"/>
|
||||||
|
<use xlink:href="#cone" transform="rotate(144)" id="use18"/>
|
||||||
|
<use
|
||||||
|
xlink:href="#cone"
|
||||||
|
transform="rotate(-144)"
|
||||||
|
id="use20"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 884 B |
23
cockatrice/resources/countries/ve.svg
Normal file
23
cockatrice/resources/countries/ve.svg
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="900" height="600">
|
||||||
|
<rect width="900" height="210" fill="#f7d117"/>
|
||||||
|
<rect y="200" width="900" height="210" fill="#0033ab"/>
|
||||||
|
<rect y="400" width="900" height="200" fill="#cf142b"/>
|
||||||
|
<g id="s" transform="rotate(-70 450,420) translate(450,240)" fill="#fff">
|
||||||
|
<g id="c">
|
||||||
|
<path id="t" d="M 0,-30 V 0 H 15" transform="rotate(18 0,-30)"/>
|
||||||
|
<use xlink:href="#t" transform="scale(-1,1)"/>
|
||||||
|
</g>
|
||||||
|
<use xlink:href="#c" transform="rotate(72)"/>
|
||||||
|
<use xlink:href="#c" transform="rotate(144)"/>
|
||||||
|
<use xlink:href="#c" transform="rotate(216)"/>
|
||||||
|
<use xlink:href="#c" transform="rotate(288)"/>
|
||||||
|
</g>
|
||||||
|
<use xlink:href="#s" transform="rotate(20 450,420)"/>
|
||||||
|
<use xlink:href="#s" transform="rotate(40 450,420)"/>
|
||||||
|
<use xlink:href="#s" transform="rotate(60 450,420)"/>
|
||||||
|
<use xlink:href="#s" transform="rotate(80 450,420)"/>
|
||||||
|
<use xlink:href="#s" transform="rotate(100 450,420)"/>
|
||||||
|
<use xlink:href="#s" transform="rotate(120 450,420)"/>
|
||||||
|
<use xlink:href="#s" transform="rotate(140 450,420)"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
|
@ -39,14 +39,26 @@ void HandZone::addCardImpl(CardItem *card, int x, int /*y*/)
|
||||||
card->update();
|
card->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandZone::handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &/*dropPoint*/)
|
void HandZone::handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint & dropPoint)
|
||||||
{
|
{
|
||||||
|
QPoint point = dropPoint + scenePos().toPoint();
|
||||||
|
int x = -1;
|
||||||
|
if (settingsCache->getHorizontalHand()) {
|
||||||
|
for (x = 0; x < cards.size(); x++)
|
||||||
|
if (point.x() < ((CardItem *) cards.at(x))->scenePos().x())
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
for (x = 0; x < cards.size(); x++)
|
||||||
|
if (point.y() < ((CardItem *) cards.at(x))->scenePos().y())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
Command_MoveCard cmd;
|
Command_MoveCard cmd;
|
||||||
cmd.set_start_player_id(startZone->getPlayer()->getId());
|
cmd.set_start_player_id(startZone->getPlayer()->getId());
|
||||||
cmd.set_start_zone(startZone->getName().toStdString());
|
cmd.set_start_zone(startZone->getName().toStdString());
|
||||||
cmd.set_target_player_id(player->getId());
|
cmd.set_target_player_id(player->getId());
|
||||||
cmd.set_target_zone(getName().toStdString());
|
cmd.set_target_zone(getName().toStdString());
|
||||||
cmd.set_x(cards.size());
|
cmd.set_x(x);
|
||||||
cmd.set_y(-1);
|
cmd.set_y(-1);
|
||||||
|
|
||||||
for (int i = 0; i < dragItems.size(); ++i)
|
for (int i = 0; i < dragItems.size(); ++i)
|
||||||
|
|
|
@ -191,7 +191,6 @@ void Server::addClient(Server_ProtocolHandler *client)
|
||||||
{
|
{
|
||||||
QWriteLocker locker(&clientsLock);
|
QWriteLocker locker(&clientsLock);
|
||||||
clients << client;
|
clients << client;
|
||||||
connect(client, SIGNAL(logDebugMessage(QString, void *)), this, SIGNAL(logDebugMessage(QString, void *)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::removeClient(Server_ProtocolHandler *client)
|
void Server::removeClient(Server_ProtocolHandler *client)
|
||||||
|
|
|
@ -35,7 +35,6 @@ class Server : public QObject
|
||||||
signals:
|
signals:
|
||||||
void pingClockTimeout();
|
void pingClockTimeout();
|
||||||
void sigSendIslMessage(const IslMessage &message, int serverId);
|
void sigSendIslMessage(const IslMessage &message, int serverId);
|
||||||
void logDebugMessage(QString message, void *caller);
|
|
||||||
void endSession(qint64 sessionId);
|
void endSession(qint64 sessionId);
|
||||||
private slots:
|
private slots:
|
||||||
void broadcastRoomUpdate(const ServerInfo_Room &roomInfo, bool sendToIsl = false);
|
void broadcastRoomUpdate(const ServerInfo_Room &roomInfo, bool sendToIsl = false);
|
||||||
|
|
|
@ -127,8 +127,14 @@ Response::ResponseCode Server_ProtocolHandler::processSessionCommandContainer(co
|
||||||
Response::ResponseCode resp = Response::RespInvalidCommand;
|
Response::ResponseCode resp = Response::RespInvalidCommand;
|
||||||
const SessionCommand &sc = cont.session_command(i);
|
const SessionCommand &sc = cont.session_command(i);
|
||||||
const int num = getPbExtension(sc);
|
const int num = getPbExtension(sc);
|
||||||
if (num != SessionCommand::PING)
|
if (num != SessionCommand::PING) { // don't log ping commands
|
||||||
emit logDebugMessage(QString::fromStdString(sc.ShortDebugString()), this);
|
if (num == SessionCommand::LOGIN) { // log login commands, but hide passwords
|
||||||
|
SessionCommand debugSc(sc);
|
||||||
|
debugSc.MutableExtension(Command_Login::ext)->clear_password();
|
||||||
|
logDebugMessage(QString::fromStdString(debugSc.ShortDebugString()));
|
||||||
|
} else
|
||||||
|
logDebugMessage(QString::fromStdString(sc.ShortDebugString()));
|
||||||
|
}
|
||||||
switch ((SessionCommand::SessionCommandType) num) {
|
switch ((SessionCommand::SessionCommandType) num) {
|
||||||
case SessionCommand::PING: resp = cmdPing(sc.GetExtension(Command_Ping::ext), rc); break;
|
case SessionCommand::PING: resp = cmdPing(sc.GetExtension(Command_Ping::ext), rc); break;
|
||||||
case SessionCommand::LOGIN: resp = cmdLogin(sc.GetExtension(Command_Login::ext), rc); break;
|
case SessionCommand::LOGIN: resp = cmdLogin(sc.GetExtension(Command_Login::ext), rc); break;
|
||||||
|
@ -161,7 +167,7 @@ Response::ResponseCode Server_ProtocolHandler::processRoomCommandContainer(const
|
||||||
Response::ResponseCode resp = Response::RespInvalidCommand;
|
Response::ResponseCode resp = Response::RespInvalidCommand;
|
||||||
const RoomCommand &sc = cont.room_command(i);
|
const RoomCommand &sc = cont.room_command(i);
|
||||||
const int num = getPbExtension(sc);
|
const int num = getPbExtension(sc);
|
||||||
emit logDebugMessage(QString::fromStdString(sc.ShortDebugString()), this);
|
logDebugMessage(QString::fromStdString(sc.ShortDebugString()));
|
||||||
switch ((RoomCommand::RoomCommandType) num) {
|
switch ((RoomCommand::RoomCommandType) num) {
|
||||||
case RoomCommand::LEAVE_ROOM: resp = cmdLeaveRoom(sc.GetExtension(Command_LeaveRoom::ext), room, rc); break;
|
case RoomCommand::LEAVE_ROOM: resp = cmdLeaveRoom(sc.GetExtension(Command_LeaveRoom::ext), room, rc); break;
|
||||||
case RoomCommand::ROOM_SAY: resp = cmdRoomSay(sc.GetExtension(Command_RoomSay::ext), room, rc); break;
|
case RoomCommand::ROOM_SAY: resp = cmdRoomSay(sc.GetExtension(Command_RoomSay::ext), room, rc); break;
|
||||||
|
@ -213,7 +219,7 @@ Response::ResponseCode Server_ProtocolHandler::processGameCommandContainer(const
|
||||||
Response::ResponseCode finalResponseCode = Response::RespOk;
|
Response::ResponseCode finalResponseCode = Response::RespOk;
|
||||||
for (int i = cont.game_command_size() - 1; i >= 0; --i) {
|
for (int i = cont.game_command_size() - 1; i >= 0; --i) {
|
||||||
const GameCommand &sc = cont.game_command(i);
|
const GameCommand &sc = cont.game_command(i);
|
||||||
emit logDebugMessage(QString::fromStdString(sc.ShortDebugString()), this);
|
logDebugMessage(QString("game %1 player %2: ").arg(cont.game_id()).arg(roomIdAndPlayerId.second) + QString::fromStdString(sc.ShortDebugString()));
|
||||||
|
|
||||||
Response::ResponseCode resp = player->processGameCommand(sc, rc, ges);
|
Response::ResponseCode resp = player->processGameCommand(sc, rc, ges);
|
||||||
|
|
||||||
|
@ -237,7 +243,7 @@ Response::ResponseCode Server_ProtocolHandler::processModeratorCommandContainer(
|
||||||
Response::ResponseCode resp = Response::RespInvalidCommand;
|
Response::ResponseCode resp = Response::RespInvalidCommand;
|
||||||
const ModeratorCommand &sc = cont.moderator_command(i);
|
const ModeratorCommand &sc = cont.moderator_command(i);
|
||||||
const int num = getPbExtension(sc);
|
const int num = getPbExtension(sc);
|
||||||
emit logDebugMessage(QString::fromStdString(sc.ShortDebugString()), this);
|
logDebugMessage(QString::fromStdString(sc.ShortDebugString()));
|
||||||
|
|
||||||
resp = processExtendedModeratorCommand(num, sc, rc);
|
resp = processExtendedModeratorCommand(num, sc, rc);
|
||||||
if (resp != Response::RespOk)
|
if (resp != Response::RespOk)
|
||||||
|
@ -258,7 +264,7 @@ Response::ResponseCode Server_ProtocolHandler::processAdminCommandContainer(cons
|
||||||
Response::ResponseCode resp = Response::RespInvalidCommand;
|
Response::ResponseCode resp = Response::RespInvalidCommand;
|
||||||
const AdminCommand &sc = cont.admin_command(i);
|
const AdminCommand &sc = cont.admin_command(i);
|
||||||
const int num = getPbExtension(sc);
|
const int num = getPbExtension(sc);
|
||||||
emit logDebugMessage(QString::fromStdString(sc.ShortDebugString()), this);
|
logDebugMessage(QString::fromStdString(sc.ShortDebugString()));
|
||||||
|
|
||||||
resp = processExtendedAdminCommand(num, sc, rc);
|
resp = processExtendedAdminCommand(num, sc, rc);
|
||||||
if (resp != Response::RespOk)
|
if (resp != Response::RespOk)
|
||||||
|
|
|
@ -49,6 +49,7 @@ protected:
|
||||||
AuthenticationResult authState;
|
AuthenticationResult authState;
|
||||||
bool acceptsUserListChanges;
|
bool acceptsUserListChanges;
|
||||||
bool acceptsRoomListChanges;
|
bool acceptsRoomListChanges;
|
||||||
|
virtual void logDebugMessage(const QString &message) { }
|
||||||
private:
|
private:
|
||||||
QList<int> messageSizeOverTime, messageCountOverTime;
|
QList<int> messageSizeOverTime, messageCountOverTime;
|
||||||
int timeRunning, lastDataReceived;
|
int timeRunning, lastDataReceived;
|
||||||
|
@ -79,8 +80,6 @@ private:
|
||||||
virtual Response::ResponseCode processExtendedAdminCommand(int cmdType, const AdminCommand &cmd, ResponseContainer &rc) { return Response::RespFunctionNotAllowed; }
|
virtual Response::ResponseCode processExtendedAdminCommand(int cmdType, const AdminCommand &cmd, ResponseContainer &rc) { return Response::RespFunctionNotAllowed; }
|
||||||
private slots:
|
private slots:
|
||||||
void pingClockTimeout();
|
void pingClockTimeout();
|
||||||
signals:
|
|
||||||
void logDebugMessage(const QString &message, void *session);
|
|
||||||
public slots:
|
public slots:
|
||||||
void prepareDestroy();
|
void prepareDestroy();
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -163,7 +163,6 @@ int main(int argc, char *argv[])
|
||||||
testHash();
|
testHash();
|
||||||
|
|
||||||
Servatrice *server = new Servatrice(settings);
|
Servatrice *server = new Servatrice(settings);
|
||||||
QObject::connect(server, SIGNAL(logDebugMessage(QString, void *)), logger, SLOT(logMessage(QString, void *)));
|
|
||||||
QObject::connect(server, SIGNAL(destroyed()), &app, SLOT(quit()), Qt::QueuedConnection);
|
QObject::connect(server, SIGNAL(destroyed()), &app, SLOT(quit()), Qt::QueuedConnection);
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
if (server->initServer()) {
|
if (server->initServer()) {
|
||||||
|
|
|
@ -197,6 +197,11 @@ void ServerSocketInterface::transmitProtocolItem(const ServerMessage &item)
|
||||||
emit outputBufferChanged();
|
emit outputBufferChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServerSocketInterface::logDebugMessage(const QString &message)
|
||||||
|
{
|
||||||
|
logger->logMessage(message, this);
|
||||||
|
}
|
||||||
|
|
||||||
Response::ResponseCode ServerSocketInterface::processExtendedSessionCommand(int cmdType, const SessionCommand &cmd, ResponseContainer &rc)
|
Response::ResponseCode ServerSocketInterface::processExtendedSessionCommand(int cmdType, const SessionCommand &cmd, ResponseContainer &rc)
|
||||||
{
|
{
|
||||||
switch ((SessionCommand::SessionCommandType) cmdType) {
|
switch ((SessionCommand::SessionCommandType) cmdType) {
|
||||||
|
|
|
@ -57,6 +57,8 @@ private slots:
|
||||||
void flushOutputBuffer();
|
void flushOutputBuffer();
|
||||||
signals:
|
signals:
|
||||||
void outputBufferChanged();
|
void outputBufferChanged();
|
||||||
|
protected:
|
||||||
|
void logDebugMessage(const QString &message);
|
||||||
private:
|
private:
|
||||||
QMutex outputBufferMutex;
|
QMutex outputBufferMutex;
|
||||||
Servatrice *servatrice;
|
Servatrice *servatrice;
|
||||||
|
|
Loading…
Reference in a new issue