[Refactor] Move the remaining zone commands out of game_graphics/zones/

This commit is contained in:
Lukas Brübach 2026-10-06 13:10:58 +02:00 • committed by GitHub
parent 271d40302c
commit aabec45d2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 64 additions and 39 deletions

View file

@ -26,7 +26,6 @@
#include <QtMath>
#include <functional>
#include <libcockatrice/card/card_localization.h>
#include <libcockatrice/protocol/pb/command_dump_zone.pb.h>
#include <libcockatrice/protocol/pb/response_dump_zone.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_card.pb.h>
#include <libcockatrice/protocol/pending_command.h>
@ -98,15 +97,10 @@ void ZoneViewZone::initializeCards(const QList<const ServerInfo_Card *> &cardLis
}
reorganizeCards();
} else if (!qobject_cast<ZoneViewZoneLogic *>(getLogic())->getOriginalZone()->contentsKnown()) {
Command_DumpZone cmd;
cmd.set_player_id(getLogic()->getPlayer()->getPlayerInfo()->getId());
cmd.set_zone_name(getLogic()->getName().toStdString());
cmd.set_number_cards(numberCards);
cmd.set_is_reversed(qobject_cast<ZoneViewZoneLogic *>(getLogic())->getIsReversed());
PendingCommand *pend = getLogic()->getPlayer()->getPlayerActions()->prepareGameCommand(cmd);
auto *playerActions = getLogic()->getPlayer()->getPlayerActions();
PendingCommand *pend = playerActions->prepareZoneDump(getLogic(), numberCards);
connect(pend, &PendingCommand::finished, this, &ZoneViewZone::zoneDumpReceived);
getLogic()->getPlayer()->getPlayerActions()->sendGameCommand(pend);
playerActions->sendGameCommand(pend);
} else {
const CardList &c = qobject_cast<ZoneViewZoneLogic *>(getLogic())->getOriginalZone()->getCards();
int number = numberCards == -1 ? c.size() : (numberCards < c.size() ? numberCards : c.size());