* Split constants file to have them in a single place.
This commit is contained in:
jean.chalard
2009-01-06 13:07:28 +00:00
parent 9024cf7cf5
commit 3bb2c431c9
33 changed files with 512 additions and 597 deletions

View File

@@ -3,7 +3,7 @@
DeckDataWrapper::DeckDataWrapper(MTGDeck * deck){
parent = deck;
for (int i = 0; i <= MTG_NB_COLORS; i++){
for (int i = 0; i <= Constants::MTG_NB_COLORS; i++){
colors[i] = 0;
}
for (int i = 0; i < deck->totalCards(); i++){
@@ -33,22 +33,22 @@ DeckDataWrapper::~DeckDataWrapper(){
void DeckDataWrapper::updateCounts(MTGCard * card, int removed){
if (!card){
for (int i = 0; i < MTG_NB_COLORS+1; i++){
for (int i = 0; i < Constants::MTG_NB_COLORS+1; i++){
colors[i] = 0;
}
map<MTGCard *,int,Cmp1>::iterator it;
for ( it=cards.begin() ; it != cards.end(); it++ ){
MTGCard * current = (*it).first;
colors[MTG_NB_COLORS] += (*it).second;
for (int i = 0; i < MTG_NB_COLORS; i++){
colors[Constants::MTG_NB_COLORS] += (*it).second;
for (int i = 0; i < Constants::MTG_NB_COLORS; i++){
if (current->hasColor(i)) colors[i]+=(*it).second;
}
}
}else{
int increment = 1;
if (removed) increment = -1;
colors[MTG_NB_COLORS] += increment;
for (int i = 0; i < MTG_NB_COLORS; i++){
colors[Constants::MTG_NB_COLORS] += increment;
for (int i = 0; i < Constants::MTG_NB_COLORS; i++){
if (card->hasColor(i)) colors[i]+=increment;
}
}
@@ -75,7 +75,6 @@ MTGCard * DeckDataWrapper::getNext(MTGCard * previous, int color){
map<MTGCard *,int,Cmp1>::iterator it;
it = cards.find(previous);
int found = 0;
while(1){
if (it == cards.end()){
@@ -95,7 +94,6 @@ MTGCard * DeckDataWrapper::getNext(MTGCard * previous, int color){
MTGCard * DeckDataWrapper::getPrevious(MTGCard * next, int color){
map<MTGCard *,int,Cmp1>::iterator it;
it = cards.find(next);
int found = 0;
while(1){
if (it == cards.begin()){
@@ -126,6 +124,6 @@ void DeckDataWrapper::updateCurrentPosition(MTGCard * currentCard, int color){
}
int DeckDataWrapper::getCount(int color){
if (color == -1) return colors[MTG_NB_COLORS];
if (color == -1) return colors[Constants::MTG_NB_COLORS];
return colors[color];
}