mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 08:52:15 -07:00
refresh card infos when db finishes loading
This commit is contained in:
parent
53efa113ef
commit
3a9e5e7e4a
2 changed files with 16 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include "card_zone.h"
|
||||
|
||||
#include "../cards/card_database_manager.h"
|
||||
#include "../cards/card_item.h"
|
||||
#include "../player/player.h"
|
||||
#include "pb/command_move_card.pb.h"
|
||||
|
|
@ -31,6 +32,11 @@ CardZone::CardZone(Player *_p,
|
|||
{
|
||||
if (!isView)
|
||||
player->addZone(this);
|
||||
|
||||
// If we join a game before the card db finishes loading, the cards might have the wrong printings.
|
||||
// Force refresh all cards in the zone when db finishes loading to fix that.
|
||||
connect(CardDatabaseManager::getInstance(), &CardDatabase::cardDatabaseLoadingFinished, this,
|
||||
&CardZone::refreshCardInfos);
|
||||
}
|
||||
|
||||
CardZone::~CardZone()
|
||||
|
|
@ -119,6 +125,13 @@ bool CardZone::showContextMenu(const QPoint &screenPos)
|
|||
return false;
|
||||
}
|
||||
|
||||
void CardZone::refreshCardInfos()
|
||||
{
|
||||
for (const auto &cardItem : cards) {
|
||||
cardItem->refreshCardInfo();
|
||||
}
|
||||
}
|
||||
|
||||
void CardZone::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::RightButton) {
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@ public slots:
|
|||
void moveAllToZone();
|
||||
bool showContextMenu(const QPoint &screenPos);
|
||||
|
||||
private slots:
|
||||
void refreshCardInfos();
|
||||
|
||||
public:
|
||||
enum
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue