single player works again, version bump
This commit is contained in:
parent
d4222b25c5
commit
55d493e7ef
9 changed files with 26 additions and 15 deletions
|
@ -5,7 +5,7 @@ INCLUDEPATH += . src ../common
|
||||||
MOC_DIR = build
|
MOC_DIR = build
|
||||||
OBJECTS_DIR = build
|
OBJECTS_DIR = build
|
||||||
RESOURCES = cockatrice.qrc
|
RESOURCES = cockatrice.qrc
|
||||||
QT += network svg webkit
|
QT += network svg
|
||||||
|
|
||||||
HEADERS += src/counter.h \
|
HEADERS += src/counter.h \
|
||||||
src/dlg_creategame.h \
|
src/dlg_creategame.h \
|
||||||
|
|
|
@ -7,6 +7,7 @@ LocalClient::LocalClient(LocalServerInterface *_lsi, const QString &_playerName,
|
||||||
{
|
{
|
||||||
connect(lsi, SIGNAL(itemToClient(ProtocolItem *)), this, SLOT(itemFromServer(ProtocolItem *)));
|
connect(lsi, SIGNAL(itemToClient(ProtocolItem *)), this, SLOT(itemFromServer(ProtocolItem *)));
|
||||||
sendCommand(new Command_Login(_playerName, QString()));
|
sendCommand(new Command_Login(_playerName, QString()));
|
||||||
|
sendCommand(new Command_JoinRoom(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalClient::~LocalClient()
|
LocalClient::~LocalClient()
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
#include "localserver.h"
|
#include "localserver.h"
|
||||||
#include "localserverinterface.h"
|
#include "localserverinterface.h"
|
||||||
|
#include "server_room.h"
|
||||||
|
|
||||||
LocalServer::LocalServer(QObject *parent)
|
LocalServer::LocalServer(QObject *parent)
|
||||||
: Server(parent)
|
: Server(parent)
|
||||||
{
|
{
|
||||||
|
addRoom(new Server_Room(0, QString(), QString(), false, QString(), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalServer::~LocalServer()
|
LocalServer::~LocalServer()
|
||||||
|
|
|
@ -181,7 +181,7 @@ void MessageLogWidget::logMoveCard(Player *player, QString cardName, CardZone *s
|
||||||
{
|
{
|
||||||
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") && (startZone == targetZone)) || ((startName == "hand") && (targetName == "hand")))
|
||||||
return;
|
return;
|
||||||
QPair<QString, QString> temp = getFromStr(startZone, cardName, oldX);
|
QPair<QString, QString> temp = getFromStr(startZone, cardName, oldX);
|
||||||
bool cardNameContainsStartZone = false;
|
bool cardNameContainsStartZone = false;
|
||||||
|
@ -190,6 +190,18 @@ void MessageLogWidget::logMoveCard(Player *player, QString cardName, CardZone *s
|
||||||
cardName = temp.first;
|
cardName = temp.first;
|
||||||
}
|
}
|
||||||
QString fromStr = temp.second;
|
QString fromStr = temp.second;
|
||||||
|
QString cardStr;
|
||||||
|
if (cardNameContainsStartZone)
|
||||||
|
cardStr = cardName;
|
||||||
|
else if (cardName.isEmpty())
|
||||||
|
cardStr = tr("a card");
|
||||||
|
else
|
||||||
|
cardStr = QString("<font color=\"blue\">%1</font>").arg(sanitizeHtml(cardName));
|
||||||
|
|
||||||
|
if ((startName == "table") && (targetName == "table")) {
|
||||||
|
append(tr("%1 gives %2 control over %3.").arg(sanitizeHtml(player->getName())).arg(sanitizeHtml(targetZone->getPlayer()->getName())).arg(cardStr));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QString finalStr;
|
QString finalStr;
|
||||||
if (targetName == "table")
|
if (targetName == "table")
|
||||||
|
@ -214,14 +226,6 @@ void MessageLogWidget::logMoveCard(Player *player, QString cardName, CardZone *s
|
||||||
else if (targetName == "stack")
|
else if (targetName == "stack")
|
||||||
finalStr = tr("%1 plays %2%3.");
|
finalStr = tr("%1 plays %2%3.");
|
||||||
|
|
||||||
QString cardStr;
|
|
||||||
if (cardNameContainsStartZone)
|
|
||||||
cardStr = cardName;
|
|
||||||
else if (cardName.isEmpty())
|
|
||||||
cardStr = tr("a card");
|
|
||||||
else
|
|
||||||
cardStr = QString("<font color=\"blue\">%1</font>").arg(sanitizeHtml(cardName));
|
|
||||||
|
|
||||||
append(finalStr.arg(sanitizeHtml(player->getName())).arg(cardStr).arg(fromStr).arg(newX));
|
append(finalStr.arg(sanitizeHtml(player->getName())).arg(cardStr).arg(fromStr).arg(newX));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,6 +202,10 @@ TabRoom::TabRoom(AbstractClient *_client, const QString &_ownName, ServerInfo_Ro
|
||||||
const QList<ServerInfo_User *> users = info->getUserList();
|
const QList<ServerInfo_User *> users = info->getUserList();
|
||||||
for (int i = 0; i < users.size(); ++i)
|
for (int i = 0; i < users.size(); ++i)
|
||||||
userList->processUserInfo(users[i]);
|
userList->processUserInfo(users[i]);
|
||||||
|
|
||||||
|
const QList<ServerInfo_Game *> games = info->getGameList();
|
||||||
|
for (int i = 0; i < games.size(); ++i)
|
||||||
|
gameSelector->processGameInfo(games[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
TabRoom::~TabRoom()
|
TabRoom::~TabRoom()
|
||||||
|
|
|
@ -146,7 +146,7 @@ void TabSupervisor::localGameJoined(Event_GameJoined *event)
|
||||||
setCurrentWidget(tab);
|
setCurrentWidget(tab);
|
||||||
|
|
||||||
for (int i = 1; i < localClients.size(); ++i) {
|
for (int i = 1; i < localClients.size(); ++i) {
|
||||||
Command_JoinGame *cmd = new Command_JoinGame(event->getGameId());
|
Command_JoinGame *cmd = new Command_JoinGame(0, event->getGameId());
|
||||||
localClients[i]->sendCommand(cmd);
|
localClients[i]->sendCommand(cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,9 +113,9 @@ void MainWindow::actSinglePlayer()
|
||||||
}
|
}
|
||||||
tabSupervisor->startLocal(localClients);
|
tabSupervisor->startLocal(localClients);
|
||||||
|
|
||||||
/* Command_CreateGame *createCommand = new Command_CreateGame(QString(), QString(), numberPlayers, false, false, false, false);
|
Command_CreateGame *createCommand = new Command_CreateGame(0, QString(), QString(), numberPlayers, false, false, false, false);
|
||||||
mainClient->sendCommand(createCommand);
|
mainClient->sendCommand(createCommand);
|
||||||
*/}
|
}
|
||||||
|
|
||||||
void MainWindow::localGameEnded()
|
void MainWindow::localGameEnded()
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,7 +54,7 @@ private:
|
||||||
static void initializeHashAuto();
|
static void initializeHashAuto();
|
||||||
bool receiverMayDelete;
|
bool receiverMayDelete;
|
||||||
public:
|
public:
|
||||||
static const int protocolVersion = 10;
|
static const int protocolVersion = 11;
|
||||||
static void initializeHash();
|
static void initializeHash();
|
||||||
virtual int getItemId() const = 0;
|
virtual int getItemId() const = 0;
|
||||||
bool getReceiverMayDelete() const { return receiverMayDelete; }
|
bool getReceiverMayDelete() const { return receiverMayDelete; }
|
||||||
|
|
|
@ -209,4 +209,4 @@ void Servatrice::statusUpdate()
|
||||||
execSqlQuery(query);
|
execSqlQuery(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString Servatrice::versionString = "Servatrice 0.20101116";
|
const QString Servatrice::versionString = "Servatrice 0.20110103";
|
||||||
|
|
Loading…
Reference in a new issue