Erwan
- Fix issue 156 (artifact colors)
This commit is contained in:
@@ -54,6 +54,7 @@ class MTGCard {
|
|||||||
void removeColor(int color);
|
void removeColor(int color);
|
||||||
int getColor();
|
int getColor();
|
||||||
int hasColor(int _color);
|
int hasColor(int _color);
|
||||||
|
int countColors();
|
||||||
const char * colorToString();
|
const char * colorToString();
|
||||||
|
|
||||||
void setMTGId(int id);
|
void setMTGId(int id);
|
||||||
|
|||||||
@@ -119,13 +119,8 @@ void CardGui::Render()
|
|||||||
|
|
||||||
JQuad * CardGui::alternateThumbQuad(MTGCard * card){
|
JQuad * CardGui::alternateThumbQuad(MTGCard * card){
|
||||||
JQuad * q;
|
JQuad * q;
|
||||||
int nb_colors = 0;
|
|
||||||
for(int i=0;i<Constants::MTG_NB_COLORS;i++){
|
|
||||||
if(card->colors[i])
|
|
||||||
nb_colors++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(nb_colors > 1){
|
if(card->countColors() > 1){
|
||||||
q = resources.RetrieveTempQuad("gold_thumb.jpg");
|
q = resources.RetrieveTempQuad("gold_thumb.jpg");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -153,16 +148,9 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
|||||||
|
|
||||||
float x = pos.actX;
|
float x = pos.actX;
|
||||||
|
|
||||||
int nb_colors = 0;
|
if(card->countColors() > 1) {
|
||||||
for(int i=0;i<Constants::MTG_NB_COLORS;i++){
|
|
||||||
if(card->colors[i])
|
|
||||||
nb_colors++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(nb_colors > 1){
|
|
||||||
q = resources.RetrieveTempQuad("gold.jpg");
|
q = resources.RetrieveTempQuad("gold.jpg");
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
switch(card->getColor())
|
switch(card->getColor())
|
||||||
{
|
{
|
||||||
case Constants::MTG_COLOR_ARTIFACT: q = resources.RetrieveTempQuad("artifact.jpg");break;
|
case Constants::MTG_COLOR_ARTIFACT: q = resources.RetrieveTempQuad("artifact.jpg");break;
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ void MTGCard::removeColor(int _color){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int MTGCard::getColor(){
|
int MTGCard::getColor(){
|
||||||
for (int i=0; i<Constants::MTG_NB_COLORS; i++){
|
for (int i=1; i<Constants::MTG_NB_COLORS; i++){
|
||||||
if (colors[i]){
|
if (colors[i]){
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@@ -164,6 +164,14 @@ int MTGCard::hasColor(int color){
|
|||||||
return (colors[color]);
|
return (colors[color]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MTGCard::countColors(){
|
||||||
|
int result = 0;
|
||||||
|
for(int i=Constants::MTG_COLOR_GREEN;i<=Constants::MTG_COLOR_WHITE;i++){
|
||||||
|
if (hasColor(i)) result++;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void MTGCard::setManaCost(string s){
|
void MTGCard::setManaCost(string s){
|
||||||
ManaCost::parseManaCost(s, &manaCost);
|
ManaCost::parseManaCost(s, &manaCost);
|
||||||
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; i++){
|
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; i++){
|
||||||
|
|||||||
Reference in New Issue
Block a user