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