- Fix issue 156 (artifact colors)
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-11-14 13:15:22 +00:00
parent dc5195a475
commit aa2121e4fa
3 changed files with 13 additions and 16 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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++){