mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 17:43:23 -08:00
* [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>
61 lines
1.7 KiB
C++
61 lines
1.7 KiB
C++
/**
|
|
* @file table_zone_logic.h
|
|
* @ingroup GameLogicZones
|
|
*/
|
|
//! \todo Document this file.
|
|
|
|
#ifndef COCKATRICE_TABLE_ZONE_LOGIC_H
|
|
#define COCKATRICE_TABLE_ZONE_LOGIC_H
|
|
#include "card_zone_logic.h"
|
|
|
|
#include <QString>
|
|
#include <qtmetamacros.h>
|
|
|
|
class PlayerLogic;
|
|
class QObject;
|
|
|
|
class TableZoneLogic : public CardZoneLogic
|
|
{
|
|
Q_OBJECT
|
|
signals:
|
|
void contentSizeChanged();
|
|
void toggleTapped();
|
|
|
|
public:
|
|
TableZoneLogic(PlayerLogic *_player,
|
|
const QString &_name,
|
|
bool _hasCardAttr,
|
|
bool _isShufflable,
|
|
bool _contentsKnown,
|
|
QObject *parent = nullptr);
|
|
|
|
/** @brief Number of rows in the table zone grid (0=creatures, 1=noncreatures, 2=lands). */
|
|
static const int ROW_COUNT = 3;
|
|
|
|
/**
|
|
* Clamps a grid row index into [0, ROW_COUNT - 1].
|
|
*/
|
|
static int clampValidTableRow(const int row);
|
|
|
|
/**
|
|
* Converts a card's logical table row (0=creatures, 1=noncreatures, 2=lands)
|
|
* to the corresponding grid Y coordinate. Cards with tableRow > 2 (e.g.,
|
|
* instants/sorceries) default to the noncreatures row.
|
|
*/
|
|
static int tableRowToGridY(int tableRow);
|
|
|
|
protected:
|
|
void addCardImpl(CardState *card, int x, int y) override;
|
|
|
|
/**
|
|
* @brief Removes a card from view.
|
|
*
|
|
* @param position card position
|
|
* @param cardId id of card to take
|
|
* @param toNewZone Whether the destination of the card is not the same as the starting zone. Defaults to true
|
|
* @return CardState that has been removed
|
|
*/
|
|
CardState *takeCard(int position, int cardId, bool toNewZone = true) override;
|
|
};
|
|
|
|
#endif // COCKATRICE_TABLE_ZONE_LOGIC_H
|