mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-05 04:53:54 -07:00
[Game/Zones] Simple move refactor to differentiate between logic and graphics for zones (#6903)
* [Game/Zones] Simple move refactor to differentiate between logic and graphics for zones Took 21 minutes * Clean up game/zones/logic folder. Took 6 minutes * Adjust tests. Took 3 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
bb1a5b33a1
commit
cba9ce2b2b
47 changed files with 107 additions and 107 deletions
71
cockatrice/src/game/zones/view_zone_logic.h
Normal file
71
cockatrice/src/game/zones/view_zone_logic.h
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/**
|
||||
* @file view_zone_logic.h
|
||||
* @ingroup GameLogicZones
|
||||
* @brief TODO: Document this.
|
||||
*/
|
||||
|
||||
#ifndef COCKATRICE_VIEW_ZONE_LOGIC_H
|
||||
#define COCKATRICE_VIEW_ZONE_LOGIC_H
|
||||
#include "card_zone_logic.h"
|
||||
|
||||
class ZoneViewZoneLogic : public CardZoneLogic
|
||||
{
|
||||
Q_OBJECT
|
||||
signals:
|
||||
void addToViews();
|
||||
void removeFromViews();
|
||||
void closeView();
|
||||
|
||||
private:
|
||||
CardZoneLogic *origZone;
|
||||
int numberCards;
|
||||
bool revealZone, writeableRevealZone;
|
||||
bool isReversed;
|
||||
|
||||
public:
|
||||
enum CardAction
|
||||
{
|
||||
INITIALIZE,
|
||||
ADD_CARD,
|
||||
REMOVE_CARD
|
||||
};
|
||||
|
||||
ZoneViewZoneLogic(Player *_player,
|
||||
CardZoneLogic *_origZone,
|
||||
int _numberCards,
|
||||
bool _revealZone,
|
||||
bool _writeableRevealZone,
|
||||
bool _isReversed,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
bool prepareAddCard(int x);
|
||||
void removeCard(int position, bool toNewZone);
|
||||
void updateCardIds(CardAction action);
|
||||
int getNumberCards() const
|
||||
{
|
||||
return numberCards;
|
||||
}
|
||||
bool getRevealZone() const
|
||||
{
|
||||
return revealZone;
|
||||
}
|
||||
bool getWriteableRevealZone() const
|
||||
{
|
||||
return writeableRevealZone;
|
||||
}
|
||||
void setWriteableRevealZone(bool _writeableRevealZone);
|
||||
bool getIsReversed() const
|
||||
{
|
||||
return isReversed;
|
||||
}
|
||||
|
||||
CardZoneLogic *getOriginalZone() const
|
||||
{
|
||||
return origZone;
|
||||
}
|
||||
|
||||
protected:
|
||||
void addCardImpl(CardItem *card, int x, int y) override;
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_VIEW_ZONE_LOGIC_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue