diff options
Diffstat (limited to 'include/cardeval.hpp')
-rw-r--r-- | include/cardeval.hpp | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/include/cardeval.hpp b/include/cardeval.hpp index 87493a6..5fc507e 100644 --- a/include/cardeval.hpp +++ b/include/cardeval.hpp @@ -20,11 +20,14 @@ #include <vector> #include <sstream> +// test include will be removed later +#include <iostream> + // external libraries #include <tinyxml2.h> // structure that stores card information -struct cardStruct { +struct card_struct { // booleans to be set to determine card bool is_collectible; @@ -43,7 +46,7 @@ struct cardStruct { std::string card_name; std::string class_name; - cardStruct() { + card_struct() { // initialising the variables is_collectible = false; @@ -62,6 +65,12 @@ struct cardStruct { card_name = ""; class_name = ""; } + + std::string card_print_format() { + std::stringstream ss; + ss << card_name << " (Rarity: " << rarity << "):\n\tCost: " << cost << ", Attack: " << attack << ", Health: " << health << ", Durability: " << durability << "\n\tClass: " << class_name << "\n\tAbilities: " << abilities << std::endl; + return ss.str(); + } }; class CardEval { @@ -75,21 +84,30 @@ public: ~CardEval(); // gets the cards from the xml file and saves them in memory for easy usability inside the program with all the information in a struct - void getCards(std::vector<cardStruct> &cardDeck); + void get_cards(); protected: // exits the program with an error void exit_with_error(); + // adds the card to a vector that it belongs to + void add_card_to_vec(card_struct &in_card); + + // gets the type of the card and returns the appropriate char char get_type(std::string type_str); + // gets the class of the card and returns the class name std::string get_class(std::string class_str); + // assigns the values to the card struct which can then be added to the vectors + card_struct set_card_info(tinyxml2::XMLElement* tag_it); private: + // variable that holds the xml document in memory tinyxml2::XMLDocument card_doc; // vectors that load all the card information into memory - std::vector<cardStruct> minions; - std::vector<cardStruct> spells; - std::vector<cardStruct> weapons; - std::vector<cardStruct> heroes; - std::vector<cardStruct> hero_powers; + std::vector<card_struct> minions; + std::vector<card_struct> spells; + std::vector<card_struct> weapons; + std::vector<card_struct> heroes; + std::vector<card_struct> hero_powers; + std::vector<card_struct> random; }; #endif |