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
518bda8c
Commit
518bda8c
authored
Jun 13, 2015
by
Fabio Bas
Browse files
Rotate 180 degrees the art of flipped cards
parent
88269089
Changes
4
Show whitespace changes
Inline
Side-by-side
cockatrice/src/carddatabase.cpp
View file @
518bda8c
...
...
@@ -483,6 +483,7 @@ CardInfo::CardInfo(CardDatabase *_db,
const
QString
&
_text
,
const
QStringList
&
_colors
,
const
QStringList
&
_relatedCards
,
bool
_upsideDownArt
,
int
_loyalty
,
bool
_cipt
,
int
_tableRow
,
...
...
@@ -502,6 +503,7 @@ CardInfo::CardInfo(CardDatabase *_db,
text
(
_text
),
colors
(
_colors
),
relatedCards
(
_relatedCards
),
upsideDownArt
(
_upsideDownArt
),
loyalty
(
_loyalty
),
customPicURLs
(
_customPicURLs
),
customPicURLsHq
(
_customPicURLsHq
),
...
...
@@ -583,7 +585,13 @@ void CardInfo::loadPixmap(QPixmap &pixmap)
void
CardInfo
::
imageLoaded
(
const
QImage
&
image
)
{
if
(
!
image
.
isNull
())
{
if
(
upsideDownArt
)
{
QImage
mirrorImage
=
image
.
mirrored
(
true
,
true
);
QPixmapCache
::
insert
(
pixmapCacheKey
,
QPixmap
::
fromImage
(
mirrorImage
));
}
else
{
QPixmapCache
::
insert
(
pixmapCacheKey
,
QPixmap
::
fromImage
(
image
));
}
emit
pixmapUpdated
();
}
}
...
...
@@ -705,6 +713,8 @@ static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfo *info)
xml
.
writeTextElement
(
"cipt"
,
"1"
);
if
(
info
->
getIsToken
())
xml
.
writeTextElement
(
"token"
,
"1"
);
if
(
info
->
getUpsideDownArt
())
xml
.
writeTextElement
(
"upsidedown"
,
"1"
);
xml
.
writeEndElement
();
// card
return
xml
;
...
...
@@ -867,6 +877,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml, bool tokens)
int
loyalty
=
0
;
bool
cipt
=
false
;
bool
isToken
=
false
;
bool
upsideDown
=
false
;
while
(
!
xml
.
atEnd
())
{
if
(
xml
.
readNext
()
==
QXmlStreamReader
::
EndElement
)
break
;
...
...
@@ -903,6 +914,8 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml, bool tokens)
tableRow
=
xml
.
readElementText
().
toInt
();
else
if
(
xml
.
name
()
==
"cipt"
)
cipt
=
(
xml
.
readElementText
()
==
"1"
);
else
if
(
xml
.
name
()
==
"upsidedown"
)
upsideDown
=
(
xml
.
readElementText
()
==
"1"
);
else
if
(
xml
.
name
()
==
"loyalty"
)
loyalty
=
xml
.
readElementText
().
toInt
();
else
if
(
xml
.
name
()
==
"token"
)
...
...
@@ -910,7 +923,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml, bool tokens)
}
if
(
isToken
==
tokens
)
{
addCard
(
new
CardInfo
(
this
,
name
,
isToken
,
manacost
,
cmc
,
type
,
pt
,
text
,
colors
,
relatedCards
,
loyalty
,
cipt
,
tableRow
,
sets
,
customPicURLs
,
customPicURLsHq
,
muids
));
addCard
(
new
CardInfo
(
this
,
name
,
isToken
,
manacost
,
cmc
,
type
,
pt
,
text
,
colors
,
relatedCards
,
upsideDown
,
loyalty
,
cipt
,
tableRow
,
sets
,
customPicURLs
,
customPicURLsHq
,
muids
));
}
}
}
...
...
cockatrice/src/carddatabase.h
View file @
518bda8c
...
...
@@ -133,6 +133,7 @@ private:
QString
text
;
QStringList
colors
;
QStringList
relatedCards
;
bool
upsideDownArt
;
int
loyalty
;
QStringMap
customPicURLs
,
customPicURLsHq
;
MuidMap
muIds
;
...
...
@@ -150,6 +151,7 @@ public:
const
QString
&
_text
=
QString
(),
const
QStringList
&
_colors
=
QStringList
(),
const
QStringList
&
_relatedCards
=
QStringList
(),
bool
_upsideDownArt
=
false
,
int
_loyalty
=
0
,
bool
_cipt
=
false
,
int
_tableRow
=
0
,
...
...
@@ -178,6 +180,7 @@ public:
void
setColors
(
const
QStringList
&
_colors
)
{
colors
=
_colors
;
emit
cardInfoChanged
(
this
);
}
const
QStringList
&
getColors
()
const
{
return
colors
;
}
const
QStringList
&
getRelatedCards
()
const
{
return
relatedCards
;
}
bool
getUpsideDownArt
()
const
{
return
upsideDownArt
;
}
QString
getCustomPicURL
(
const
QString
&
set
)
const
{
return
customPicURLs
.
value
(
set
);
}
QString
getCustomPicURLHq
(
const
QString
&
set
)
const
{
return
customPicURLsHq
.
value
(
set
);
}
int
getMuId
(
const
QString
&
set
)
const
{
return
muIds
.
value
(
set
);
}
...
...
oracle/src/oracleimporter.cpp
View file @
518bda8c
...
...
@@ -66,7 +66,8 @@ CardInfo *OracleImporter::addCard(const QString &setName,
int
cardLoyalty
,
const
QString
&
cardText
,
const
QStringList
&
colors
,
const
QStringList
&
relatedCards
const
QStringList
&
relatedCards
,
bool
upsideDown
)
{
QStringList
cardTextRows
=
cardText
.
split
(
"
\n
"
);
...
...
@@ -99,7 +100,7 @@ CardInfo *OracleImporter::addCard(const QString &setName,
bool
cipt
=
cardText
.
contains
(
"Hideaway"
)
||
(
cardText
.
contains
(
cardName
+
" enters the battlefield tapped"
)
&&
!
cardText
.
contains
(
cardName
+
" enters the battlefield tapped unless"
));
card
=
new
CardInfo
(
this
,
cardName
,
isToken
,
cardCost
,
cmc
,
cardType
,
cardPT
,
cardText
,
colors
,
relatedCards
,
cardLoyalty
,
cipt
);
card
=
new
CardInfo
(
this
,
cardName
,
isToken
,
cardCost
,
cmc
,
cardType
,
cardPT
,
cardText
,
colors
,
relatedCards
,
upsideDown
,
cardLoyalty
,
cipt
);
int
tableRow
=
1
;
QString
mainCardType
=
card
->
getMainCardType
();
if
((
mainCardType
==
"Land"
)
||
mArtifact
)
...
...
@@ -153,6 +154,7 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QVariant &data)
int
cardId
;
int
cardLoyalty
;
bool
cardIsToken
=
false
;
bool
upsideDown
=
false
;
QMap
<
int
,
QVariantMap
>
splitCards
;
while
(
it
.
hasNext
())
{
...
...
@@ -208,6 +210,7 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QVariant &data)
colors
.
removeDuplicates
();
relatedCards
=
QStringList
();
upsideDown
=
false
;
}
else
{
// first card of a pair; enqueue for later merging
// Conditional on cardId because promo prints have no muid - see #640
...
...
@@ -229,6 +232,14 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QVariant &data)
relatedCards
=
map
.
contains
(
"names"
)
?
map
.
value
(
"names"
).
toStringList
()
:
QStringList
();
relatedCards
.
removeAll
(
cardName
);
if
(
0
==
QString
::
compare
(
map
.
value
(
"layout"
).
toString
(),
QString
(
"flip"
),
Qt
::
CaseInsensitive
))
{
QStringList
cardNames
=
map
.
contains
(
"names"
)
?
map
.
value
(
"names"
).
toStringList
()
:
QStringList
();
upsideDown
=
(
cardNames
.
indexOf
(
cardName
)
>
0
);
}
else
{
upsideDown
=
false
;
}
colors
.
clear
();
extractColors
(
map
.
value
(
"colors"
).
toStringList
(),
colors
);
...
...
@@ -239,7 +250,7 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QVariant &data)
}
if
(
!
cardIsToken
)
{
CardInfo
*
card
=
addCard
(
set
->
getShortName
(),
cardName
,
cardIsToken
,
cardId
,
cardCost
,
cmc
,
cardType
,
cardPT
,
cardLoyalty
,
cardText
,
colors
,
relatedCards
);
CardInfo
*
card
=
addCard
(
set
->
getShortName
(),
cardName
,
cardIsToken
,
cardId
,
cardCost
,
cmc
,
cardType
,
cardPT
,
cardLoyalty
,
cardText
,
colors
,
relatedCards
,
upsideDown
);
if
(
!
set
->
contains
(
card
))
{
card
->
addToSet
(
set
);
...
...
oracle/src/oracleimporter.h
View file @
518bda8c
...
...
@@ -29,7 +29,7 @@ private:
QVariantMap
setsMap
;
QString
dataDir
;
CardInfo
*
addCard
(
const
QString
&
setName
,
QString
cardName
,
bool
isToken
,
int
cardId
,
QString
&
cardCost
,
QString
&
cmc
,
const
QString
&
cardType
,
const
QString
&
cardPT
,
int
cardLoyalty
,
const
QString
&
cardText
,
const
QStringList
&
colors
,
const
QStringList
&
relatedCards
);
CardInfo
*
addCard
(
const
QString
&
setName
,
QString
cardName
,
bool
isToken
,
int
cardId
,
QString
&
cardCost
,
QString
&
cmc
,
const
QString
&
cardType
,
const
QString
&
cardPT
,
int
cardLoyalty
,
const
QString
&
cardText
,
const
QStringList
&
colors
,
const
QStringList
&
relatedCards
,
bool
upsideDown
);
signals:
void
setIndexChanged
(
int
cardsImported
,
int
setIndex
,
const
QString
&
setName
);
void
dataReadProgress
(
int
bytesRead
,
int
totalBytes
);
...
...
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