From 6dc69ded2229be649094f0a6b8770089d2db4642 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Fri, 1 Jul 2016 22:09:08 +0800 Subject: [PATCH] parse "total" cards in set infor --- projects/mtg/include/MTGDeck.h | 1 + projects/mtg/src/GameStateAwards.cpp | 2 ++ projects/mtg/src/MTGDeck.cpp | 6 +++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/mtg/include/MTGDeck.h b/projects/mtg/include/MTGDeck.h index fcba1b192..cb901f2a7 100644 --- a/projects/mtg/include/MTGDeck.h +++ b/projects/mtg/include/MTGDeck.h @@ -25,6 +25,7 @@ public: string name; //Long name: Tenth Edition int block; //For future use by tournament mode, etc. int year; //The year the set was released. + int total;//total cards //TODO Way to group cards by name, rather than mtgid. void count(MTGCard * c); diff --git a/projects/mtg/src/GameStateAwards.cpp b/projects/mtg/src/GameStateAwards.cpp index 8012f6825..d973d69d9 100644 --- a/projects/mtg/src/GameStateAwards.cpp +++ b/projects/mtg/src/GameStateAwards.cpp @@ -108,6 +108,8 @@ void GameStateAwards::Start() if (!si->author.size()) sprintf(buf, _("%i cards.").c_str(), si->totalCards()); + else if (si->year > 0 && si->total > 0) + sprintf(buf, _("%s (%i): %i/%i cards").c_str(), si->author.c_str(), si->year, si->totalCards(), si->total); else if (si->year > 0) sprintf(buf, _("%s (%i): %i cards").c_str(), si->author.c_str(), si->year, si->totalCards()); else diff --git a/projects/mtg/src/MTGDeck.cpp b/projects/mtg/src/MTGDeck.cpp index f0beba462..6c2ab7622 100644 --- a/projects/mtg/src/MTGDeck.cpp +++ b/projects/mtg/src/MTGDeck.cpp @@ -1383,6 +1383,7 @@ MTGSetInfo::MTGSetInfo(const string& _id) id = _id; block = -1; year = -1; + total = -1; for (int i = 0; i < MTGSetInfo::MAX_COUNT; i++) counts[i] = 0; @@ -1458,5 +1459,8 @@ void MTGSetInfo::processConfLine(string line) author = value; else if (key.compare("block") == 0) block = setlist.findBlock(value.c_str()); - else if (key.compare("year") == 0) year = atoi(value.c_str()); + else if (key.compare("year") == 0) + year = atoi(value.c_str()); + else if (key.compare("total") == 0) + total = atoi(value.c_str()); }