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
339db24b
Commit
339db24b
authored
Jul 06, 2015
by
Zach H
Browse files
efficency loop
parent
9e2da246
Changes
1
Hide whitespace changes
Inline
Side-by-side
common/decklist.cpp
View file @
339db24b
...
@@ -727,7 +727,7 @@ void DeckList::updateDeckHash()
...
@@ -727,7 +727,7 @@ void DeckList::updateDeckHash()
{
{
QStringList
cardList
;
QStringList
cardList
;
bool
isValidDeckList
=
true
;
bool
isValidDeckList
=
true
;
static
QSet
<
QString
>
hashZones
,
optionalZones
;
QSet
<
QString
>
hashZones
,
optionalZones
;
hashZones
<<
"main"
<<
"side"
;
// Zones in deck to be included in hashing process
hashZones
<<
"main"
<<
"side"
;
// Zones in deck to be included in hashing process
optionalZones
<<
"tokens"
;
// Optional zones in deck not included in hashing process
optionalZones
<<
"tokens"
;
// Optional zones in deck not included in hashing process
...
@@ -737,17 +737,15 @@ void DeckList::updateDeckHash()
...
@@ -737,17 +737,15 @@ void DeckList::updateDeckHash()
InnerDecklistNode
*
node
=
dynamic_cast
<
InnerDecklistNode
*>
(
root
->
at
(
i
));
InnerDecklistNode
*
node
=
dynamic_cast
<
InnerDecklistNode
*>
(
root
->
at
(
i
));
for
(
int
j
=
0
;
j
<
node
->
size
();
j
++
)
for
(
int
j
=
0
;
j
<
node
->
size
();
j
++
)
{
{
DecklistCardNode
*
card
=
dynamic_cast
<
DecklistCardNode
*>
(
node
->
at
(
j
));
if
(
hashZones
.
contains
(
node
->
getName
()))
// Mainboard or Sideboard
for
(
int
k
=
0
;
k
<
card
->
getNumber
();
++
k
)
{
{
if
(
hashZones
.
contains
(
node
->
getName
()))
// Mainboard or Sideboard
DecklistCardNode
*
card
=
dynamic_cast
<
DecklistCardNode
*>
(
node
->
at
(
j
));
{
for
(
int
k
=
0
;
k
<
card
->
getNumber
();
++
k
)
cardList
.
append
((
node
->
getName
()
==
"side"
?
"SB:"
:
""
)
+
card
->
getName
().
toLower
());
cardList
.
append
((
node
->
getName
()
==
"side"
?
"SB:"
:
""
)
+
card
->
getName
().
toLower
());
}
}
else
if
(
!
optionalZones
.
contains
(
node
->
getName
()))
// Not a valid zone -> cheater?
else
if
(
!
optionalZones
.
contains
(
node
->
getName
()))
// Not a valid zone -> cheater?
{
{
isValidDeckList
=
false
;
// Deck is invalid
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