mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-30 18:43:55 -07:00
fix cards having the wrong printing if rejoin game before card db finishes loading (#5390)
* rename cardInfoUpdated to refreshCardInfo and make it public * refresh card infos when db finishes loading
This commit is contained in:
parent
d231264a16
commit
b6793a5e01
4 changed files with 24 additions and 5 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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue