Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
9e2da246
Commit
9e2da246
authored
Jul 06, 2015
by
Zach H
Browse files
use QSet for zones
parent
8e4f0c50
Changes
1
Hide whitespace changes
Inline
Side-by-side
common/decklist.cpp
View file @
9e2da246
...
...
@@ -727,6 +727,11 @@ void DeckList::updateDeckHash()
{
QStringList
cardList
;
bool
isValidDeckList
=
true
;
static
QSet
<
QString
>
hashZones
,
optionalZones
;
hashZones
<<
"main"
<<
"side"
;
// Zones in deck to be included in hashing process
optionalZones
<<
"tokens"
;
// Optional zones in deck not included in hashing process
for
(
int
i
=
0
;
i
<
root
->
size
();
i
++
)
{
InnerDecklistNode
*
node
=
dynamic_cast
<
InnerDecklistNode
*>
(
root
->
at
(
i
));
...
...
@@ -735,11 +740,11 @@ void DeckList::updateDeckHash()
DecklistCardNode
*
card
=
dynamic_cast
<
DecklistCardNode
*>
(
node
->
at
(
j
));
for
(
int
k
=
0
;
k
<
card
->
getNumber
();
++
k
)
{
if
(
node
->
getName
()
==
"main"
||
node
->
getName
()
==
"side"
)
// Mainboard or Sideboard
if
(
hashZones
.
contains
(
node
->
getName
()
)
)
// Mainboard or Sideboard
{
cardList
.
append
((
node
->
getName
()
==
"side"
?
"SB:"
:
""
)
+
card
->
getName
().
toLower
());
}
else
if
(
node
->
getName
()
!=
"tokens"
)
// Neither Mainboard, Sideboard, or Tokens...
cheater?
else
if
(
!
optionalZones
.
contains
(
node
->
getName
()))
// Not a valid zone ->
cheater?
{
isValidDeckList
=
false
;
// Deck is invalid
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment