mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-06 01:53:25 -08:00
[Refactor] Move game logic into libcockatrice_game (#7437)
* [Refactor] Move game logic into libcockatrice_game * [Refactor] Include card_state.h in player_actions.h * [Game] Inject settings providers into libcockatrice_game, drop Widgets * [Game] Follow base rename to createCardRequested after rebase * [Game] Drop unused CardItem forward declaration * [Game] Fix includes after moving game logic into libcockatrice_game --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
78964779c6
commit
345b0e8ba9
108 changed files with 598 additions and 281 deletions
|
|
@ -420,6 +420,9 @@ if(WITH_ORACLE OR WITH_CLIENT)
|
|||
add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_models ${CMAKE_BINARY_DIR}/libcockatrice_models)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_filters ${CMAKE_BINARY_DIR}/libcockatrice_filters)
|
||||
endif()
|
||||
if(WITH_CLIENT)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/libcockatrice_game ${CMAKE_BINARY_DIR}/libcockatrice_game)
|
||||
endif()
|
||||
|
||||
if(WITH_SERVER)
|
||||
add_subdirectory(servatrice)
|
||||
|
|
|
|||
|
|
@ -69,20 +69,15 @@ set(cockatrice_SOURCES
|
|||
src/filters/filter_builder.cpp
|
||||
src/filters/filter_tree_model.cpp
|
||||
src/filters/syntax_help.cpp
|
||||
src/game/abstract_game.cpp
|
||||
src/game_graphics/board/abstract_card_drag_item.cpp
|
||||
src/game_graphics/board/abstract_card_item.cpp
|
||||
src/game_graphics/board/abstract_counter.cpp
|
||||
src/game/board/arrow_data.cpp
|
||||
src/game_graphics/board/arrow_item.cpp
|
||||
src/game_graphics/board/arrow_registry.cpp
|
||||
src/game_graphics/board/arrow_target.cpp
|
||||
src/game_graphics/board/card_drag_item.cpp
|
||||
src/game_graphics/board/card_item.cpp
|
||||
src/game/board/card_list.cpp
|
||||
src/game/board/card_state.cpp
|
||||
src/game_graphics/board/counter_general.cpp
|
||||
src/game/board/counter_state.cpp
|
||||
src/game_graphics/board/translate_counter_name.cpp
|
||||
src/game_graphics/deckview/deck_view.cpp
|
||||
src/game_graphics/deckview/deck_view_container.cpp
|
||||
|
|
@ -91,15 +86,10 @@ set(cockatrice_SOURCES
|
|||
src/game_graphics/dialogs/dlg_create_token.cpp
|
||||
src/game_graphics/dialogs/dlg_move_top_cards_until.cpp
|
||||
src/game_graphics/dialogs/dlg_roll_dice.cpp
|
||||
src/game/game.cpp
|
||||
src/game/game_event_handler.cpp
|
||||
src/game/game_meta_info.cpp
|
||||
src/game_graphics/game_scene.cpp
|
||||
src/game/game_state.cpp
|
||||
src/game_graphics/game_view.cpp
|
||||
src/game_graphics/hand_counter.cpp
|
||||
src/game_graphics/log/message_log_widget.cpp
|
||||
src/game/phase.cpp
|
||||
src/game_graphics/phases_toolbar.cpp
|
||||
src/game_graphics/player/menu/card_menu.cpp
|
||||
src/game_graphics/player/menu/custom_zone_menu.cpp
|
||||
|
|
@ -117,23 +107,11 @@ set(cockatrice_SOURCES
|
|||
src/game_graphics/tally/stats_tally.cpp
|
||||
src/game_graphics/tally/subtype_tally.cpp
|
||||
src/game_graphics/tally/tally.cpp
|
||||
src/game/player/player_actions.cpp
|
||||
src/game_graphics/player/player_area.cpp
|
||||
src/game_graphics/player/player_dialogs.cpp
|
||||
src/game/player/player_event_handler.cpp
|
||||
src/game_graphics/player/player_graphics_item.cpp
|
||||
src/game/player/player_info.cpp
|
||||
src/game_graphics/player/player_list_widget.cpp
|
||||
src/game/player/player_logic.cpp
|
||||
src/game/player/player_manager.cpp
|
||||
src/game_graphics/player/player_target.cpp
|
||||
src/game/replay.cpp
|
||||
src/game/zones/card_zone_logic.cpp
|
||||
src/game/zones/hand_zone_logic.cpp
|
||||
src/game/zones/pile_zone_logic.cpp
|
||||
src/game/zones/stack_zone_logic.cpp
|
||||
src/game/zones/table_zone_logic.cpp
|
||||
src/game/zones/view_zone_logic.cpp
|
||||
src/game_graphics/zones/card_zone.cpp
|
||||
src/game_graphics/zones/hand_zone.cpp
|
||||
src/game_graphics/zones/pile_zone.cpp
|
||||
|
|
@ -573,6 +551,7 @@ target_link_libraries(
|
|||
PUBLIC libcockatrice_card
|
||||
libcockatrice_deck_list
|
||||
libcockatrice_filters
|
||||
libcockatrice_game
|
||||
libcockatrice_utility
|
||||
libcockatrice_network
|
||||
libcockatrice_models
|
||||
|
|
|
|||
|
|
@ -2,13 +2,18 @@
|
|||
#define COCKATRICE_SETTINGS_CARD_PREFERENCE_PROVIDER_H
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <libcockatrice/interfaces/interface_card_preference_provider.h>
|
||||
#include <libcockatrice/settings/card_override_settings.h>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
|
||||
class SettingsCardPreferenceProvider : public ICardPreferenceProvider
|
||||
class SettingsCardPreferenceProvider : public QObject, public ICardPreferenceProvider
|
||||
{
|
||||
public:
|
||||
explicit SettingsCardPreferenceProvider(QObject *parent = nullptr) : QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
[[nodiscard]] QString getCardPreferenceOverride(const QString &cardName) const override
|
||||
{
|
||||
return SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardName);
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
/**
|
||||
* @file replay.h
|
||||
* @ingroup GameLogic
|
||||
* @ingroup Replay
|
||||
*/
|
||||
//! \todo Document this file.
|
||||
|
||||
#ifndef COCKATRICE_REPLAY_H
|
||||
#define COCKATRICE_REPLAY_H
|
||||
|
||||
#include "abstract_game.h"
|
||||
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class GameReplay;
|
||||
class QObject;
|
||||
|
||||
class Replay : public AbstractGame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Replay(QObject *_parent, const GameReplay *_replay, bool isLocalGame);
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_REPLAY_H
|
||||
|
|
@ -7,11 +7,18 @@
|
|||
#ifndef ABSTRACTCARDITEM_H
|
||||
#define ABSTRACTCARDITEM_H
|
||||
|
||||
#include "../../game/board/card_state.h"
|
||||
#include "../animated_item.h"
|
||||
#include "arrow_target.h"
|
||||
#include "graphics_item_type.h"
|
||||
|
||||
#include <QColor>
|
||||
#include <QGraphicsItem>
|
||||
#include <QSizeF>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
#include <libcockatrice/game/board/card_state.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class PlayerLogic;
|
||||
class CardInfo;
|
||||
class QPainter;
|
||||
|
|
|
|||
|
|
@ -2,10 +2,6 @@
|
|||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../client/settings/shortcuts_settings.h"
|
||||
#include "../../game/board/counter_state.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_info.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../game_graphics/board/translate_counter_name.h"
|
||||
#include "../../interface/widgets/menus/tearoff_menu.h"
|
||||
|
||||
|
|
@ -23,6 +19,10 @@
|
|||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <QtGlobal>
|
||||
#include <libcockatrice/game/board/counter_state.h>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/utility/expression.h>
|
||||
#include <qnamespace.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,6 @@
|
|||
#include "arrow_item.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../game/board/arrow_data.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_info.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../game/zones/card_zone_logic.h"
|
||||
#include "../game_scene.h"
|
||||
#include "../player/player_target.h"
|
||||
#include "../z_values.h"
|
||||
|
|
@ -27,6 +22,11 @@
|
|||
#include <QTransform>
|
||||
#include <QtGlobal>
|
||||
#include <QtMath>
|
||||
#include <libcockatrice/game/board/arrow_data.h>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/zones/card_zone_logic.h>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <libcockatrice/utility/zone_names.h>
|
||||
#include <math.h>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef ARROWITEM_H
|
||||
#define ARROWITEM_H
|
||||
|
||||
#include "../../game/board/arrow_data.h"
|
||||
#include "../animated_item.h"
|
||||
#include "arrow_target.h"
|
||||
#include "graphics_item_type.h"
|
||||
|
|
@ -18,6 +17,7 @@
|
|||
#include <QRectF>
|
||||
#include <QSharedPointer>
|
||||
#include <QtGlobal>
|
||||
#include <libcockatrice/game/board/arrow_data.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class CardItem;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#include "arrow_registry.h"
|
||||
|
||||
#include "../../game/board/arrow_data.h"
|
||||
#include "arrow_item.h"
|
||||
|
||||
#include <QSharedPointer>
|
||||
#include <libcockatrice/game/board/arrow_data.h>
|
||||
|
||||
void ArrowRegistry::insert(QSharedPointer<ArrowData> data, ArrowItem *arrow)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
#ifndef COCKATRICE_ARROW_REGISTRY_H
|
||||
#define COCKATRICE_ARROW_REGISTRY_H
|
||||
|
||||
#include "../../game/board/arrow_data.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QSet>
|
||||
#include <libcockatrice/game/board/arrow_data.h>
|
||||
|
||||
class ArrowItem;
|
||||
struct ArrowData;
|
||||
|
|
|
|||
|
|
@ -1,17 +1,6 @@
|
|||
#include "card_item.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../game/abstract_game.h"
|
||||
#include "../../game/board/card_state.h"
|
||||
#include "../../game/game_state.h"
|
||||
#include "../../game/phase.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_info.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../game/player/player_manager.h"
|
||||
#include "../../game/zones/card_zone_logic.h"
|
||||
#include "../../game/zones/table_zone_logic.h"
|
||||
#include "../../game/zones/view_zone_logic.h"
|
||||
#include "../card_dimensions.h"
|
||||
#include "../game_scene.h"
|
||||
#include "arrow_item.h"
|
||||
|
|
@ -41,6 +30,17 @@
|
|||
#include <QVariant>
|
||||
#include <QtGlobal>
|
||||
#include <libcockatrice/card/card_info.h>
|
||||
#include <libcockatrice/game/abstract_game.h>
|
||||
#include <libcockatrice/game/board/card_state.h>
|
||||
#include <libcockatrice/game/game_state.h>
|
||||
#include <libcockatrice/game/phase.h>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/player/player_manager.h>
|
||||
#include <libcockatrice/game/zones/card_zone_logic.h>
|
||||
#include <libcockatrice/game/zones/table_zone_logic.h>
|
||||
#include <libcockatrice/game/zones/view_zone_logic.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_card.pb.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <libcockatrice/utility/card_ref.h>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef CARDITEM_H
|
||||
#define CARDITEM_H
|
||||
|
||||
#include "../../game/board/card_state.h"
|
||||
#include "abstract_card_item.h"
|
||||
#include "graphics_item_type.h"
|
||||
|
||||
|
|
@ -16,6 +15,7 @@
|
|||
#include <QPointF>
|
||||
#include <QString>
|
||||
#include <QVariantList>
|
||||
#include <libcockatrice/game/board/card_state.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class CardDragItem;
|
||||
|
|
|
|||
|
|
@ -2,9 +2,6 @@
|
|||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../client/settings/shortcuts_settings.h"
|
||||
#include "../../game/abstract_game.h"
|
||||
#include "../../game/game_event_handler.h"
|
||||
#include "../../game/game_state.h"
|
||||
#include "../../interface/card_picture_loader/card_picture_loader.h"
|
||||
#include "../../interface/deck_loader/deck_loader.h"
|
||||
#include "../../interface/widgets/dialogs/dlg_load_deck.h"
|
||||
|
|
@ -34,6 +31,9 @@
|
|||
#include <libcockatrice/deck_list/deck_file_format.h>
|
||||
#include <libcockatrice/deck_list/loaded_deck.h>
|
||||
#include <libcockatrice/deck_list/playmat_resolver.h>
|
||||
#include <libcockatrice/game/abstract_game.h>
|
||||
#include <libcockatrice/game/game_event_handler.h>
|
||||
#include <libcockatrice/game/game_state.h>
|
||||
#include <libcockatrice/protocol/pb/response_deck_download.pb.h>
|
||||
#include <libcockatrice/protocol/pending_command.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
|
|
|
|||
|
|
@ -7,12 +7,11 @@
|
|||
#ifndef DLG_CREATETOKEN_H
|
||||
#define DLG_CREATETOKEN_H
|
||||
|
||||
#include "../../game/player/token_info.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <libcockatrice/game/player/token_info.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class QLabel;
|
||||
|
|
|
|||
|
|
@ -7,12 +7,11 @@
|
|||
#ifndef DLG_MOVE_TOP_CARDS_UNTIL_H
|
||||
#define DLG_MOVE_TOP_CARDS_UNTIL_H
|
||||
|
||||
#include "../../game/player/move_top_cards_until_options.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <libcockatrice/game/player/move_top_cards_until_options.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class FilterString;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,6 @@
|
|||
#include "game_scene.h"
|
||||
|
||||
#include "../client/settings/cache_settings.h"
|
||||
#include "../game/abstract_game.h"
|
||||
#include "../game/board/arrow_data.h"
|
||||
#include "../game/player/player_actions.h"
|
||||
#include "../game/player/player_event_handler.h"
|
||||
#include "../game/player/player_info.h"
|
||||
#include "../game/player/player_logic.h"
|
||||
#include "../game/zones/card_zone_logic.h"
|
||||
#include "../game/zones/view_zone_logic.h"
|
||||
#include "animated_item.h"
|
||||
#include "board/abstract_card_item.h"
|
||||
#include "board/arrow_item.h"
|
||||
|
|
@ -41,6 +33,14 @@
|
|||
#include <QtMath>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <libcockatrice/game/abstract_game.h>
|
||||
#include <libcockatrice/game/board/arrow_data.h>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_event_handler.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/zones/card_zone_logic.h>
|
||||
#include <libcockatrice/game/zones/view_zone_logic.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <libcockatrice/utility/zone_names.h>
|
||||
#include <numeric>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef GAMESCENE_H
|
||||
#define GAMESCENE_H
|
||||
|
||||
#include "../game/board/arrow_data.h"
|
||||
#include "../game/zones/card_zone_logic.h"
|
||||
#include "animated_item.h"
|
||||
#include "board/arrow_item.h"
|
||||
#include "board/arrow_registry.h"
|
||||
|
|
@ -20,6 +18,8 @@
|
|||
#include <QString>
|
||||
#include <QTransform>
|
||||
#include <QtGlobal>
|
||||
#include <libcockatrice/game/board/arrow_data.h>
|
||||
#include <libcockatrice/game/zones/card_zone_logic.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
// IWYU pragma: keep
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
#include "hand_counter.h"
|
||||
|
||||
#include "../game/board/card_list.h"
|
||||
#include "../game/zones/card_zone_logic.h"
|
||||
#include "../interface/pixel_map_generator.h"
|
||||
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
|
|
@ -14,6 +12,8 @@
|
|||
#include <QString>
|
||||
#include <QStringLiteral>
|
||||
#include <QTransform>
|
||||
#include <libcockatrice/game/board/card_list.h>
|
||||
#include <libcockatrice/game/zones/card_zone_logic.h>
|
||||
#include <qnamespace.h>
|
||||
|
||||
class QGraphicsItem;
|
||||
|
|
|
|||
|
|
@ -3,16 +3,6 @@
|
|||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../client/settings/card_counter_settings.h"
|
||||
#include "../../client/sound_engine.h"
|
||||
#include "../../client/translation.h"
|
||||
#include "../../game/abstract_game.h"
|
||||
#include "../../game/board/card_list.h"
|
||||
#include "../../game/game_state.h"
|
||||
#include "../../game/phase.h"
|
||||
#include "../../game/player/player_event_handler.h"
|
||||
#include "../../game/player/player_info.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../game/player/player_manager.h"
|
||||
#include "../../game/zones/card_zone_logic.h"
|
||||
#include "../../interface/card_localization.h"
|
||||
#include "../../interface/widgets/server/chat_view/chat_view.h"
|
||||
#include "../board/card_item.h"
|
||||
|
|
@ -24,6 +14,16 @@
|
|||
#include <QList>
|
||||
#include <QSharedPointer>
|
||||
#include <QStringList>
|
||||
#include <libcockatrice/game/abstract_game.h>
|
||||
#include <libcockatrice/game/board/card_list.h>
|
||||
#include <libcockatrice/game/game_state.h>
|
||||
#include <libcockatrice/game/phase.h>
|
||||
#include <libcockatrice/game/player/player_event_handler.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/player/player_manager.h>
|
||||
#include <libcockatrice/game/translation.h>
|
||||
#include <libcockatrice/game/zones/card_zone_logic.h>
|
||||
#include <libcockatrice/protocol/pb/context_move_card.pb.h>
|
||||
#include <libcockatrice/protocol/pb/context_mulligan.pb.h>
|
||||
#include <libcockatrice/settings/chat_settings.h>
|
||||
|
|
|
|||
|
|
@ -3,15 +3,7 @@
|
|||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../../client/settings/card_counter_settings.h"
|
||||
#include "../../../client/settings/shortcuts_settings.h"
|
||||
#include "../../../game/abstract_game.h"
|
||||
#include "../../../game/player/card_menu_action_type.h"
|
||||
#include "../../../game/player/player_info.h"
|
||||
#include "../../../game/player/player_manager.h"
|
||||
#include "../../../game/zones/card_zone_logic.h"
|
||||
#include "../../board/card_item.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../game/zones/view_zone_logic.h"
|
||||
#include "../../game_scene.h"
|
||||
#include "../player_graphics_item.h"
|
||||
#include "libcockatrice/card/card_info.h"
|
||||
|
|
@ -35,6 +27,14 @@
|
|||
#include <QtGlobal>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/card/relation/card_relation.h>
|
||||
#include <libcockatrice/game/abstract_game.h>
|
||||
#include <libcockatrice/game/player/card_menu_action_type.h>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/player/player_manager.h>
|
||||
#include <libcockatrice/game/zones/card_zone_logic.h>
|
||||
#include <libcockatrice/game/zones/view_zone_logic.h>
|
||||
#include <libcockatrice/utility/zone_names.h>
|
||||
#include <qnamespace.h>
|
||||
#include <utility>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#include "custom_zone_menu.h"
|
||||
|
||||
#include "../../../game/player/player_info.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../game_scene.h"
|
||||
#include "../player_graphics_item.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
|
||||
CustomZoneMenu::CustomZoneMenu(PlayerGraphicsItem *_player) : player(_player)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,13 +2,7 @@
|
|||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../../client/settings/shortcuts_settings.h"
|
||||
#include "../../../game/player/player_info.h"
|
||||
#include "../../../game/player/player_manager.h"
|
||||
#include "../../../game/zones/pile_zone_logic.h"
|
||||
#include "../../../interface/widgets/menus/tearoff_menu.h"
|
||||
#include "../../game/abstract_game.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../player_graphics_item.h"
|
||||
|
||||
#include <QAction>
|
||||
|
|
@ -19,6 +13,12 @@
|
|||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <libcockatrice/game/abstract_game.h>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/player/player_manager.h>
|
||||
#include <libcockatrice/game/zones/pile_zone_logic.h>
|
||||
#include <libcockatrice/utility/zone_names.h>
|
||||
|
||||
class QWidget;
|
||||
|
|
|
|||
|
|
@ -2,14 +2,7 @@
|
|||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../../client/settings/shortcuts_settings.h"
|
||||
#include "../../../game/board/card_list.h"
|
||||
#include "../../../game/player/player_info.h"
|
||||
#include "../../../game/player/player_manager.h"
|
||||
#include "../../../game/zones/hand_zone_logic.h"
|
||||
#include "../../../interface/widgets/menus/tearoff_menu.h"
|
||||
#include "../../game/abstract_game.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../player_graphics_item.h"
|
||||
|
||||
#include <QAction>
|
||||
|
|
@ -20,6 +13,13 @@
|
|||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <libcockatrice/game/abstract_game.h>
|
||||
#include <libcockatrice/game/board/card_list.h>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/player/player_manager.h>
|
||||
#include <libcockatrice/game/zones/hand_zone_logic.h>
|
||||
#include <libcockatrice/utility/zone_names.h>
|
||||
|
||||
class QWidget;
|
||||
|
|
|
|||
|
|
@ -2,14 +2,7 @@
|
|||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../../client/settings/shortcuts_settings.h"
|
||||
#include "../../../game/board/card_list.h"
|
||||
#include "../../../game/player/player_info.h"
|
||||
#include "../../../game/player/player_manager.h"
|
||||
#include "../../../game/zones/pile_zone_logic.h"
|
||||
#include "../../../interface/widgets/menus/tearoff_menu.h"
|
||||
#include "../../game/abstract_game.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../player_graphics_item.h"
|
||||
|
||||
#include <QAction>
|
||||
|
|
@ -23,6 +16,13 @@
|
|||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <libcockatrice/game/abstract_game.h>
|
||||
#include <libcockatrice/game/board/card_list.h>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/player/player_manager.h>
|
||||
#include <libcockatrice/game/zones/pile_zone_logic.h>
|
||||
|
||||
class QWidget;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../../client/settings/shortcuts_settings.h"
|
||||
#include "../../../game/player/card_menu_action_type.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../game_scene.h"
|
||||
#include "../player_graphics_item.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <libcockatrice/game/player/card_menu_action_type.h>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
|
||||
MoveMenu::MoveMenu(PlayerGraphicsItem *player) : QMenu(tr("Move to"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,10 +2,6 @@
|
|||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../../client/settings/shortcuts_settings.h"
|
||||
#include "../../../game/abstract_game.h"
|
||||
#include "../../../game/player/player_info.h"
|
||||
#include "../../../game/player/player_logic.h"
|
||||
#include "../../../game/player/player_manager.h"
|
||||
#include "../../../game_graphics/zones/hand_zone.h"
|
||||
#include "../../../game_graphics/zones/pile_zone.h"
|
||||
#include "../../../game_graphics/zones/table_zone.h"
|
||||
|
|
@ -26,6 +22,10 @@
|
|||
|
||||
#include <QMenu>
|
||||
#include <QString>
|
||||
#include <libcockatrice/game/abstract_game.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/player/player_manager.h>
|
||||
|
||||
PlayerMenu::PlayerMenu(PlayerGraphicsItem *_player) : QObject(_player), player(_player)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../../client/settings/shortcuts_settings.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../game_scene.h"
|
||||
#include "../player_graphics_item.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
|
||||
PtMenu::PtMenu(PlayerGraphicsItem *player) : QMenu(tr("Power / toughness"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
#include "rfg_menu.h"
|
||||
|
||||
#include "../../../game/player/player_info.h"
|
||||
#include "../../../game/zones/pile_zone_logic.h"
|
||||
#include "../../../interface/widgets/menus/tearoff_menu.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../player_graphics_item.h"
|
||||
|
||||
#include <QAction>
|
||||
|
|
@ -12,6 +8,10 @@
|
|||
#include <QMenu>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/zones/pile_zone_logic.h>
|
||||
#include <libcockatrice/utility/zone_names.h>
|
||||
|
||||
class QWidget;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
#include "say_menu.h"
|
||||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../player_graphics_item.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QKeySequence>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/settings/message_settings.h>
|
||||
|
||||
SayMenu::SayMenu(PlayerGraphicsItem *_player) : player(_player)
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../../client/settings/shortcuts_settings.h"
|
||||
#include "../../../game/player/player_info.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../player_graphics_item.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QKeySequence>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
|
||||
SideboardMenu::SideboardMenu(PlayerGraphicsItem *player, QMenu *playerMenu) : QMenu(playerMenu)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,9 +2,6 @@
|
|||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../../client/settings/shortcuts_settings.h"
|
||||
#include "../../../game/player/player_info.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../game_scene.h"
|
||||
#include "../player_graphics_item.h"
|
||||
#include "libcockatrice/card/card_info.h"
|
||||
|
|
@ -14,6 +11,9 @@
|
|||
#include <QSet>
|
||||
#include <libcockatrice/deck_list/tree/deck_list_card_node.h>
|
||||
#include <libcockatrice/deck_list/tree/inner_deck_list_node.h>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
|
||||
UtilityMenu::UtilityMenu(PlayerGraphicsItem *_player, QMenu *playerMenu) : QMenu(playerMenu), player(_player)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../client/settings/card_counter_settings.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../interface/widgets/utility/get_text_with_max.h"
|
||||
#include "../board/abstract_counter.h"
|
||||
#include "../board/card_item.h"
|
||||
|
|
@ -18,6 +16,8 @@
|
|||
#include <QInputDialog>
|
||||
#include <QLineEdit>
|
||||
#include <libcockatrice/card/relation/card_relation.h>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/utility/string_limits.h>
|
||||
|
||||
PlayerDialogs::PlayerDialogs(PlayerGraphicsItem *_player, PlayerActions *_playerActions)
|
||||
|
|
@ -35,7 +35,7 @@ PlayerDialogs::PlayerDialogs(PlayerGraphicsItem *_player, PlayerActions *_player
|
|||
&PlayerDialogs::onShuffleBottomDialogRequested);
|
||||
|
||||
connect(playerActions, &PlayerActions::requestMulliganDialog, this, &PlayerDialogs::onMulliganDialogRequested);
|
||||
|
||||
connect(playerActions, &PlayerActions::startingHandSizeChosen, this, &PlayerDialogs::onStartingHandSizeChosen);
|
||||
connect(playerActions, &PlayerActions::requestDrawCardsDialog, this, &PlayerDialogs::onDrawCardsDialogRequested);
|
||||
|
||||
connect(playerActions, &PlayerActions::requestMoveTopCardsToDialog, this,
|
||||
|
|
@ -127,6 +127,11 @@ void PlayerDialogs::onMulliganDialogRequested(int startSize, int handSize, int d
|
|||
}
|
||||
}
|
||||
|
||||
void PlayerDialogs::onStartingHandSizeChosen(int number)
|
||||
{
|
||||
SettingsCache::instance().userInterface().setStartingHandSize(number);
|
||||
}
|
||||
|
||||
void PlayerDialogs::onDrawCardsDialogRequested(int defaultNumberTopCards, int deckSize)
|
||||
{
|
||||
bool ok;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
class CardItem;
|
||||
class CardRelation;
|
||||
class CardState;
|
||||
class PlayerActions;
|
||||
class QWidget;
|
||||
struct MoveTopCardsUntilOptions;
|
||||
|
|
@ -58,6 +59,7 @@ public slots:
|
|||
void onSetPTDialogRequested(const QString &oldPT);
|
||||
void onSetAnnotationDialogRequested(const QString &oldAnnotation);
|
||||
void onSetCardCounterDialogRequested(int counterId, const QString &oldValueForDlg);
|
||||
void onStartingHandSizeChosen(int number);
|
||||
|
||||
private:
|
||||
PlayerGraphicsItem *player;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
#include "player_graphics_item.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../game/board/counter_state.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_info.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../game/zones/card_zone_logic.h"
|
||||
#include "../../game/zones/hand_zone_logic.h"
|
||||
#include "../../game/zones/pile_zone_logic.h"
|
||||
#include "../../game/zones/stack_zone_logic.h"
|
||||
#include "../../game/zones/table_zone_logic.h"
|
||||
#include "../../interface/card_picture_loader/card_picture_loader.h"
|
||||
#include "../../interface/widgets/cards/art_crop_attribution.h"
|
||||
#include "../../interface/widgets/cards/card_art_utils.h"
|
||||
|
|
@ -45,6 +36,15 @@
|
|||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/deck_list/deck_list.h>
|
||||
#include <libcockatrice/deck_list/playmat_resolver.h>
|
||||
#include <libcockatrice/game/board/counter_state.h>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/zones/card_zone_logic.h>
|
||||
#include <libcockatrice/game/zones/hand_zone_logic.h>
|
||||
#include <libcockatrice/game/zones/pile_zone_logic.h>
|
||||
#include <libcockatrice/game/zones/stack_zone_logic.h>
|
||||
#include <libcockatrice/game/zones/table_zone_logic.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <qnamespace.h>
|
||||
#include <qnumeric.h>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
#include "player_target.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../game/player/player_info.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../interface/pixel_map_generator.h"
|
||||
#include "../board/abstract_counter.h"
|
||||
#include "../board/abstract_graphics_item.h"
|
||||
|
|
@ -30,6 +28,8 @@
|
|||
#include <QTransform>
|
||||
#include <QtGlobal>
|
||||
#include <QtMath>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
|
||||
#include <qnamespace.h>
|
||||
#include <qnumeric.h>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#include "card_zone.h"
|
||||
|
||||
#include "../../game/board/card_list.h"
|
||||
#include "../../game/zones/card_zone_logic.h"
|
||||
#include "../board/abstract_graphics_item.h"
|
||||
#include "../board/card_item.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QMenu>
|
||||
#include <libcockatrice/game/board/card_list.h>
|
||||
#include <libcockatrice/game/zones/card_zone_logic.h>
|
||||
#include <qnamespace.h>
|
||||
|
||||
class QGraphicsItem;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
#include "hand_zone.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_info.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../game/zones/card_zone_logic.h"
|
||||
#include "../../game/zones/hand_zone_logic.h"
|
||||
#include "../../interface/theme_manager.h"
|
||||
#include "../board/card_drag_item.h"
|
||||
#include "../board/card_item.h"
|
||||
|
|
@ -18,6 +13,11 @@
|
|||
#include <QPointF>
|
||||
#include <QRectF>
|
||||
#include <QString>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/zones/card_zone_logic.h>
|
||||
#include <libcockatrice/game/zones/hand_zone_logic.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <string>
|
||||
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@
|
|||
#ifndef HANDZONE_H
|
||||
#define HANDZONE_H
|
||||
|
||||
#include "../../game/board/card_list.h"
|
||||
#include "select_zone.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <libcockatrice/game/board/card_list.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class HandZoneLogic;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
#include "pile_zone.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../game/board/card_list.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_info.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../game/zones/card_zone_logic.h"
|
||||
#include "../../game/zones/pile_zone_logic.h"
|
||||
#include "../board/card_drag_item.h"
|
||||
#include "../board/card_item.h"
|
||||
#include "../card_dimensions.h"
|
||||
|
|
@ -24,6 +18,12 @@
|
|||
#include <QString>
|
||||
#include <QTransform>
|
||||
#include <QtGlobal>
|
||||
#include <libcockatrice/game/board/card_list.h>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/zones/card_zone_logic.h>
|
||||
#include <libcockatrice/game/zones/pile_zone_logic.h>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <qnamespace.h>
|
||||
#include <string>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
#include "select_zone.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../game/board/card_list.h"
|
||||
#include "../../game/zones/card_zone_logic.h"
|
||||
#include "../board/card_item.h"
|
||||
#include "../game_scene.h"
|
||||
|
||||
|
|
@ -17,6 +15,8 @@
|
|||
#include <QTransform>
|
||||
#include <QtGlobal>
|
||||
#include <QtMath>
|
||||
#include <libcockatrice/game/board/card_list.h>
|
||||
#include <libcockatrice/game/zones/card_zone_logic.h>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <qnamespace.h>
|
||||
#include <qnumeric.h>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,5 @@
|
|||
#include "stack_zone.h"
|
||||
|
||||
#include "../../game/board/card_list.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_info.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../game/zones/card_zone_logic.h"
|
||||
#include "../../game/zones/stack_zone_logic.h"
|
||||
#include "../../interface/theme_manager.h"
|
||||
#include "../board/card_drag_item.h"
|
||||
#include "../board/card_item.h"
|
||||
|
|
@ -19,6 +13,12 @@
|
|||
#include <QPoint>
|
||||
#include <QRectF>
|
||||
#include <QString>
|
||||
#include <libcockatrice/game/board/card_list.h>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/zones/card_zone_logic.h>
|
||||
#include <libcockatrice/game/zones/stack_zone_logic.h>
|
||||
#include <qnumeric.h>
|
||||
#include <string>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
#include "table_zone.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../game/board/card_list.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_info.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../game/zones/card_zone_logic.h"
|
||||
#include "../../game/zones/table_zone_logic.h"
|
||||
#include "../../interface/theme_manager.h"
|
||||
#include "../board/abstract_card_item.h"
|
||||
#include "../board/card_drag_item.h"
|
||||
|
|
@ -32,6 +26,12 @@
|
|||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <libcockatrice/card/card_info.h>
|
||||
#include <libcockatrice/game/board/card_list.h>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/zones/card_zone_logic.h>
|
||||
#include <libcockatrice/game/zones/table_zone_logic.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <libcockatrice/utility/zone_names.h>
|
||||
#include <string>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef TABLEZONE_H
|
||||
#define TABLEZONE_H
|
||||
|
||||
#include "../../game/zones/table_zone_logic.h"
|
||||
#include "../animated_item.h"
|
||||
#include "../card_dimensions.h"
|
||||
#include "select_zone.h"
|
||||
|
|
@ -18,6 +17,7 @@
|
|||
#include <QPoint>
|
||||
#include <QPointF>
|
||||
#include <QtGlobal>
|
||||
#include <libcockatrice/game/zones/table_zone_logic.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class CardDragItem;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
#include "view_zone.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_info.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../game/zones/card_zone_logic.h"
|
||||
#include "../../game/zones/view_zone_logic.h"
|
||||
#include "../board/card_drag_item.h"
|
||||
#include "../board/card_item.h"
|
||||
#include "../card_dimensions.h"
|
||||
|
|
@ -26,6 +21,11 @@
|
|||
#include <QtMath>
|
||||
#include <functional>
|
||||
#include <libcockatrice/card/card_localization.h>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/zones/card_zone_logic.h>
|
||||
#include <libcockatrice/game/zones/view_zone_logic.h>
|
||||
#include <libcockatrice/protocol/pb/response_dump_zone.pb.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_card.pb.h>
|
||||
#include <libcockatrice/protocol/pending_command.h>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#ifndef ZONEVIEWERZONE_H
|
||||
#define ZONEVIEWERZONE_H
|
||||
|
||||
#include "../../game/board/card_list.h"
|
||||
#include "select_zone.h"
|
||||
|
||||
#include <QGraphicsLayoutItem>
|
||||
|
|
@ -17,6 +16,7 @@
|
|||
#include <QSizeF>
|
||||
#include <QString>
|
||||
#include <libcockatrice/filters/filter_string.h>
|
||||
#include <libcockatrice/game/board/card_list.h>
|
||||
#include <qnamespace.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,7 @@
|
|||
#include "view_zone_widget.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../client/translation.h"
|
||||
#include "../../filters/syntax_help.h"
|
||||
#include "../../game/board/card_list.h"
|
||||
#include "../../game/player/player_actions.h"
|
||||
#include "../../game/player/player_logic.h"
|
||||
#include "../../game/zones/card_zone_logic.h"
|
||||
#include "../../game/zones/view_zone_logic.h"
|
||||
#include "../../interface/pixel_map_generator.h"
|
||||
#include "../card_dimensions.h"
|
||||
#include "../z_values.h"
|
||||
|
|
@ -45,6 +39,12 @@
|
|||
#include <QVariant>
|
||||
#include <QWidget>
|
||||
#include <QtGlobal>
|
||||
#include <libcockatrice/game/board/card_list.h>
|
||||
#include <libcockatrice/game/player/player_actions.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/translation.h>
|
||||
#include <libcockatrice/game/zones/card_zone_logic.h>
|
||||
#include <libcockatrice/game/zones/view_zone_logic.h>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <qnamespace.h>
|
||||
|
|
@ -177,9 +177,10 @@ ZoneViewWidget::ZoneViewWidget(PlayerLogic *_player,
|
|||
|
||||
vbox->addItem(zoneHBox);
|
||||
|
||||
zone = new ZoneViewZone(new ZoneViewZoneLogic(player, _origZone, numberCards, _revealZone, _writeableRevealZone,
|
||||
_isReversed, zoneContainer),
|
||||
zoneContainer);
|
||||
zone =
|
||||
new ZoneViewZone(new ZoneViewZoneLogic(player, _origZone, numberCards, _revealZone, _writeableRevealZone,
|
||||
_isReversed, &SettingsCache::instance().userInterface(), zoneContainer),
|
||||
zoneContainer);
|
||||
connect(zone, &ZoneViewZone::wheelEventReceived, scrollBarProxy, &ScrollableGraphicsProxyWidget::recieveWheelEvent);
|
||||
|
||||
retranslateUi();
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#include "replay_manager.h"
|
||||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../../game/player/event_processing_options.h"
|
||||
#include "libcockatrice/protocol/pb/game_event.pb.h"
|
||||
#include "libcockatrice/protocol/pb/game_event_container.pb.h"
|
||||
#include "libcockatrice/protocol/pb/game_replay.pb.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <algorithm>
|
||||
#include <libcockatrice/game/player/event_processing_options.h>
|
||||
#include <libcockatrice/protocol/get_pb_extension.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <qnumeric.h>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
#ifndef COCKATRICE_REPLAY_MANAGER_H
|
||||
#define COCKATRICE_REPLAY_MANAGER_H
|
||||
|
||||
#include "../../../game/player/event_processing_options.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <QtGlobal>
|
||||
#include <libcockatrice/game/player/event_processing_options.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class GameReplay;
|
||||
|
|
|
|||
|
|
@ -8,9 +8,8 @@
|
|||
#ifndef REPLAY_WIDGET_H
|
||||
#define REPLAY_WIDGET_H
|
||||
|
||||
#include "../../../game/player/event_processing_options.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <libcockatrice/game/player/event_processing_options.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class ReplayManager;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
#include "user_context_menu.h"
|
||||
|
||||
#include "../../../../game/abstract_game.h"
|
||||
#include "../../../../game/game_event_handler.h"
|
||||
#include "../../../../game/game_meta_info.h"
|
||||
#include "../../dialogs/dlg_report_user.h"
|
||||
#include "../../interface/widgets/tabs/tab_supervisor.h"
|
||||
#include "../chat_view/chat_view.h"
|
||||
|
|
@ -37,6 +34,9 @@
|
|||
#include <QTableWidget>
|
||||
#include <QTableWidgetItem>
|
||||
#include <QWidget>
|
||||
#include <libcockatrice/game/abstract_game.h>
|
||||
#include <libcockatrice/game/game_event_handler.h>
|
||||
#include <libcockatrice/game/game_meta_info.h>
|
||||
#include <libcockatrice/network/client/abstract/abstract_client.h>
|
||||
#include <libcockatrice/protocol/pb/command_kick_from_game.pb.h>
|
||||
#include <libcockatrice/protocol/pb/commands.pb.h>
|
||||
|
|
|
|||
|
|
@ -2,16 +2,10 @@
|
|||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../../client/settings/shortcuts_settings.h"
|
||||
#include "../../../game/abstract_game.h"
|
||||
#include "../../../game/game_event_handler.h"
|
||||
#include "../../../game/game_meta_info.h"
|
||||
#include "../../../game/game_state.h"
|
||||
#include "../../../game/player/player_info.h"
|
||||
#include "../../../game/player/player_manager.h"
|
||||
#include "../../../database/interface/settings_card_preference_provider.h"
|
||||
#include "../../../game_graphics/board/abstract_card_item.h"
|
||||
#include "../game/game.h"
|
||||
#include "../game/player/player_logic.h"
|
||||
#include "../game/replay.h"
|
||||
#include "../game_graphics/board/arrow_item.h"
|
||||
#include "../game_graphics/board/card_item.h"
|
||||
#include "../game_graphics/deckview/deck_view_container.h"
|
||||
#include "../game_graphics/deckview/tabbed_deck_view_container.h"
|
||||
#include "../game_graphics/game_scene.h"
|
||||
|
|
@ -71,6 +65,15 @@
|
|||
#include <QWidget>
|
||||
#include <QtGlobal>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/game/abstract_game.h>
|
||||
#include <libcockatrice/game/game.h>
|
||||
#include <libcockatrice/game/game_event_handler.h>
|
||||
#include <libcockatrice/game/game_meta_info.h>
|
||||
#include <libcockatrice/game/game_state.h>
|
||||
#include <libcockatrice/game/player/player_info.h>
|
||||
#include <libcockatrice/game/player/player_logic.h>
|
||||
#include <libcockatrice/game/player/player_manager.h>
|
||||
#include <libcockatrice/game/replay.h>
|
||||
#include <libcockatrice/network/client/abstract/abstract_client.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_player.pb.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
|
||||
|
|
@ -97,7 +100,8 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay)
|
|||
: Tab(_tabSupervisor), sayLabel(nullptr), sayEdit(nullptr)
|
||||
{
|
||||
// THIS CTOR IS USED ON REPLAY
|
||||
game = new Replay(this, _replay, tabSupervisor->getIsLocalGame());
|
||||
game = new Replay(this, _replay, tabSupervisor->getIsLocalGame(), &SettingsCache::instance().userInterface(),
|
||||
new SettingsCardPreferenceProvider(this));
|
||||
|
||||
createCardInfoDock(true);
|
||||
createPlayerListDock(true);
|
||||
|
|
@ -141,7 +145,8 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor,
|
|||
: Tab(_tabSupervisor), userListProxy(_tabSupervisor->getUserListManager())
|
||||
{
|
||||
// THIS CTOR IS USED ON GAMES
|
||||
game = new Game(this, tabSupervisor->getIsLocalGame(), _clients, event, _roomGameTypes);
|
||||
game = new Game(this, tabSupervisor->getIsLocalGame(), _clients, event, _roomGameTypes,
|
||||
&SettingsCache::instance().userInterface(), new SettingsCardPreferenceProvider(this));
|
||||
|
||||
createCardInfoDock();
|
||||
createPlayerListDock();
|
||||
|
|
|
|||
|
|
@ -2,9 +2,6 @@
|
|||
|
||||
#include "../../../client/settings/cache_settings.h"
|
||||
#include "../../../client/settings/shortcuts_settings.h"
|
||||
#include "../../../game/abstract_game.h"
|
||||
#include "../../../game/game_event_handler.h"
|
||||
#include "../../../game/game_meta_info.h"
|
||||
#include "../../intents/contexts/context_connect_to_server.h"
|
||||
#include "../../intents/contexts/context_join_game.h"
|
||||
#include "../../intents/contexts/context_join_room.h"
|
||||
|
|
@ -63,6 +60,9 @@
|
|||
#include <QSystemTrayIcon>
|
||||
#include <QTabBar>
|
||||
#include <libcockatrice/deck_list/loaded_deck.h>
|
||||
#include <libcockatrice/game/abstract_game.h>
|
||||
#include <libcockatrice/game/game_event_handler.h>
|
||||
#include <libcockatrice/game/game_meta_info.h>
|
||||
#include <libcockatrice/network/client/abstract/abstract_client.h>
|
||||
#include <libcockatrice/network/client/remote/remote_client.h>
|
||||
#include <libcockatrice/protocol/pb/event_game_joined.pb.h>
|
||||
|
|
|
|||
81
libcockatrice_game/CMakeLists.txt
Normal file
81
libcockatrice_game/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(HEADERS
|
||||
libcockatrice/game/abstract_game.h
|
||||
libcockatrice/game/board/arrow_data.h
|
||||
libcockatrice/game/board/card_list.h
|
||||
libcockatrice/game/board/card_state.h
|
||||
libcockatrice/game/board/counter_state.h
|
||||
libcockatrice/game/game.h
|
||||
libcockatrice/game/game_event_handler.h
|
||||
libcockatrice/game/game_meta_info.h
|
||||
libcockatrice/game/game_state.h
|
||||
libcockatrice/game/phase.h
|
||||
libcockatrice/game/player/card_menu_action_type.h
|
||||
libcockatrice/game/player/card_move_request.h
|
||||
libcockatrice/game/player/event_processing_options.h
|
||||
libcockatrice/game/player/move_top_cards_until_options.h
|
||||
libcockatrice/game/player/player_actions.h
|
||||
libcockatrice/game/player/player_event_handler.h
|
||||
libcockatrice/game/player/player_info.h
|
||||
libcockatrice/game/player/player_logic.h
|
||||
libcockatrice/game/player/player_manager.h
|
||||
libcockatrice/game/player/token_info.h
|
||||
libcockatrice/game/replay.h
|
||||
libcockatrice/game/translation.h
|
||||
libcockatrice/game/zones/card_zone_algorithms.h
|
||||
libcockatrice/game/zones/card_zone_logic.h
|
||||
libcockatrice/game/zones/hand_zone_logic.h
|
||||
libcockatrice/game/zones/pile_zone_logic.h
|
||||
libcockatrice/game/zones/stack_zone_logic.h
|
||||
libcockatrice/game/zones/table_zone_logic.h
|
||||
libcockatrice/game/zones/view_zone_logic.h
|
||||
)
|
||||
|
||||
qt6_wrap_cpp(MOC_SOURCES ${HEADERS})
|
||||
|
||||
add_library(
|
||||
libcockatrice_game STATIC
|
||||
${MOC_SOURCES}
|
||||
libcockatrice/game/abstract_game.cpp
|
||||
libcockatrice/game/board/arrow_data.cpp
|
||||
libcockatrice/game/board/card_list.cpp
|
||||
libcockatrice/game/board/card_state.cpp
|
||||
libcockatrice/game/board/counter_state.cpp
|
||||
libcockatrice/game/game.cpp
|
||||
libcockatrice/game/game_event_handler.cpp
|
||||
libcockatrice/game/game_meta_info.cpp
|
||||
libcockatrice/game/game_state.cpp
|
||||
libcockatrice/game/phase.cpp
|
||||
libcockatrice/game/player/player_actions.cpp
|
||||
libcockatrice/game/player/player_event_handler.cpp
|
||||
libcockatrice/game/player/player_info.cpp
|
||||
libcockatrice/game/player/player_logic.cpp
|
||||
libcockatrice/game/player/player_manager.cpp
|
||||
libcockatrice/game/replay.cpp
|
||||
libcockatrice/game/zones/card_zone_logic.cpp
|
||||
libcockatrice/game/zones/hand_zone_logic.cpp
|
||||
libcockatrice/game/zones/pile_zone_logic.cpp
|
||||
libcockatrice/game/zones/stack_zone_logic.cpp
|
||||
libcockatrice/game/zones/table_zone_logic.cpp
|
||||
libcockatrice/game/zones/view_zone_logic.cpp
|
||||
)
|
||||
|
||||
target_include_directories(libcockatrice_game PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
target_link_libraries(
|
||||
libcockatrice_game
|
||||
PUBLIC libcockatrice_card
|
||||
libcockatrice_deck_list
|
||||
libcockatrice_filters
|
||||
libcockatrice_interfaces
|
||||
libcockatrice_network
|
||||
libcockatrice_protocol
|
||||
libcockatrice_settings
|
||||
libcockatrice_utility
|
||||
${QT_CORE_MODULE}
|
||||
${COCKATRICE_QT_VERSION_NAME}::Concurrent
|
||||
${COCKATRICE_QT_VERSION_NAME}::Gui
|
||||
)
|
||||
|
|
@ -16,13 +16,16 @@ Game::Game(QObject *_parent,
|
|||
bool isLocalGame,
|
||||
QList<AbstractClient *> &_clients,
|
||||
const Event_GameJoined &event,
|
||||
const QMap<int, QString> &_roomGameTypes)
|
||||
const QMap<int, QString> &_roomGameTypes,
|
||||
IInterfaceSettingsProvider *interfaceSettings,
|
||||
ICardPreferenceProvider *cardPreferences)
|
||||
: AbstractGame(_parent)
|
||||
{
|
||||
gameMetaInfo->setFromProto(event.game_info());
|
||||
gameMetaInfo->setRoomGameTypes(_roomGameTypes);
|
||||
gameState = new GameState(this, 0, event.host_id(), isLocalGame, _clients, false, event.resuming(), -1, false);
|
||||
connect(gameMetaInfo, &GameMetaInfo::startedChanged, gameState, &GameState::onStartedChanged);
|
||||
playerManager = new PlayerManager(this, event.player_id(), event.judge(), event.spectator());
|
||||
playerManager = new PlayerManager(this, event.player_id(), event.judge(), event.spectator(), interfaceSettings,
|
||||
cardPreferences);
|
||||
gameMetaInfo->setStarted(false);
|
||||
}
|
||||
|
|
@ -18,6 +18,9 @@ class QString;
|
|||
template <class Key, class T> class QMap;
|
||||
template <typename T> class QList;
|
||||
|
||||
class ICardPreferenceProvider;
|
||||
class IInterfaceSettingsProvider;
|
||||
|
||||
class Game : public AbstractGame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -27,7 +30,9 @@ public:
|
|||
bool isLocalGame,
|
||||
QList<AbstractClient *> &_clients,
|
||||
const Event_GameJoined &event,
|
||||
const QMap<int, QString> &_roomGameTypes);
|
||||
const QMap<int, QString> &_roomGameTypes,
|
||||
IInterfaceSettingsProvider *interfaceSettings = nullptr,
|
||||
ICardPreferenceProvider *cardPreferences = nullptr);
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_GAME_H
|
||||
|
|
@ -37,7 +37,6 @@
|
|||
class AbstractClient;
|
||||
class AbstractGame;
|
||||
class GameEventContainer;
|
||||
class GameEventContext;
|
||||
class PendingCommand;
|
||||
class PlayerLogic;
|
||||
class Response;
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
#include "player_actions.h"
|
||||
|
||||
#include "../../client/settings/cache_settings.h"
|
||||
#include "../../game_graphics/dialogs/dlg_create_token.h"
|
||||
#include "../abstract_game.h"
|
||||
#include "../board/arrow_data.h"
|
||||
#include "../board/card_state.h"
|
||||
|
|
@ -47,6 +45,8 @@
|
|||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/card/relation/card_relation.h>
|
||||
#include <libcockatrice/deck_list/loaded_deck.h>
|
||||
#include <libcockatrice/interfaces/interface_card_preference_provider.h>
|
||||
#include <libcockatrice/interfaces/interface_interface_settings_provider.h>
|
||||
#include <libcockatrice/protocol/pb/command_attach_card.pb.h>
|
||||
#include <libcockatrice/protocol/pb/command_change_zone_properties.pb.h>
|
||||
#include <libcockatrice/protocol/pb/command_create_arrow.pb.h>
|
||||
|
|
@ -65,8 +65,7 @@
|
|||
#include <libcockatrice/protocol/pb/command_set_counter.pb.h>
|
||||
#include <libcockatrice/protocol/pb/command_shuffle.pb.h>
|
||||
#include <libcockatrice/protocol/pb/command_undo_draw.pb.h>
|
||||
#include <libcockatrice/settings/card_override_settings.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <libcockatrice/protocol/pb/context_move_card.pb.h>
|
||||
#include <libcockatrice/utility/clamped_arithmetic.h>
|
||||
#include <libcockatrice/utility/color.h>
|
||||
#include <libcockatrice/utility/counter_limits.h>
|
||||
|
|
@ -80,8 +79,11 @@
|
|||
// milliseconds in between triggers of the move top cards until action
|
||||
static constexpr int MOVE_TOP_CARD_UNTIL_INTERVAL = 100;
|
||||
|
||||
PlayerActions::PlayerActions(PlayerLogic *_player)
|
||||
: QObject(_player), player(_player), lastTokenTableRow(0), movingCardsUntil(false)
|
||||
PlayerActions::PlayerActions(PlayerLogic *_player,
|
||||
IInterfaceSettingsProvider *_interfaceSettings,
|
||||
ICardPreferenceProvider *_cardPreferences)
|
||||
: QObject(_player), player(_player), interfaceSettings(_interfaceSettings), cardPreferences(_cardPreferences),
|
||||
lastTokenTableRow(0), movingCardsUntil(false)
|
||||
{
|
||||
connect(this, &PlayerActions::requestZoneViewToggle, player, &PlayerLogic::onRequestZoneViewToggle);
|
||||
|
||||
|
|
@ -91,6 +93,26 @@ PlayerActions::PlayerActions(PlayerLogic *_player)
|
|||
connect(moveTopCardTimer, &QTimer::timeout, [this]() { actMoveTopCardToPlay(); });
|
||||
}
|
||||
|
||||
bool PlayerActions::getPlayToStack() const
|
||||
{
|
||||
return interfaceSettings ? interfaceSettings->getPlayToStack() : true;
|
||||
}
|
||||
|
||||
int PlayerActions::getStartingHandSize() const
|
||||
{
|
||||
return interfaceSettings ? interfaceSettings->getStartingHandSize() : 7;
|
||||
}
|
||||
|
||||
bool PlayerActions::getAnnotateTokens() const
|
||||
{
|
||||
return interfaceSettings ? interfaceSettings->getAnnotateTokens() : false;
|
||||
}
|
||||
|
||||
QString PlayerActions::getCardPreferenceOverride(const QString &cardName) const
|
||||
{
|
||||
return cardPreferences ? cardPreferences->getCardPreferenceOverride(cardName) : QString();
|
||||
}
|
||||
|
||||
void PlayerActions::playCard(CardState *card, bool faceDown)
|
||||
{
|
||||
if (card == nullptr) {
|
||||
|
|
@ -112,7 +134,7 @@ void PlayerActions::playCard(CardState *card, bool faceDown)
|
|||
const CardInfo &info = exactCard.getInfo();
|
||||
|
||||
int tableRow = info.getUiAttributes().tableRow;
|
||||
bool playToStack = SettingsCache::instance().userInterface().getPlayToStack();
|
||||
bool playToStack = getPlayToStack();
|
||||
QString currentZone = card->getZone()->getName();
|
||||
if (!faceDown && currentZone == ZoneNames::STACK && tableRow == 3) {
|
||||
cmd.set_target_zone(ZoneNames::GRAVE);
|
||||
|
|
@ -214,7 +236,7 @@ void PlayerActions::createArrow(CardState *startCard, const ArrowData &arrow, in
|
|||
// if the card is in hand then it has just been moved to the stack or table as part of drawing the arrow
|
||||
if (arrow.startZone == ZoneNames::HAND) {
|
||||
CardInfoPtr ci = startCard->getCard().getCardPtr();
|
||||
bool playToStack = SettingsCache::instance().userInterface().getPlayToStack();
|
||||
bool playToStack = getPlayToStack();
|
||||
if (ci && ((!playToStack && ci->getUiAttributes().tableRow == 3) ||
|
||||
(playToStack && ci->getUiAttributes().tableRow != 0 &&
|
||||
startCard->getZone()->getName() != ZoneNames::STACK))) {
|
||||
|
|
@ -409,7 +431,7 @@ void PlayerActions::actDrawCard()
|
|||
|
||||
void PlayerActions::actRequestMulliganDialog()
|
||||
{
|
||||
int startSize = SettingsCache::instance().userInterface().getStartingHandSize();
|
||||
int startSize = getStartingHandSize();
|
||||
int handSize = player->getHandZone()->getCards().size();
|
||||
int deckSize = player->getDeckZone()->getCards().size() + handSize;
|
||||
|
||||
|
|
@ -425,7 +447,7 @@ void PlayerActions::actMulligan(int number)
|
|||
}
|
||||
|
||||
doMulligan(number);
|
||||
SettingsCache::instance().userInterface().setStartingHandSize(number);
|
||||
emit startingHandSizeChosen(number);
|
||||
}
|
||||
|
||||
void PlayerActions::actMulliganSameSize()
|
||||
|
|
@ -974,13 +996,12 @@ void PlayerActions::setLastTokenInfo(CardInfoPtr cardInfo)
|
|||
return;
|
||||
}
|
||||
|
||||
lastTokenInfo = {
|
||||
.name = cardInfo->getName(),
|
||||
.color = cardInfo->getColors().isEmpty() ? QString() : cardInfo->getColors().left(1).toLower(),
|
||||
.pt = cardInfo->getPowTough(),
|
||||
.annotation = SettingsCache::instance().userInterface().getAnnotateTokens() ? cardInfo->getText() : "",
|
||||
.destroy = true,
|
||||
.providerId = SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardInfo->getName())};
|
||||
lastTokenInfo = {.name = cardInfo->getName(),
|
||||
.color = cardInfo->getColors().isEmpty() ? QString() : cardInfo->getColors().left(1).toLower(),
|
||||
.pt = cardInfo->getPowTough(),
|
||||
.annotation = getAnnotateTokens() ? cardInfo->getText() : "",
|
||||
.destroy = true,
|
||||
.providerId = getCardPreferenceOverride(cardInfo->getName())};
|
||||
|
||||
lastTokenTableRow = TableZoneLogic::tableRowToGridY(cardInfo->getUiAttributes().tableRow);
|
||||
|
||||
|
|
@ -1208,7 +1229,7 @@ void PlayerActions::createCard(const CardState *sourceCard,
|
|||
}
|
||||
|
||||
cmd.set_pt(cardInfo->getPowTough().toStdString());
|
||||
if (SettingsCache::instance().userInterface().getAnnotateTokens()) {
|
||||
if (getAnnotateTokens()) {
|
||||
cmd.set_annotation(cardInfo->getText().toStdString());
|
||||
} else {
|
||||
cmd.set_annotation("");
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
#define COCKATRICE_PLAYER_ACTIONS_H
|
||||
|
||||
#include "../board/card_list.h"
|
||||
#include "../board/card_state.h"
|
||||
#include "card_menu_action_type.h"
|
||||
#include "card_move_request.h"
|
||||
#include "libcockatrice/card/card_info.h"
|
||||
|
|
@ -22,7 +23,6 @@
|
|||
#include <libcockatrice/filters/filter_string.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class CardItem;
|
||||
class CardRelation;
|
||||
class QAction;
|
||||
class QTimer;
|
||||
|
|
@ -39,8 +39,12 @@ class Message;
|
|||
class CardState;
|
||||
class CardZoneLogic;
|
||||
class Command_MoveCard;
|
||||
class GameEventContext;
|
||||
class ICardPreferenceProvider;
|
||||
class IInterfaceSettingsProvider;
|
||||
class PendingCommand;
|
||||
class PlayerLogic;
|
||||
class QAction;
|
||||
struct ArrowData;
|
||||
class PlayerActions : public QObject
|
||||
{
|
||||
|
|
@ -52,7 +56,9 @@ public:
|
|||
RANDOM_CARD_FROM_ZONE = -2
|
||||
};
|
||||
|
||||
explicit PlayerActions(PlayerLogic *player);
|
||||
explicit PlayerActions(PlayerLogic *player,
|
||||
IInterfaceSettingsProvider *interfaceSettings = nullptr,
|
||||
ICardPreferenceProvider *cardPreferences = nullptr);
|
||||
|
||||
void sendGameCommand(PendingCommand *pend);
|
||||
void sendGameCommand(const google::protobuf::Message &command);
|
||||
|
|
@ -143,6 +149,12 @@ signals:
|
|||
void requestSortHand(const QList<CardList::SortOption> &options);
|
||||
void requestEnableAndSetCreateAnotherTokenAction(const QString &lastTokenName);
|
||||
void requestSetLastToken(CardInfoPtr lastToken);
|
||||
/**
|
||||
* @brief The player chose a mulligan size to remember as the starting hand size.
|
||||
*
|
||||
* Game logic must not write client settings itself, so persistence is left to the application.
|
||||
*/
|
||||
void startingHandSizeChosen(int number);
|
||||
|
||||
public slots:
|
||||
void setLastToken(CardInfoPtr cardInfo);
|
||||
|
|
@ -275,6 +287,10 @@ public slots:
|
|||
|
||||
private:
|
||||
PlayerLogic *player;
|
||||
// Borrowed settings providers (owned by the application). Null outside the client, in which case the compiled-in
|
||||
// defaults below apply.
|
||||
IInterfaceSettingsProvider *interfaceSettings;
|
||||
ICardPreferenceProvider *cardPreferences;
|
||||
|
||||
int defaultNumberTopCards = 1;
|
||||
int defaultNumberTopCardsToPlaceBelow = 1;
|
||||
|
|
@ -292,6 +308,11 @@ private:
|
|||
|
||||
bool lastRelatedCreationSucceeded = false;
|
||||
|
||||
[[nodiscard]] bool getPlayToStack() const;
|
||||
[[nodiscard]] int getStartingHandSize() const;
|
||||
[[nodiscard]] bool getAnnotateTokens() const;
|
||||
[[nodiscard]] QString getCardPreferenceOverride(const QString &cardName) const;
|
||||
|
||||
void createCard(const CardState *sourceCard,
|
||||
const QString &dbCardName,
|
||||
CardRelationType attach = CardRelationType::DoesNotAttach,
|
||||
|
|
@ -34,10 +34,17 @@
|
|||
#include <qalgorithms.h>
|
||||
#include <string>
|
||||
|
||||
PlayerLogic::PlayerLogic(const ServerInfo_User &info, int _id, bool _local, bool _judge, AbstractGame *_parent)
|
||||
PlayerLogic::PlayerLogic(const ServerInfo_User &info,
|
||||
int _id,
|
||||
bool _local,
|
||||
bool _judge,
|
||||
AbstractGame *_parent,
|
||||
IInterfaceSettingsProvider *interfaceSettings,
|
||||
ICardPreferenceProvider *cardPreferences)
|
||||
: QObject(_parent), game(_parent), playerInfo(new PlayerInfo(info, _id, _local, _judge)),
|
||||
playerEventHandler(new PlayerEventHandler(this)), playerActions(new PlayerActions(this)), active(false),
|
||||
conceded(false), zoneId(0), dialogSemaphore(false)
|
||||
playerEventHandler(new PlayerEventHandler(this)),
|
||||
playerActions(new PlayerActions(this, interfaceSettings, cardPreferences)), active(false), conceded(false),
|
||||
zoneId(0), dialogSemaphore(false)
|
||||
{
|
||||
initializeZones();
|
||||
}
|
||||
|
|
@ -37,7 +37,6 @@
|
|||
// signatures, which the moc-generated code needs to be complete.
|
||||
#include <libcockatrice/protocol/pb/serverinfo_card.pb.h>
|
||||
|
||||
class CardItem;
|
||||
class CounterState;
|
||||
class QWidget;
|
||||
class ServerInfo_PlayerProperties;
|
||||
|
|
@ -48,6 +47,8 @@ template <class T> class QSharedPointer;
|
|||
inline Q_LOGGING_CATEGORY(PlayerLog, "player");
|
||||
class AbstractCardItem;
|
||||
class AbstractGame;
|
||||
class ICardPreferenceProvider;
|
||||
class IInterfaceSettingsProvider;
|
||||
class PlayerInfo;
|
||||
class PlayerEventHandler;
|
||||
class PlayerActions;
|
||||
|
|
@ -93,7 +94,13 @@ public slots:
|
|||
void onRequestZoneViewToggle(const QString &zoneName, int numberCards, bool isReversed);
|
||||
|
||||
public:
|
||||
PlayerLogic(const ServerInfo_User &info, int _id, bool _local, bool _judge, AbstractGame *_parent);
|
||||
PlayerLogic(const ServerInfo_User &info,
|
||||
int _id,
|
||||
bool _local,
|
||||
bool _judge,
|
||||
AbstractGame *_parent,
|
||||
IInterfaceSettingsProvider *interfaceSettings = nullptr,
|
||||
ICardPreferenceProvider *cardPreferences = nullptr);
|
||||
~PlayerLogic() override;
|
||||
|
||||
void initializeZones();
|
||||
|
|
@ -12,9 +12,12 @@
|
|||
PlayerManager::PlayerManager(AbstractGame *_game,
|
||||
int _localPlayerId,
|
||||
bool _localPlayerIsJudge,
|
||||
bool localPlayerIsSpectator)
|
||||
bool localPlayerIsSpectator,
|
||||
IInterfaceSettingsProvider *_interfaceSettings,
|
||||
ICardPreferenceProvider *_cardPreferences)
|
||||
: QObject(_game), game(_game), players(QMap<int, PlayerLogic *>()), localPlayerId(_localPlayerId),
|
||||
localPlayerIsJudge(_localPlayerIsJudge), localPlayerIsSpectator(localPlayerIsSpectator)
|
||||
localPlayerIsJudge(_localPlayerIsJudge), localPlayerIsSpectator(localPlayerIsSpectator),
|
||||
interfaceSettings(_interfaceSettings), cardPreferences(_cardPreferences)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +55,7 @@ bool PlayerManager::isLocalPlayer(int playerId)
|
|||
PlayerLogic *PlayerManager::addPlayer(int playerId, const ServerInfo_User &info)
|
||||
{
|
||||
auto *newPlayer = new PlayerLogic(info, playerId, isLocalPlayer(playerId) || game->getGameState()->getIsLocalGame(),
|
||||
isJudge(), getGame());
|
||||
isJudge(), getGame(), interfaceSettings, cardPreferences);
|
||||
connect(newPlayer, &PlayerLogic::concededChanged, this, &PlayerManager::onPlayerConceded);
|
||||
players.insert(playerId, newPlayer);
|
||||
emit playerAdded(newPlayer);
|
||||
|
|
@ -16,6 +16,8 @@
|
|||
#include <qtmetamacros.h>
|
||||
|
||||
class AbstractGame;
|
||||
class ICardPreferenceProvider;
|
||||
class IInterfaceSettingsProvider;
|
||||
class PlayerLogic;
|
||||
|
||||
class PlayerManager : public QObject
|
||||
|
|
@ -23,7 +25,12 @@ class PlayerManager : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PlayerManager(AbstractGame *_game, int _localPlayerId, bool _localPlayerIsJudge, bool localPlayerIsSpectator);
|
||||
PlayerManager(AbstractGame *_game,
|
||||
int _localPlayerId,
|
||||
bool _localPlayerIsJudge,
|
||||
bool localPlayerIsSpectator,
|
||||
IInterfaceSettingsProvider *interfaceSettings = nullptr,
|
||||
ICardPreferenceProvider *cardPreferences = nullptr);
|
||||
|
||||
AbstractGame *game;
|
||||
QMap<int, PlayerLogic *> players;
|
||||
|
|
@ -31,6 +38,9 @@ public:
|
|||
bool localPlayerIsJudge;
|
||||
bool localPlayerIsSpectator;
|
||||
QMap<int, ServerInfo_User> spectators;
|
||||
// Borrowed settings providers forwarded to each PlayerLogic (owned by the application).
|
||||
IInterfaceSettingsProvider *interfaceSettings;
|
||||
ICardPreferenceProvider *cardPreferences;
|
||||
|
||||
[[nodiscard]] bool isSpectator() const
|
||||
{
|
||||
|
|
@ -9,10 +9,15 @@
|
|||
class GameReplay;
|
||||
class QObject;
|
||||
|
||||
Replay::Replay(QObject *_parent, const GameReplay *_replay, bool isLocalGame) : AbstractGame(_parent)
|
||||
Replay::Replay(QObject *_parent,
|
||||
const GameReplay *_replay,
|
||||
bool isLocalGame,
|
||||
IInterfaceSettingsProvider *interfaceSettings,
|
||||
ICardPreferenceProvider *cardPreferences)
|
||||
: AbstractGame(_parent)
|
||||
{
|
||||
gameState = new GameState(this, 0, -1, isLocalGame, {}, false, false, -1, false);
|
||||
connect(gameMetaInfo, &GameMetaInfo::startedChanged, gameState, &GameState::onStartedChanged);
|
||||
playerManager = new PlayerManager(this, -1, false, true);
|
||||
playerManager = new PlayerManager(this, -1, false, true, interfaceSettings, cardPreferences);
|
||||
loadReplay(_replay);
|
||||
}
|
||||
32
libcockatrice_game/libcockatrice/game/replay.h
Normal file
32
libcockatrice_game/libcockatrice/game/replay.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* @file replay.h
|
||||
* @ingroup GameLogic
|
||||
* @ingroup Replay
|
||||
*/
|
||||
//! \todo Document this file.
|
||||
|
||||
#ifndef COCKATRICE_REPLAY_H
|
||||
#define COCKATRICE_REPLAY_H
|
||||
|
||||
#include "abstract_game.h"
|
||||
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class GameReplay;
|
||||
class QObject;
|
||||
class ICardPreferenceProvider;
|
||||
class IInterfaceSettingsProvider;
|
||||
|
||||
class Replay : public AbstractGame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Replay(QObject *_parent,
|
||||
const GameReplay *_replay,
|
||||
bool isLocalGame,
|
||||
IInterfaceSettingsProvider *interfaceSettings = nullptr,
|
||||
ICardPreferenceProvider *cardPreferences = nullptr);
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_REPLAY_H
|
||||
|
|
@ -1,12 +1,11 @@
|
|||
#include "card_zone_logic.h"
|
||||
|
||||
#include "../../client/translation.h"
|
||||
#include "../../game_graphics/zones/card_zone.h"
|
||||
#include "../board/card_list.h"
|
||||
#include "../board/card_state.h"
|
||||
#include "../player/player_actions.h"
|
||||
#include "../player/player_info.h"
|
||||
#include "../player/player_logic.h"
|
||||
#include "../translation.h"
|
||||
#include "libcockatrice/card/database/card_database.h"
|
||||
#include "view_zone_logic.h"
|
||||
|
||||
|
|
@ -7,8 +7,8 @@
|
|||
#ifndef COCKATRICE_CARD_ZONE_LOGIC_H
|
||||
#define COCKATRICE_CARD_ZONE_LOGIC_H
|
||||
|
||||
#include "../../client/translation.h"
|
||||
#include "../board/card_list.h"
|
||||
#include "../translation.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QLoggingCategory>
|
||||
|
|
@ -21,9 +21,6 @@ inline Q_LOGGING_CATEGORY(CardZoneLogicLog, "card_zone_logic");
|
|||
|
||||
class PlayerLogic;
|
||||
class ZoneViewZoneLogic;
|
||||
class QMenu;
|
||||
class QAction;
|
||||
class QPainter;
|
||||
class CardDragItem;
|
||||
|
||||
class CardZoneLogic : public QObject
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue