mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 14:32:15 -07:00
Resolve merge conflicts.
Took 10 minutes Took 50 seconds Took 51 seconds Took 2 minutes Took 1 minute
This commit is contained in:
commit
c5072a013b
30 changed files with 3862 additions and 3148 deletions
|
|
@ -66,6 +66,10 @@ while [[ $# != 0 ]]; do
|
|||
shift
|
||||
fi
|
||||
;;
|
||||
'--vcpkg')
|
||||
USE_VCPKG=1
|
||||
shift
|
||||
;;
|
||||
'--dir')
|
||||
shift
|
||||
if [[ $# == 0 ]]; then
|
||||
|
|
@ -116,6 +120,9 @@ fi
|
|||
if [[ $PACKAGE_TYPE ]]; then
|
||||
flags+=("-DCPACK_GENERATOR=$PACKAGE_TYPE")
|
||||
fi
|
||||
if [[ $USE_VCPKG ]]; then
|
||||
flags+=("-DUSE_VCPKG=1")
|
||||
fi
|
||||
|
||||
# Add cmake --build flags
|
||||
buildflags=(--config "$BUILDTYPE")
|
||||
|
|
|
|||
37
.github/workflows/desktop-build.yml
vendored
37
.github/workflows/desktop-build.yml
vendored
|
|
@ -9,20 +9,33 @@ on:
|
|||
push:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- 'webclient/**'
|
||||
- '.github/workflows/web-*.yml'
|
||||
- '.github/workflows/translations-*.yml'
|
||||
- '.github/workflows/docker-release.yml'
|
||||
paths:
|
||||
- '*/**' # matches all files not in root
|
||||
- '!**.md'
|
||||
- '!.github/**'
|
||||
- '!.husky/**'
|
||||
- '!.tx/**'
|
||||
- '!doc/**'
|
||||
- '!webclient/**'
|
||||
- '.github/workflows/desktop-build.yml'
|
||||
- 'CMakeLists.txt'
|
||||
- 'vcpkg.json'
|
||||
- 'vcpkg'
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- 'webclient/**'
|
||||
- '.github/workflows/web-*.yml'
|
||||
- '.github/workflows/translations-*.yml'
|
||||
paths:
|
||||
- '*/**' # matches all files not in root
|
||||
- '!**.md'
|
||||
- '!.github/**'
|
||||
- '!.husky/**'
|
||||
- '!.tx/**'
|
||||
- '!doc/**'
|
||||
- '!webclient/**'
|
||||
- '.github/workflows/desktop-build.yml'
|
||||
- 'CMakeLists.txt'
|
||||
- 'vcpkg.json'
|
||||
- 'vcpkg'
|
||||
|
||||
# Cancel earlier, unfinished runs of this workflow on the same branch (unless on master)
|
||||
concurrency:
|
||||
|
|
@ -318,7 +331,7 @@ jobs:
|
|||
CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}'
|
||||
VCPKG_DISABLE_METRICS: 1
|
||||
VCPKG_BINARY_SOURCES: 'clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite'
|
||||
run: .ci/compile.sh --server --test --ccache "$CCACHE_SIZE"
|
||||
run: .ci/compile.sh --server --test --ccache "$CCACHE_SIZE" --vcpkg
|
||||
|
||||
- name: Sign app bundle
|
||||
if: matrix.make_package && (github.ref == 'refs/heads/master' || needs.configure.outputs.tag != null)
|
||||
|
|
|
|||
21
.github/workflows/desktop-lint.yml
vendored
21
.github/workflows/desktop-lint.yml
vendored
|
|
@ -1,13 +1,22 @@
|
|||
name: Code Style (C++)
|
||||
|
||||
on:
|
||||
# push trigger not needed for linting, we do not allow direct pushes to master
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- 'webclient/**'
|
||||
- '.github/workflows/web-*.yml'
|
||||
- '.github/workflows/translations-*.yml'
|
||||
- '.github/workflows/docker-release.yml'
|
||||
paths:
|
||||
- '*/**' # matches all files not in root
|
||||
- '!**.md'
|
||||
- '!.ci/**'
|
||||
- '!.github/**'
|
||||
- '!.husky/**'
|
||||
- '!.tx/**'
|
||||
- '!doc/**'
|
||||
- '!webclient/**'
|
||||
- '.ci/lint_cpp.sh'
|
||||
- '.github/workflows/desktop-lint.yml'
|
||||
- '.clang-format'
|
||||
- '.cmake-format.json'
|
||||
- 'format.sh'
|
||||
|
||||
jobs:
|
||||
format:
|
||||
|
|
|
|||
1
.github/workflows/translations-pull.yml
vendored
1
.github/workflows/translations-pull.yml
vendored
|
|
@ -7,6 +7,7 @@ on:
|
|||
- cron: '0 0 15 1,4,7,10 *'
|
||||
pull_request:
|
||||
paths:
|
||||
- '.tx/**'
|
||||
- '.github/workflows/translations-pull.yml'
|
||||
|
||||
jobs:
|
||||
|
|
|
|||
1
.github/workflows/translations-push.yml
vendored
1
.github/workflows/translations-push.yml
vendored
|
|
@ -7,6 +7,7 @@ on:
|
|||
- cron: '0 0 1 1,4,7,10 *'
|
||||
pull_request:
|
||||
paths:
|
||||
- '.ci/update_translation_source_strings.sh'
|
||||
- '.github/workflows/translations-push.yml'
|
||||
|
||||
jobs:
|
||||
|
|
|
|||
6
.github/workflows/web-build.yml
vendored
6
.github/workflows/web-build.yml
vendored
|
|
@ -5,14 +5,16 @@ on:
|
|||
branches:
|
||||
- master
|
||||
paths:
|
||||
- '.github/workflows/web-*.yml'
|
||||
- '.husky/**'
|
||||
- 'webclient/**'
|
||||
- '!**.md'
|
||||
- '.github/workflows/web-build.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/web-*.yml'
|
||||
- '.husky/**'
|
||||
- 'webclient/**'
|
||||
- '!**.md'
|
||||
- '.github/workflows/web-build.yml'
|
||||
|
||||
jobs:
|
||||
build-web:
|
||||
|
|
|
|||
3
.github/workflows/web-lint.yml
vendored
3
.github/workflows/web-lint.yml
vendored
|
|
@ -1,11 +1,12 @@
|
|||
name: Code Style (TypeScript)
|
||||
|
||||
on:
|
||||
# push trigger not needed for linting, we do not allow direct pushes to master
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/web-*.yml'
|
||||
- 'webclient/**'
|
||||
- '!**.md'
|
||||
- '.github/workflows/web-lint.yml'
|
||||
|
||||
jobs:
|
||||
ESLint:
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ option(WITH_ORACLE "build oracle" ON)
|
|||
option(WITH_DBCONVERTER "build dbconverter" ON)
|
||||
# Compile tests
|
||||
option(TEST "build tests" OFF)
|
||||
# Use vcpkg regardless of OS
|
||||
option(USE_VCPKG "Use vcpkg regardless of OS" OFF)
|
||||
|
||||
# Default to "Release" build type
|
||||
# User-provided value for CMAKE_BUILD_TYPE must be checked before the PROJECT() call
|
||||
|
|
@ -48,8 +50,8 @@ if(USE_CCACHE)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32 OR APPLE)
|
||||
# Use vcpkg toolchain on Windows and macOS
|
||||
if(WIN32 OR USE_VCPKG)
|
||||
# Use vcpkg toolchain on Windows (and on macOS in CI)
|
||||
set(CMAKE_TOOLCHAIN_FILE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake
|
||||
CACHE STRING "Vcpkg toolchain file"
|
||||
|
|
|
|||
|
|
@ -478,8 +478,8 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
|||
&SettingsCache::setAutoRotateSidewaysLayoutCards);
|
||||
|
||||
overrideAllCardArtWithPersonalPreferenceCheckBox.setChecked(settings.getOverrideAllCardArtWithPersonalPreference());
|
||||
connect(&overrideAllCardArtWithPersonalPreferenceCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
|
||||
&SettingsCache::setOverrideAllCardArtWithPersonalPreference);
|
||||
connect(&overrideAllCardArtWithPersonalPreferenceCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||
&AppearanceSettingsPage::overrideAllCardArtWithPersonalPreferenceToggled);
|
||||
|
||||
bumpSetsWithCardsInDeckToTopCheckBox.setChecked(settings.getBumpSetsWithCardsInDeckToTop());
|
||||
connect(&bumpSetsWithCardsInDeckToTopCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
|
||||
|
|
@ -652,6 +652,45 @@ void AppearanceSettingsPage::showShortcutsChanged(QT_STATE_CHANGED_T value)
|
|||
qApp->setAttribute(Qt::AA_DontShowShortcutsInContextMenus, value == 0); // 0 = unchecked
|
||||
}
|
||||
|
||||
void AppearanceSettingsPage::overrideAllCardArtWithPersonalPreferenceToggled(QT_STATE_CHANGED_T value)
|
||||
{
|
||||
bool enable = static_cast<bool>(value);
|
||||
|
||||
QString message;
|
||||
if (enable) {
|
||||
message = tr("Enabling this feature will disable the use of the Printing Selector.\n\n"
|
||||
"You will not be able to manage printing preferences on a per-deck basis, "
|
||||
"or see printings other people have selected for their decks.\n\n"
|
||||
"You will have to use the Set Manager, available through Card Database -> Manage Sets.\n\n"
|
||||
"Are you sure you would like to enable this feature?");
|
||||
} else {
|
||||
message =
|
||||
tr("Disabling this feature will enable the Printing Selector.\n\n"
|
||||
"You can now choose printings on a per-deck basis in the Deck Editor and configure which printing "
|
||||
"gets added to a deck by default by pinning it in the Printing Selector.\n\n"
|
||||
"You can also use the Set Manager to adjust custom sort order for printings in the Printing Selector"
|
||||
" (other sort orders like alphabetical or release date are available).\n\n"
|
||||
"Are you sure you would like to disable this feature?");
|
||||
}
|
||||
|
||||
QMessageBox::StandardButton result =
|
||||
QMessageBox::question(this, tr("Confirm Change"), message, QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (result == QMessageBox::Yes) {
|
||||
SettingsCache::instance().setOverrideAllCardArtWithPersonalPreference(value);
|
||||
// Caches are now invalid.
|
||||
CardPictureLoader::clearPixmapCache();
|
||||
CardPictureLoader::clearNetworkCache();
|
||||
} else {
|
||||
// If user cancels, revert the checkbox/state back
|
||||
QTimer::singleShot(0, this, [this, enable]() {
|
||||
overrideAllCardArtWithPersonalPreferenceCheckBox.blockSignals(true);
|
||||
overrideAllCardArtWithPersonalPreferenceCheckBox.setChecked(!enable);
|
||||
overrideAllCardArtWithPersonalPreferenceCheckBox.blockSignals(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the settings for cardViewInitialRowsMax.
|
||||
* Forces expanded rows max to always be >= initial rows max
|
||||
|
|
@ -694,8 +733,7 @@ void AppearanceSettingsPage::retranslateUi()
|
|||
displayCardNamesCheckBox.setText(tr("Display card names on cards having a picture"));
|
||||
autoRotateSidewaysLayoutCardsCheckBox.setText(tr("Auto-Rotate cards with sideways layout"));
|
||||
overrideAllCardArtWithPersonalPreferenceCheckBox.setText(
|
||||
tr("Override all card art with personal set preference (Pre-ProviderID change behavior) [Requires Client "
|
||||
"restart]"));
|
||||
tr("Override all card art with personal set preference (Pre-ProviderID change behavior)"));
|
||||
bumpSetsWithCardsInDeckToTopCheckBox.setText(
|
||||
tr("Bump sets that the deck contains cards from to the top in the printing selector"));
|
||||
cardScalingCheckBox.setText(tr("Scale cards on mouse over"));
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ private slots:
|
|||
void themeBoxChanged(int index);
|
||||
void openThemeLocation();
|
||||
void showShortcutsChanged(QT_STATE_CHANGED_T enabled);
|
||||
void overrideAllCardArtWithPersonalPreferenceToggled(QT_STATE_CHANGED_T enabled);
|
||||
|
||||
void cardViewInitialRowsMaxChanged(int value);
|
||||
void cardViewExpandedRowsMaxChanged(int value);
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ void PlayerManager::removePlayer(int playerId)
|
|||
emit playerRemoved(player);
|
||||
emit playerCountChanged();
|
||||
players.remove(playerId);
|
||||
player->deleteLater();
|
||||
}
|
||||
|
||||
Player *PlayerManager::getPlayer(int playerId) const
|
||||
|
|
|
|||
|
|
@ -203,7 +203,10 @@ void DeckEditorDatabaseDisplayWidget::databaseCustomMenu(QPoint point)
|
|||
QAction *addToDeck, *addToSideboard, *selectPrinting, *edhRecCommander, *edhRecCard;
|
||||
addToDeck = menu.addAction(tr("Add to Deck"));
|
||||
addToSideboard = menu.addAction(tr("Add to Sideboard"));
|
||||
selectPrinting = menu.addAction(tr("Select Printing"));
|
||||
if (!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
|
||||
selectPrinting = menu.addAction(tr("Select Printing"));
|
||||
connect(selectPrinting, &QAction::triggered, this, [this, card] { deckEditor->showPrintingSelector(); });
|
||||
}
|
||||
if (canBeCommander(card.getInfo())) {
|
||||
edhRecCommander = menu.addAction(tr("Show on EDHRec (Commander)"));
|
||||
connect(edhRecCommander, &QAction::triggered, this,
|
||||
|
|
@ -213,7 +216,6 @@ void DeckEditorDatabaseDisplayWidget::databaseCustomMenu(QPoint point)
|
|||
|
||||
connect(addToDeck, &QAction::triggered, this, &DeckEditorDatabaseDisplayWidget::actAddCardToMainDeck);
|
||||
connect(addToSideboard, &QAction::triggered, this, &DeckEditorDatabaseDisplayWidget::actAddCardToSideboard);
|
||||
connect(selectPrinting, &QAction::triggered, this, [this, card] { deckEditor->showPrintingSelector(); });
|
||||
connect(edhRecCard, &QAction::triggered, this,
|
||||
[this, card] { deckEditor->getTabSupervisor()->addEdhrecTab(card.getCardPtr()); });
|
||||
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
|||
deckView->sortByColumn(1, Qt::AscendingOrder);
|
||||
deckView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
deckView->installEventFilter(&deckViewKeySignals);
|
||||
deckView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
deckView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
connect(deckView->selectionModel(), &QItemSelectionModel::currentRowChanged, this,
|
||||
&DeckEditorDeckDockWidget::updateCard);
|
||||
connect(deckView, &QTreeView::doubleClicked, this, &DeckEditorDeckDockWidget::actSwapCard);
|
||||
deckView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(deckView, &QTreeView::customContextMenuRequested, this, &DeckEditorDeckDockWidget::decklistCustomMenu);
|
||||
connect(&deckViewKeySignals, &KeySignals::onShiftS, this, &DeckEditorDeckDockWidget::actSwapCard);
|
||||
connect(&deckViewKeySignals, &KeySignals::onEnter, this, &DeckEditorDeckDockWidget::actIncrement);
|
||||
|
|
@ -576,13 +576,14 @@ void DeckEditorDeckDockWidget::offsetCountAtIndex(const QModelIndex &idx, int of
|
|||
|
||||
void DeckEditorDeckDockWidget::decklistCustomMenu(QPoint point)
|
||||
{
|
||||
QMenu menu;
|
||||
if (!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
|
||||
QMenu menu;
|
||||
|
||||
QAction *selectPrinting = menu.addAction(tr("Select Printing"));
|
||||
QAction *selectPrinting = menu.addAction(tr("Select Printing"));
|
||||
connect(selectPrinting, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::showPrintingSelector);
|
||||
|
||||
connect(selectPrinting, &QAction::triggered, deckEditor, &AbstractTabDeckEditor::showPrintingSelector);
|
||||
|
||||
menu.exec(deckView->mapToGlobal(point));
|
||||
menu.exec(deckView->mapToGlobal(point));
|
||||
}
|
||||
}
|
||||
|
||||
void DeckEditorDeckDockWidget::refreshShortcuts()
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@ AbstractTabDeckEditor::AbstractTabDeckEditor(TabSupervisor *_tabSupervisor) : Ta
|
|||
cardInfoDockWidget = new DeckEditorCardInfoDockWidget(this);
|
||||
filterDockWidget = new DeckEditorFilterDockWidget(this);
|
||||
printingSelectorDockWidget = new DeckEditorPrintingSelectorDockWidget(this);
|
||||
connect(&SettingsCache::instance(), &SettingsCache::overrideAllCardArtWithPersonalPreferenceChanged, this, [this] {
|
||||
printingSelectorDockWidget->setHidden(SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference());
|
||||
});
|
||||
|
||||
connect(deckDockWidget, &DeckEditorDeckDockWidget::deckChanged, this, &AbstractTabDeckEditor::onDeckChanged);
|
||||
connect(deckDockWidget, &DeckEditorDeckDockWidget::deckModified, this, &AbstractTabDeckEditor::onDeckModified);
|
||||
|
|
|
|||
|
|
@ -93,6 +93,13 @@ void TabDeckEditor::createMenus()
|
|||
aPrintingSelectorDockFloating->setCheckable(true);
|
||||
connect(aPrintingSelectorDockFloating, &QAction::triggered, this, &TabDeckEditor::dockFloatingTriggered);
|
||||
|
||||
if (SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
|
||||
printingSelectorDockMenu->setEnabled(false);
|
||||
}
|
||||
|
||||
connect(&SettingsCache::instance(), &SettingsCache::overrideAllCardArtWithPersonalPreferenceChanged, this,
|
||||
[this](bool enabled) { printingSelectorDockMenu->setEnabled(!enabled); });
|
||||
|
||||
viewMenu->addSeparator();
|
||||
|
||||
aResetLayout = viewMenu->addAction(QString());
|
||||
|
|
@ -171,6 +178,13 @@ void TabDeckEditor::loadLayout()
|
|||
restoreGeometry(layouts.getDeckEditorGeometry());
|
||||
}
|
||||
|
||||
if (SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
|
||||
if (!printingSelectorDockWidget->isHidden()) {
|
||||
printingSelectorDockWidget->setHidden(true);
|
||||
aPrintingSelectorDockVisible->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
aCardInfoDockVisible->setChecked(!cardInfoDockWidget->isHidden());
|
||||
aFilterDockVisible->setChecked(!filterDockWidget->isHidden());
|
||||
aDeckDockVisible->setChecked(!deckDockWidget->isHidden());
|
||||
|
|
@ -203,10 +217,11 @@ void TabDeckEditor::loadLayout()
|
|||
|
||||
void TabDeckEditor::restartLayout()
|
||||
{
|
||||
|
||||
aCardInfoDockVisible->setChecked(true);
|
||||
aDeckDockVisible->setChecked(true);
|
||||
aFilterDockVisible->setChecked(true);
|
||||
aPrintingSelectorDockVisible->setChecked(true);
|
||||
aPrintingSelectorDockVisible->setChecked(!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference());
|
||||
|
||||
aCardInfoDockFloating->setChecked(false);
|
||||
aDeckDockFloating->setChecked(false);
|
||||
|
|
@ -227,7 +242,7 @@ void TabDeckEditor::restartLayout()
|
|||
deckDockWidget->setVisible(true);
|
||||
cardInfoDockWidget->setVisible(true);
|
||||
filterDockWidget->setVisible(true);
|
||||
printingSelectorDockWidget->setVisible(true);
|
||||
printingSelectorDockWidget->setVisible(!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference());
|
||||
|
||||
splitDockWidget(cardInfoDockWidget, printingSelectorDockWidget, Qt::Horizontal);
|
||||
splitDockWidget(printingSelectorDockWidget, deckDockWidget, Qt::Horizontal);
|
||||
|
|
|
|||
|
|
@ -650,14 +650,6 @@ void TabGame::notifyPlayerKicked()
|
|||
msgBox.exec();
|
||||
}
|
||||
|
||||
void TabGame::processPlayerLeave(Player *leavingPlayer)
|
||||
{
|
||||
QString playerName = "@" + leavingPlayer->getPlayerInfo()->getName();
|
||||
removePlayerFromAutoCompleteList(playerName);
|
||||
|
||||
scene->removePlayer(leavingPlayer);
|
||||
}
|
||||
|
||||
Player *TabGame::addPlayer(Player *newPlayer)
|
||||
{
|
||||
QString newPlayerName = "@" + newPlayer->getPlayerInfo()->getName();
|
||||
|
|
@ -707,6 +699,31 @@ void TabGame::addLocalPlayer(Player *newPlayer, int playerId)
|
|||
}
|
||||
}
|
||||
|
||||
void TabGame::processPlayerLeave(Player *leavingPlayer)
|
||||
{
|
||||
QString playerName = "@" + leavingPlayer->getPlayerInfo()->getName();
|
||||
removePlayerFromAutoCompleteList(playerName);
|
||||
|
||||
scene->removePlayer(leavingPlayer);
|
||||
|
||||
// When we inserted the playerMenu into the gameMenu earlier, Qt wrapped the playerMenu into a QAction*, which lives
|
||||
// independently and does not get cleaned up when the source menu gets destroyed. We have to manually clean here.
|
||||
if (leavingPlayer->getPlayerMenu()) {
|
||||
QMenu *menu = leavingPlayer->getPlayerMenu()->getPlayerMenu();
|
||||
if (menu) {
|
||||
// Find and remove the QAction pointing to this menu
|
||||
QList<QAction *> actions = gameMenu->actions();
|
||||
for (QAction *act : actions) {
|
||||
if (act->menu() == menu) {
|
||||
gameMenu->removeAction(act);
|
||||
delete act; // deletes the QAction wrapper around the submenu
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TabGame::processRemotePlayerDeckSelect(QString deckList, int playerId, QString playerName)
|
||||
{
|
||||
DeckList loader;
|
||||
|
|
|
|||
|
|
@ -126,6 +126,13 @@ void TabDeckEditorVisual::createMenus()
|
|||
aPrintingSelectorDockFloating->setCheckable(true);
|
||||
connect(aPrintingSelectorDockFloating, SIGNAL(triggered()), this, SLOT(dockFloatingTriggered()));
|
||||
|
||||
if (SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
|
||||
printingSelectorDockMenu->setEnabled(false);
|
||||
}
|
||||
|
||||
connect(&SettingsCache::instance(), &SettingsCache::overrideAllCardArtWithPersonalPreferenceChanged, this,
|
||||
[this](bool enabled) { printingSelectorDockMenu->setEnabled(!enabled); });
|
||||
|
||||
viewMenu->addSeparator();
|
||||
|
||||
aResetLayout = viewMenu->addAction(QString());
|
||||
|
|
@ -236,6 +243,13 @@ void TabDeckEditorVisual::loadLayout()
|
|||
restoreGeometry(layouts.getDeckEditorGeometry());
|
||||
}
|
||||
|
||||
if (SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference()) {
|
||||
if (!printingSelectorDockWidget->isHidden()) {
|
||||
printingSelectorDockWidget->setHidden(true);
|
||||
aPrintingSelectorDockVisible->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
aCardInfoDockVisible->setChecked(!cardInfoDockWidget->isHidden());
|
||||
aFilterDockVisible->setChecked(!filterDockWidget->isHidden());
|
||||
aDeckDockVisible->setChecked(!deckDockWidget->isHidden());
|
||||
|
|
@ -271,7 +285,7 @@ void TabDeckEditorVisual::restartLayout()
|
|||
aCardInfoDockVisible->setChecked(true);
|
||||
aDeckDockVisible->setChecked(true);
|
||||
aFilterDockVisible->setChecked(false);
|
||||
aPrintingSelectorDockVisible->setChecked(true);
|
||||
aPrintingSelectorDockVisible->setChecked(!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference());
|
||||
|
||||
aCardInfoDockFloating->setChecked(false);
|
||||
aDeckDockFloating->setChecked(false);
|
||||
|
|
@ -279,22 +293,21 @@ void TabDeckEditorVisual::restartLayout()
|
|||
aPrintingSelectorDockFloating->setChecked(false);
|
||||
|
||||
setCentralWidget(centralWidget);
|
||||
|
||||
addDockWidget(Qt::RightDockWidgetArea, deckDockWidget);
|
||||
addDockWidget(Qt::RightDockWidgetArea, cardInfoDockWidget);
|
||||
addDockWidget(Qt::RightDockWidgetArea, filterDockWidget);
|
||||
addDockWidget(Qt::RightDockWidgetArea, printingSelectorDockWidget);
|
||||
|
||||
deckDockWidget->setVisible(true);
|
||||
cardInfoDockWidget->setVisible(true);
|
||||
filterDockWidget->setVisible(false);
|
||||
printingSelectorDockWidget->setVisible(!SettingsCache::instance().getOverrideAllCardArtWithPersonalPreference());
|
||||
|
||||
deckDockWidget->setFloating(false);
|
||||
cardInfoDockWidget->setFloating(false);
|
||||
filterDockWidget->setFloating(false);
|
||||
printingSelectorDockWidget->setFloating(false);
|
||||
|
||||
deckDockWidget->setVisible(true);
|
||||
cardInfoDockWidget->setVisible(true);
|
||||
filterDockWidget->setVisible(false);
|
||||
printingSelectorDockWidget->setVisible(true);
|
||||
|
||||
splitDockWidget(cardInfoDockWidget, printingSelectorDockWidget, Qt::Vertical);
|
||||
splitDockWidget(cardInfoDockWidget, deckDockWidget, Qt::Horizontal);
|
||||
splitDockWidget(cardInfoDockWidget, filterDockWidget, Qt::Horizontal);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
10
format.sh
10
format.sh
|
|
@ -12,18 +12,18 @@ olddir="$PWD"
|
|||
cd "${BASH_SOURCE%/*}/" || exit 2 # could not find path, this could happen with special links etc.
|
||||
|
||||
# defaults
|
||||
include=("common" \
|
||||
"cockatrice/src" \
|
||||
include=("cockatrice/src" \
|
||||
"common" \
|
||||
"dbconverter/src" \
|
||||
"oracle/src" \
|
||||
"servatrice/src" \
|
||||
"tests")
|
||||
exclude=("servatrice/src/smtp" \
|
||||
"common/sfmt" \
|
||||
exclude=("common/sfmt" \
|
||||
"common/lib" \
|
||||
"oracle/src/zip" \
|
||||
"oracle/src/lzma" \
|
||||
"oracle/src/qt-json")
|
||||
"oracle/src/qt-json" \
|
||||
"servatrice/src/smtp")
|
||||
exts=("cpp" "h" "proto")
|
||||
cf_cmd="clang-format"
|
||||
branch="origin/master"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ set(CMAKE_AUTORCC ON)
|
|||
|
||||
set(HEADERS
|
||||
libcockatrice/server/game/server_abstract_participant.h
|
||||
libcockatrice/server/game/server_abstract_player.h
|
||||
libcockatrice/server/game/server_arrow.h
|
||||
libcockatrice/server/game/server_arrowtarget.h
|
||||
libcockatrice/server/game/server_card.h
|
||||
|
|
@ -35,6 +36,7 @@ add_library(
|
|||
${MOC_SOURCES}
|
||||
libcockatrice/server/debug_pb_message.cpp
|
||||
libcockatrice/server/game/server_abstract_participant.cpp
|
||||
libcockatrice/server/game/server_abstract_player.cpp
|
||||
libcockatrice/server/game/server_arrow.cpp
|
||||
libcockatrice/server/game/server_arrowtarget.cpp
|
||||
libcockatrice/server/game/server_card.cpp
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ Server_AbstractParticipant::cmdJudge(const Command_Judge &cmd, ResponseContainer
|
|||
return Response::RespFunctionNotAllowed;
|
||||
}
|
||||
|
||||
Server_Player *player = this->game->getPlayer(cmd.target_id());
|
||||
auto *player = this->game->getPlayer(cmd.target_id());
|
||||
|
||||
ges.setForcedByJudge(playerId);
|
||||
if (player == nullptr) {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,152 @@
|
|||
#ifndef ABSTRACT_PLAYER_H
|
||||
#define ABSTRACT_PLAYER_H
|
||||
|
||||
#include "../serverinfo_user_container.h"
|
||||
#include "server_abstract_participant.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
|
||||
class CardToMove;
|
||||
class DeckList;
|
||||
class Server_Arrow;
|
||||
class Server_Card;
|
||||
class Server_CardZone;
|
||||
class Server_Counter;
|
||||
struct MoveCardStruct;
|
||||
|
||||
class Server_AbstractPlayer : public Server_AbstractParticipant
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
class MoveCardCompareFunctor;
|
||||
QMap<int, Server_Arrow *> arrows;
|
||||
|
||||
void sendCreateTokenEvents(Server_CardZone *zone, Server_Card *card, int xCoord, int yCoord, GameEventStorage &ges);
|
||||
void getPlayerProperties(ServerInfo_PlayerProperties &result) override;
|
||||
|
||||
protected:
|
||||
bool conceded;
|
||||
DeckList *deck;
|
||||
bool sideboardLocked;
|
||||
QMap<QString, Server_CardZone *> zones;
|
||||
bool readyStart;
|
||||
int nextCardId;
|
||||
|
||||
void revealTopCardIfNeeded(Server_CardZone *zone, GameEventStorage &ges);
|
||||
|
||||
public:
|
||||
Server_AbstractPlayer(Server_Game *_game,
|
||||
int _playerId,
|
||||
const ServerInfo_User &_userInfo,
|
||||
bool _judge,
|
||||
Server_AbstractUserInterface *_handler);
|
||||
~Server_AbstractPlayer() override;
|
||||
void prepareDestroy() override;
|
||||
const DeckList *getDeckList() const
|
||||
{
|
||||
return deck;
|
||||
}
|
||||
bool getReadyStart() const
|
||||
{
|
||||
return readyStart;
|
||||
}
|
||||
void setReadyStart(bool _readyStart)
|
||||
{
|
||||
readyStart = _readyStart;
|
||||
}
|
||||
bool getConceded() const
|
||||
{
|
||||
return conceded;
|
||||
}
|
||||
void setConceded(bool _conceded)
|
||||
{
|
||||
conceded = _conceded;
|
||||
}
|
||||
|
||||
const QMap<QString, Server_CardZone *> &getZones() const
|
||||
{
|
||||
return zones;
|
||||
}
|
||||
const QMap<int, Server_Arrow *> &getArrows() const
|
||||
{
|
||||
return arrows;
|
||||
}
|
||||
|
||||
int newCardId();
|
||||
int newArrowId() const;
|
||||
|
||||
void addZone(Server_CardZone *zone);
|
||||
void addArrow(Server_Arrow *arrow);
|
||||
void updateArrowId(int id);
|
||||
bool deleteArrow(int arrowId);
|
||||
|
||||
virtual void setupZones();
|
||||
virtual void clearZones();
|
||||
|
||||
Response::ResponseCode moveCard(GameEventStorage &ges,
|
||||
Server_CardZone *startzone,
|
||||
const QList<const CardToMove *> &_cards,
|
||||
Server_CardZone *targetzone,
|
||||
int xCoord,
|
||||
int yCoord,
|
||||
bool fixFreeSpaces = true,
|
||||
bool undoingDraw = false,
|
||||
bool isReversed = false);
|
||||
virtual void onCardBeingMoved(GameEventStorage &ges,
|
||||
const MoveCardStruct &cardStruct,
|
||||
Server_CardZone *startzone,
|
||||
Server_CardZone *targetzone,
|
||||
bool undoingDraw);
|
||||
|
||||
void unattachCard(GameEventStorage &ges, Server_Card *card);
|
||||
Response::ResponseCode setCardAttrHelper(GameEventStorage &ges,
|
||||
int targetPlayerId,
|
||||
const QString &zone,
|
||||
int cardId,
|
||||
CardAttribute attribute,
|
||||
const QString &attrValue,
|
||||
Server_Card *unzonedCard = nullptr);
|
||||
|
||||
virtual Response::ResponseCode
|
||||
cmdConcede(const Command_Concede &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
virtual Response::ResponseCode
|
||||
cmdUnconcede(const Command_Unconcede &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
virtual Response::ResponseCode
|
||||
cmdReadyStart(const Command_ReadyStart &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
virtual Response::ResponseCode
|
||||
cmdRollDie(const Command_RollDie &cmd, ResponseContainer &rc, GameEventStorage &ges) const override;
|
||||
virtual Response::ResponseCode
|
||||
cmdMoveCard(const Command_MoveCard &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
virtual Response::ResponseCode
|
||||
cmdFlipCard(const Command_FlipCard &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
virtual Response::ResponseCode
|
||||
cmdAttachCard(const Command_AttachCard &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
virtual Response::ResponseCode
|
||||
cmdCreateToken(const Command_CreateToken &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
virtual Response::ResponseCode
|
||||
cmdCreateArrow(const Command_CreateArrow &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
virtual Response::ResponseCode
|
||||
cmdDeleteArrow(const Command_DeleteArrow &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
virtual Response::ResponseCode
|
||||
cmdSetCardAttr(const Command_SetCardAttr &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
virtual Response::ResponseCode
|
||||
cmdSetCardCounter(const Command_SetCardCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
virtual Response::ResponseCode
|
||||
cmdIncCardCounter(const Command_IncCardCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
virtual Response::ResponseCode
|
||||
cmdDumpZone(const Command_DumpZone &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
virtual Response::ResponseCode
|
||||
cmdRevealCards(const Command_RevealCards &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
virtual Response::ResponseCode cmdChangeZoneProperties(const Command_ChangeZoneProperties &cmd,
|
||||
ResponseContainer &rc,
|
||||
GameEventStorage &ges) override;
|
||||
|
||||
virtual void getInfo(ServerInfo_Player *info,
|
||||
Server_AbstractParticipant *playerWhosAsking,
|
||||
bool omniscient,
|
||||
bool withUserInfo) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -19,15 +19,15 @@
|
|||
***************************************************************************/
|
||||
#include "server_cardzone.h"
|
||||
|
||||
#include "server_abstract_player.h"
|
||||
#include "server_card.h"
|
||||
#include "server_player.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QSet>
|
||||
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
|
||||
#include <libcockatrice/rng/rng_abstract.h>
|
||||
|
||||
Server_CardZone::Server_CardZone(Server_Player *_player,
|
||||
Server_CardZone::Server_CardZone(Server_AbstractPlayer *_player,
|
||||
const QString &_name,
|
||||
bool _has_coords,
|
||||
ServerInfo_Zone::ZoneType _type)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include <QString>
|
||||
|
||||
class Server_Card;
|
||||
class Server_Player;
|
||||
class Server_AbstractPlayer;
|
||||
class Server_AbstractParticipant;
|
||||
class Server_Game;
|
||||
class GameEventStorage;
|
||||
|
|
@ -36,7 +36,7 @@ class GameEventStorage;
|
|||
class Server_CardZone
|
||||
{
|
||||
private:
|
||||
Server_Player *player;
|
||||
Server_AbstractPlayer *player;
|
||||
QString name;
|
||||
bool has_coords; // having coords means this zone has x and y coordinates
|
||||
ServerInfo_Zone::ZoneType type;
|
||||
|
|
@ -52,7 +52,10 @@ private:
|
|||
void insertCardIntoCoordMap(Server_Card *card, int x, int y);
|
||||
|
||||
public:
|
||||
Server_CardZone(Server_Player *_player, const QString &_name, bool _has_coords, ServerInfo_Zone::ZoneType _type);
|
||||
Server_CardZone(Server_AbstractPlayer *_player,
|
||||
const QString &_name,
|
||||
bool _has_coords,
|
||||
ServerInfo_Zone::ZoneType _type);
|
||||
~Server_CardZone();
|
||||
|
||||
const QList<Server_Card *> &getCards() const
|
||||
|
|
@ -84,7 +87,7 @@ public:
|
|||
{
|
||||
return name;
|
||||
}
|
||||
Server_Player *getPlayer() const
|
||||
Server_AbstractPlayer *getPlayer() const
|
||||
{
|
||||
return player;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
***************************************************************************/
|
||||
#include "server_game.h"
|
||||
|
||||
#include "server_abstract_player.h"
|
||||
#include "server_arrow.h"
|
||||
#include "server_card.h"
|
||||
#include "server_cardzone.h"
|
||||
|
|
@ -221,24 +222,24 @@ void Server_Game::pingClockTimeout()
|
|||
}
|
||||
}
|
||||
|
||||
QMap<int, Server_Player *> Server_Game::getPlayers() const // copies pointers to new map
|
||||
QMap<int, Server_AbstractPlayer *> Server_Game::getPlayers() const // copies pointers to new map
|
||||
{
|
||||
QMap<int, Server_Player *> players;
|
||||
QMap<int, Server_AbstractPlayer *> players;
|
||||
QMutexLocker locker(&gameMutex);
|
||||
for (int id : participants.keys()) {
|
||||
auto *participant = participants[id];
|
||||
if (!participant->getSpectator()) {
|
||||
players[id] = static_cast<Server_Player *>(participant);
|
||||
players[id] = static_cast<Server_AbstractPlayer *>(participant);
|
||||
}
|
||||
}
|
||||
return players;
|
||||
}
|
||||
|
||||
Server_Player *Server_Game::getPlayer(int id) const
|
||||
Server_AbstractPlayer *Server_Game::getPlayer(int id) const
|
||||
{
|
||||
auto *participant = participants.value(id);
|
||||
if (!participant->getSpectator()) {
|
||||
return static_cast<Server_Player *>(participant);
|
||||
return static_cast<Server_AbstractPlayer *>(participant);
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -339,7 +340,7 @@ void Server_Game::doStartGameIfReady(bool forceStartGame)
|
|||
}
|
||||
}
|
||||
|
||||
for (Server_Player *player : players.values()) {
|
||||
for (Server_AbstractPlayer *player : players.values()) {
|
||||
player->setupZones();
|
||||
}
|
||||
|
||||
|
|
@ -534,7 +535,7 @@ void Server_Game::removeParticipant(Server_AbstractParticipant *participant, Eve
|
|||
bool spectator = participant->getSpectator();
|
||||
GameEventStorage ges;
|
||||
if (!spectator) {
|
||||
auto *player = static_cast<Server_Player *>(participant);
|
||||
auto *player = static_cast<Server_AbstractPlayer *>(participant);
|
||||
removeArrowsRelatedToPlayer(ges, player);
|
||||
unattachCards(ges, player);
|
||||
}
|
||||
|
|
@ -577,14 +578,14 @@ void Server_Game::removeParticipant(Server_AbstractParticipant *participant, Eve
|
|||
emit gameInfoChanged(gameInfo);
|
||||
}
|
||||
|
||||
void Server_Game::removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_Player *player)
|
||||
void Server_Game::removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_AbstractPlayer *player)
|
||||
{
|
||||
QMutexLocker locker(&gameMutex);
|
||||
|
||||
// Remove all arrows of other players pointing to the player being removed or to one of his cards.
|
||||
// Also remove all arrows starting at one of his cards. This is necessary since players can create
|
||||
// arrows that start at another person's cards.
|
||||
for (Server_Player *anyPlayer : getPlayers().values()) {
|
||||
for (Server_AbstractPlayer *anyPlayer : getPlayers().values()) {
|
||||
QList<Server_Arrow *> arrows = anyPlayer->getArrows().values();
|
||||
QList<Server_Arrow *> toDelete;
|
||||
for (int i = 0; i < arrows.size(); ++i) {
|
||||
|
|
@ -593,7 +594,7 @@ void Server_Game::removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_Play
|
|||
if (targetCard) {
|
||||
if (targetCard->getZone() != nullptr && targetCard->getZone()->getPlayer() == player)
|
||||
toDelete.append(arrow);
|
||||
} else if (static_cast<Server_Player *>(arrow->getTargetItem()) == player)
|
||||
} else if (static_cast<Server_AbstractPlayer *>(arrow->getTargetItem()) == player)
|
||||
toDelete.append(arrow);
|
||||
|
||||
// Don't use else here! It has to happen regardless of whether targetCard == 0.
|
||||
|
|
@ -610,7 +611,7 @@ void Server_Game::removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_Play
|
|||
}
|
||||
}
|
||||
|
||||
void Server_Game::unattachCards(GameEventStorage &ges, Server_Player *player)
|
||||
void Server_Game::unattachCards(GameEventStorage &ges, Server_AbstractPlayer *player)
|
||||
{
|
||||
QMutexLocker locker(&gameMutex);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class QTimer;
|
|||
class GameEventContainer;
|
||||
class GameReplay;
|
||||
class Server_Room;
|
||||
class Server_Player;
|
||||
class Server_AbstractPlayer;
|
||||
class Server_AbstractParticipant;
|
||||
class ServerInfo_User;
|
||||
class ServerInfo_Game;
|
||||
|
|
@ -130,8 +130,8 @@ public:
|
|||
}
|
||||
int getPlayerCount() const;
|
||||
int getSpectatorCount() const;
|
||||
QMap<int, Server_Player *> getPlayers() const;
|
||||
Server_Player *getPlayer(int id) const;
|
||||
QMap<int, Server_AbstractPlayer *> getPlayers() const;
|
||||
Server_AbstractPlayer *getPlayer(int id) const;
|
||||
const QMap<int, Server_AbstractParticipant *> &getParticipants() const
|
||||
{
|
||||
return participants;
|
||||
|
|
@ -185,8 +185,8 @@ public:
|
|||
bool judge,
|
||||
bool broadcastUpdate = true);
|
||||
void removeParticipant(Server_AbstractParticipant *participant, Event_Leave::LeaveReason reason);
|
||||
void removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_Player *player);
|
||||
void unattachCards(GameEventStorage &ges, Server_Player *player);
|
||||
void removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_AbstractPlayer *player);
|
||||
void unattachCards(GameEventStorage &ges, Server_AbstractPlayer *player);
|
||||
bool kickParticipant(int playerId);
|
||||
void startGameIfReady(bool forceStartGame);
|
||||
void stopGameIfFinished();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef MOVE_CARD_STRUCT
|
||||
#define MOVE_CARD_STRUCT
|
||||
|
||||
#include "server_card.h"
|
||||
class CardToMove;
|
||||
|
||||
struct MoveCardStruct
|
||||
{
|
||||
Server_Card *card;
|
||||
int position;
|
||||
const CardToMove *cardToMove;
|
||||
int xCoord, yCoord;
|
||||
MoveCardStruct(Server_Card *_card, int _position, const CardToMove *_cardToMove)
|
||||
: card(_card), position(_position), cardToMove(_cardToMove), xCoord(_card->getX()), yCoord(_card->getY())
|
||||
|
||||
{
|
||||
}
|
||||
bool operator<(const MoveCardStruct &other) const
|
||||
{
|
||||
return (yCoord == other.yCoord &&
|
||||
((xCoord == other.xCoord && position < other.position) || xCoord < other.xCoord)) ||
|
||||
yCoord < other.yCoord;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,37 +1,14 @@
|
|||
#ifndef PLAYER_H
|
||||
#define PLAYER_H
|
||||
|
||||
#include "../serverinfo_user_container.h"
|
||||
#include "server_abstract_participant.h"
|
||||
#include "server_abstract_player.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
|
||||
class DeckList;
|
||||
class Server_CardZone;
|
||||
class Server_Counter;
|
||||
class Server_Arrow;
|
||||
class Server_Card;
|
||||
class CardToMove;
|
||||
|
||||
class Server_Player : public Server_AbstractParticipant
|
||||
class Server_Player : public Server_AbstractPlayer
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
class MoveCardCompareFunctor;
|
||||
DeckList *deck;
|
||||
QMap<QString, Server_CardZone *> zones;
|
||||
QMap<int, Server_Counter *> counters;
|
||||
QMap<int, Server_Arrow *> arrows;
|
||||
QList<int> lastDrawList;
|
||||
int nextCardId;
|
||||
bool readyStart;
|
||||
bool conceded;
|
||||
bool sideboardLocked;
|
||||
void revealTopCardIfNeeded(Server_CardZone *zone, GameEventStorage &ges);
|
||||
void sendCreateTokenEvents(Server_CardZone *zone, Server_Card *card, int xCoord, int yCoord, GameEventStorage &ges);
|
||||
void getPlayerProperties(ServerInfo_PlayerProperties &result) override;
|
||||
|
||||
public:
|
||||
Server_Player(Server_Game *_game,
|
||||
|
|
@ -40,79 +17,23 @@ public:
|
|||
bool _judge,
|
||||
Server_AbstractUserInterface *_handler);
|
||||
~Server_Player() override;
|
||||
void prepareDestroy() override;
|
||||
const DeckList *getDeckList() const
|
||||
{
|
||||
return deck;
|
||||
}
|
||||
bool getReadyStart() const
|
||||
{
|
||||
return readyStart;
|
||||
}
|
||||
void setReadyStart(bool _readyStart)
|
||||
{
|
||||
readyStart = _readyStart;
|
||||
}
|
||||
bool getConceded() const
|
||||
{
|
||||
return conceded;
|
||||
}
|
||||
void setConceded(bool _conceded)
|
||||
{
|
||||
conceded = _conceded;
|
||||
}
|
||||
|
||||
const QMap<QString, Server_CardZone *> &getZones() const
|
||||
{
|
||||
return zones;
|
||||
}
|
||||
const QMap<int, Server_Counter *> &getCounters() const
|
||||
{
|
||||
return counters;
|
||||
}
|
||||
const QMap<int, Server_Arrow *> &getArrows() const
|
||||
{
|
||||
return arrows;
|
||||
}
|
||||
|
||||
int newCardId();
|
||||
int newCounterId() const;
|
||||
int newArrowId() const;
|
||||
|
||||
void addZone(Server_CardZone *zone);
|
||||
void addArrow(Server_Arrow *arrow);
|
||||
void updateArrowId(int id);
|
||||
bool deleteArrow(int arrowId);
|
||||
void addCounter(Server_Counter *counter);
|
||||
|
||||
void clearZones();
|
||||
void setupZones();
|
||||
void setupZones() override;
|
||||
void clearZones() override;
|
||||
|
||||
Response::ResponseCode drawCards(GameEventStorage &ges, int number);
|
||||
Response::ResponseCode moveCard(GameEventStorage &ges,
|
||||
Server_CardZone *startzone,
|
||||
const QList<const CardToMove *> &_cards,
|
||||
Server_CardZone *targetzone,
|
||||
int xCoord,
|
||||
int yCoord,
|
||||
bool fixFreeSpaces = true,
|
||||
bool undoingDraw = false,
|
||||
bool isReversed = false);
|
||||
void unattachCard(GameEventStorage &ges, Server_Card *card);
|
||||
Response::ResponseCode setCardAttrHelper(GameEventStorage &ges,
|
||||
int targetPlayerId,
|
||||
const QString &zone,
|
||||
int cardId,
|
||||
CardAttribute attribute,
|
||||
const QString &attrValue,
|
||||
Server_Card *unzonedCard = nullptr);
|
||||
void onCardBeingMoved(GameEventStorage &ges,
|
||||
const MoveCardStruct &cardStruct,
|
||||
Server_CardZone *startzone,
|
||||
Server_CardZone *targetzone,
|
||||
bool undoingDraw) override;
|
||||
|
||||
Response::ResponseCode
|
||||
cmdConcede(const Command_Concede &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdUnconcede(const Command_Unconcede &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdReadyStart(const Command_ReadyStart &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdDeckSelect(const Command_DeckSelect &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
|
|
@ -124,30 +45,10 @@ public:
|
|||
Response::ResponseCode
|
||||
cmdMulligan(const Command_Mulligan &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdRollDie(const Command_RollDie &cmd, ResponseContainer &rc, GameEventStorage &ges) const override;
|
||||
Response::ResponseCode
|
||||
cmdDrawCards(const Command_DrawCards &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdUndoDraw(const Command_UndoDraw &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdMoveCard(const Command_MoveCard &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdFlipCard(const Command_FlipCard &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdAttachCard(const Command_AttachCard &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdCreateToken(const Command_CreateToken &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdCreateArrow(const Command_CreateArrow &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdDeleteArrow(const Command_DeleteArrow &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdSetCardAttr(const Command_SetCardAttr &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdSetCardCounter(const Command_SetCardCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdIncCardCounter(const Command_IncCardCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdIncCounter(const Command_IncCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdCreateCounter(const Command_CreateCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
|
|
@ -160,10 +61,6 @@ public:
|
|||
Response::ResponseCode
|
||||
cmdSetActivePhase(const Command_SetActivePhase &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdDumpZone(const Command_DumpZone &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdRevealCards(const Command_RevealCards &cmd, ResponseContainer &rc, GameEventStorage &ges) override;
|
||||
Response::ResponseCode
|
||||
cmdReverseTurn(const Command_ReverseTurn & /*cmd*/, ResponseContainer & /*rc*/, GameEventStorage &ges) override;
|
||||
Response::ResponseCode cmdChangeZoneProperties(const Command_ChangeZoneProperties &cmd,
|
||||
ResponseContainer &rc,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue