mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Cleaned up decklist code
This commit is contained in:
parent
ab11a40863
commit
16541141bd
11 changed files with 144 additions and 487 deletions
|
|
@ -6,6 +6,7 @@
|
|||
#include "server_game.h"
|
||||
#include "server_protocolhandler.h"
|
||||
#include "decklist.h"
|
||||
#include "color.h"
|
||||
#include "pb/response.pb.h"
|
||||
#include "pb/command_move_card.pb.h"
|
||||
#include "pb/serverinfo_user.pb.h"
|
||||
|
|
@ -133,26 +134,28 @@ void Server_Player::setupZones()
|
|||
}
|
||||
}
|
||||
|
||||
const QList<MoveCardToZone *> &sideboardPlan = deck->getCurrentSideboardPlan();
|
||||
const QList<MoveCard_ToZone> &sideboardPlan = deck->getCurrentSideboardPlan();
|
||||
for (int i = 0; i < sideboardPlan.size(); ++i) {
|
||||
MoveCardToZone *m = sideboardPlan[i];
|
||||
const MoveCard_ToZone &m = sideboardPlan[i];
|
||||
const QString startZone = QString::fromStdString(m.start_zone());
|
||||
const QString targetZone = QString::fromStdString(m.target_zone());
|
||||
|
||||
Server_CardZone *start, *target;
|
||||
if (m->getStartZone() == "main")
|
||||
if (startZone == "main")
|
||||
start = deckZone;
|
||||
else if (m->getStartZone() == "side")
|
||||
else if (startZone == "side")
|
||||
start = sbZone;
|
||||
else
|
||||
continue;
|
||||
if (m->getTargetZone() == "main")
|
||||
if (targetZone == "main")
|
||||
target = deckZone;
|
||||
else if (m->getTargetZone() == "side")
|
||||
else if (targetZone == "side")
|
||||
target = sbZone;
|
||||
else
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < start->cards.size(); ++j)
|
||||
if (start->cards[j]->getName() == m->getCardName()) {
|
||||
if (start->cards[j]->getName() == QString::fromStdString(m.card_name())) {
|
||||
Server_Card *card = start->cards[j];
|
||||
start->cards.removeAt(j);
|
||||
target->cards.append(card);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue